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
astropy__astropy
astropy/coordinates/representation/geodetic.py
{ "start": 6735, "end": 6893 }
class ____(BaseGeodeticRepresentation): """Representation of points in GRS80 3D geodetic coordinates.""" _ellipsoid = "GRS80"
GRS80GeodeticRepresentation
python
docker__docker-py
tests/unit/models_configs_test.py
{ "start": 104, "end": 363 }
class ____(unittest.TestCase): def test_create_config(self): client = make_fake_client() config = client.configs.create(name="super_config", data="config") assert config.__repr__() == f"<Config: '{FAKE_CONFIG_NAME}'>"
CreateConfigsTest
python
django-debug-toolbar__django-debug-toolbar
tests/panels/test_profiling.py
{ "start": 467, "end": 3689 }
class ____(BaseTestCase): panel_id = ProfilingPanel.panel_id def test_regular_view(self): self._get_response = lambda request: regular_view(request, "profiling") response = self.panel.process_request(self.request) self.panel.generate_stats(self.request, response) self.assertIn("...
ProfilingPanelTestCase
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/typePrinter1.py
{ "start": 171, "end": 203 }
class ____: class Inner: ...
A
python
apache__thrift
contrib/zeromq/TZmqClient.py
{ "start": 904, "end": 2059 }
class ____(TTransportBase, CReadableTransport): def __init__(self, ctx, endpoint, sock_type): self._sock = ctx.socket(sock_type) self._endpoint = endpoint self._wbuf = StringIO() self._rbuf = StringIO() def open(self): self._sock.connect(self._endpoint) def read(sel...
TZmqClient
python
astropy__astropy
astropy/io/misc/ecsv.py
{ "start": 11305, "end": 12482 }
class ____(ECSVEngine): """ECSV reader engine using astropy.io.ascii Python CSV reader.""" name = "io.ascii" format = "ascii.csv" def convert_np_type(self, np_type: str) -> np.generic: # Convert the np_type string to a numpy dtype type like np.int32, np.float64, # etc. This output is c...
ECSVEngineIoAscii
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_merge_cells01.py
{ "start": 315, "end": 1110 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("merge_cells01.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file.""" workbook = Workbook(self.got...
TestCompareXLSXFiles
python
ansible__ansible
lib/ansible/utils/_junit_xml.py
{ "start": 3605, "end": 6451 }
class ____: """A collection of test cases.""" name: str hostname: str | None = None id: str | None = None package: str | None = None timestamp: datetime.datetime | None = None properties: dict[str, str] = dataclasses.field(default_factory=dict) cases: list[TestCase] = dataclasses.field...
TestSuite
python
huggingface__transformers
src/transformers/models/sam3_tracker_video/configuration_sam3_tracker_video.py
{ "start": 3411, "end": 6758 }
class ____(PreTrainedConfig): r""" This is the configuration class to store the configuration of a [`Sam3TrackerVideoMaskDecoder`]. It is used to instantiate a SAM3_TRACKER_VIDEO memory encoder according to the specified arguments, defining the model architecture. Configuration objects inherit from [`P...
Sam3TrackerVideoMaskDecoderConfig
python
django__django
django/conf/__init__.py
{ "start": 1014, "end": 5473 }
class ____(LazyObject): """ A lazy proxy for either global Django settings or a custom settings object. The user can manually configure settings prior to using them. Otherwise, Django uses the settings module pointed to by DJANGO_SETTINGS_MODULE. """ def _setup(self, name=None): """ ...
LazySettings
python
Unity-Technologies__ml-agents
ml-agents-envs/mlagents_envs/communicator_objects/unity_to_external_pb2_grpc.py
{ "start": 929, "end": 2044 }
class ____(object): """Missing associated documentation comment in .proto file.""" def Exchange(self, request, context): """Sends the academy parameters """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplemente...
UnityToExternalProtoServicer
python
sqlalchemy__sqlalchemy
test/orm/test_dynamic.py
{ "start": 60397, "end": 67743 }
class ____: @testing.fixture def transient_fixture(self, user_address_fixture): def _transient_fixture(addresses_args={}): User, Address = user_address_fixture(addresses_args=addresses_args) u1 = User() a1 = Address() return u1, a1 yield _transie...
_HistoryTest
python
pytorch__pytorch
tools/linter/adapters/actionlint_linter.py
{ "start": 374, "end": 4125 }
class ____(NamedTuple): path: str | None line: int | None char: int | None code: str severity: LintSeverity name: str original: str | None replacement: str | None description: str | None RESULTS_RE: re.Pattern[str] = re.compile( r"""(?mx) ^ (?P<file>.*?): (?P<line>\...
LintMessage
python
readthedocs__readthedocs.org
readthedocs/api/v2/views/model_views.py
{ "start": 6948, "end": 8662 }
class ____(DisableListEndpoint, UpdateModelMixin, UserSelectViewSet): """List, filter, etc, Projects.""" permission_classes = [HasBuildAPIKey | ReadOnlyPermission] renderer_classes = (JSONRenderer,) serializer_class = ProjectSerializer admin_serializer_class = ProjectAdminSerializer model = Pro...
ProjectViewSet
python
huggingface__transformers
src/transformers/models/internvl/modeling_internvl.py
{ "start": 31831, "end": 38690 }
class ____(InternVLPreTrainedModel, GenerationMixin): _checkpoint_conversion_mapping = { r"^language_model.model": "model.language_model", r"^vision_tower": "model.vision_tower", r"^multi_modal_projector": "model.multi_modal_projector", r"^language_model.lm_head": "lm_head", } ...
InternVLForConditionalGeneration
python
apache__airflow
providers/microsoft/azure/tests/unit/microsoft/azure/transfers/test_sftp_to_wasb.py
{ "start": 1458, "end": 10416 }
class ____: def test_init(self): operator = SFTPToWasbOperator( task_id=TASK_ID, sftp_source_path=SOURCE_PATH_NO_WILDCARD, sftp_conn_id=SFTP_CONN_ID, container_name=CONTAINER_NAME, blob_prefix=BLOB_PREFIX, wasb_conn_id=WASB_CONN_ID, ...
TestSFTPToWasbOperator
python
huggingface__transformers
src/transformers/trainer_pt_utils.py
{ "start": 9778, "end": 11015 }
class ____(DistributedSampler): """ Like a torch.utils.data.distributed.DistributedSampler` but loops at the end back to the beginning of the shuffled samples to make each process have a round multiple of batch_size samples. Args: dataset (`torch.utils.data.Dataset`): Dataset used f...
DistributedSamplerWithLoop
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/sparse_ops/sparse_add_op_test.py
{ "start": 1672, "end": 10695 }
class ____(test.TestCase): def _randomTensor(self, size, np_dtype, sparse=True): n, m = size x = np.random.randn(n, m).astype(np_dtype) return _sparsify(x) if sparse else x def _SparseTensorValue_3x3(self, negate=False): # [ 1] # [2 ] # [3 4] # ...or its cwise negation, if `neg...
SparseAddTest
python
miyuchina__mistletoe
mistletoe/block_token.py
{ "start": 4221, "end": 5436 }
class ____(BlockToken): """ Document token. This is a container block token. Its children are block tokens - container or leaf ones. Attributes: footnotes (dictionary): link reference definitions. """ def __init__(self, lines: Union[str, Iterable[str]]): """ Instantiate...
Document
python
RaRe-Technologies__gensim
gensim/test/test_logentropy_model.py
{ "start": 485, "end": 2765 }
class ____(unittest.TestCase): TEST_CORPUS = [[(1, 1.0)], [], [(0, 0.5), (2, 1.0)], []] def setUp(self): self.corpus_small = MmCorpus(datapath('test_corpus_small.mm')) self.corpus_ok = MmCorpus(datapath('test_corpus_ok.mm')) self.corpus_empty = [] def test_generator_fail(self): ...
TestLogEntropyModel
python
coleifer__peewee
tests/reflection.py
{ "start": 1237, "end": 1315 }
class ____(TestModel): _id = AutoField() _name = CharField()
Underscores
python
dagster-io__dagster
python_modules/libraries/dagster-shared/dagster_shared/check/functions.py
{ "start": 50046, "end": 50096 }
class ____(CheckError): pass
ParameterCheckError
python
zarr-developers__zarr-python
src/zarr/core/dtype/npy/string.py
{ "start": 1900, "end": 2409 }
class ____(NamedConfig[Literal["fixed_length_utf32"], LengthBytesConfig]): """ The JSON representation of the ``FixedLengthUTF32`` data type in Zarr V3. References ---------- This representation is not currently defined in an external specification. Examples -------- ```python { ...
FixedLengthUTF32JSON_V3
python
jina-ai__jina
jina/proto/docarray_v1/pb/jina_pb2_grpc.py
{ "start": 12522, "end": 13024 }
class ____(object): """* jina gRPC service to expose Endpoints from Executors. """ def __init__(self, channel): """Constructor. Args: channel: A grpc.Channel. """ self.dry_run = channel.unary_unary( '/jina.JinaGatewayDryRunRPC/dry_run', ...
JinaGatewayDryRunRPCStub
python
qdrant__qdrant-client
qdrant_client/http/api/snapshots_api.py
{ "start": 21045, "end": 27711 }
class ____(_SnapshotsApi): def create_full_snapshot( self, wait: bool = None, ) -> m.InlineResponse20011: """ Create new snapshot of the whole storage """ return self._build_for_create_full_snapshot( wait=wait, ) def create_shard_snapshot(...
SyncSnapshotsApi
python
plotly__plotly.py
plotly/graph_objs/choroplethmap/colorbar/_tickfont.py
{ "start": 233, "end": 9949 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "choroplethmap.colorbar" _path_str = "choroplethmap.colorbar.tickfont" _valid_props = { "color", "family", "lineposition", "shadow", "size", "style", "textcase", "variant", "weight...
Tickfont
python
lxml__lxml
src/lxml/html/tests/test_html5parser.py
{ "start": 4986, "end": 6924 }
class ____(unittest.TestCase): def call_it(self, *args, **kwargs): if html5lib is None: raise unittest.SkipTest("html5lib is not installed") from lxml.html.html5parser import fragment_fromstring return fragment_fromstring(*args, **kwargs) def test_basic(self): elemen...
Test_fragment_fromstring
python
ansible__ansible
test/integration/targets/module_defaults/collections/ansible_collections/testns/testcoll/plugins/action/echoaction.py
{ "start": 84, "end": 432 }
class ____(ActionBase): TRANSFERS_FILES = False _VALID_ARGS = frozenset() def run(self, tmp=None, task_vars=None): if task_vars is None: task_vars = dict() result = super(ActionModule, self).run(None, task_vars) result = dict(changed=False, args_in=self._task.args) ...
ActionModule
python
redis__redis-py
redis/asyncio/connection.py
{ "start": 1834, "end": 2114 }
class ____(enum.Enum): sentinel = object() SENTINEL = _Sentinel.sentinel DefaultParser: Type[Union[_AsyncRESP2Parser, _AsyncRESP3Parser, _AsyncHiredisParser]] if HIREDIS_AVAILABLE: DefaultParser = _AsyncHiredisParser else: DefaultParser = _AsyncRESP2Parser
_Sentinel
python
ray-project__ray
python/ray/tune/examples/pbt_dcgan_mnist/common.py
{ "start": 1834, "end": 2566 }
class ____(nn.Module): def __init__(self): super(Generator, self).__init__() self.main = nn.Sequential( # input is Z, going into a convolution nn.ConvTranspose2d(nz, ngf * 4, 4, 1, 0, bias=False), nn.BatchNorm2d(ngf * 4), nn.ReLU(True), nn....
Generator
python
PrefectHQ__prefect
src/prefect/server/schemas/schedules.py
{ "start": 11182, "end": 18254 }
class ____(PrefectBaseModel): """ Cron schedule NOTE: If the timezone is a DST-observing one, then the schedule will adjust itself appropriately. Cron's rules for DST are based on schedule times, not intervals. This means that an hourly cron schedule will fire on every new schedule hour, not ev...
CronSchedule
python
imageio__imageio
imageio/plugins/_tifffile.py
{ "start": 25001, "end": 71110 }
class ____(object): """Write numpy arrays to TIFF file. TiffWriter instances must be closed using the 'close' method, which is automatically called when using the 'with' context manager. TiffWriter's main purpose is saving nD numpy array's as TIFF, not to create any possible TIFF format. Specifica...
TiffWriter
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 1010410, "end": 1010787 }
class ____( sgqlc.types.Type, Node, AuditEntry, OrganizationAuditEntryData, RepositoryAuditEntryData, TeamAuditEntryData, ): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("is_ldap_mapped",) is_ldap_mapped = sgqlc.types.Field(Boolea...
TeamAddRepositoryAuditEntry
python
huggingface__transformers
tests/models/rt_detr_v2/test_modeling_rt_detr_v2.py
{ "start": 26711, "end": 30061 }
class ____(unittest.TestCase): @cached_property def default_image_processor(self): return RTDetrImageProcessor.from_pretrained(CHECKPOINT) if is_vision_available() else None def test_inference_object_detection_head(self): model = RTDetrV2ForObjectDetection.from_pretrained(CHECKPOINT).to(tor...
RTDetrV2ModelIntegrationTest
python
Textualize__textual
tests/test_screen_modes.py
{ "start": 288, "end": 838 }
class ____(Screen[None]): BINDINGS = [ ("1", "one", "Mode 1"), ("2", "two", "Mode 2"), ("p", "push", "Push rnd scrn"), ("o", "app.pop_screen", "Pop"), ("r", "remove", "Remove mode 1"), ] def action_one(self) -> None: self.app.switch_mode("one") def actio...
ScreenBindingsMixin
python
getsentry__sentry
tests/sentry/workflow_engine/endpoints/validators/actions/test_ticketing.py
{ "start": 1378, "end": 1501 }
class ____(BaseTicketingActionValidatorTest): __test__ = True provider = Action.Type.GITHUB
TestGithubActionValidator
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 990186, "end": 992069 }
class ____(sgqlc.types.Type): """A Stripe Connect account for receiving sponsorship funds from GitHub Sponsors. """ __schema__ = github_schema __field_names__ = ( "account_id", "billing_country_or_region", "country_or_region", "is_active", "sponsors_listing",...
StripeConnectAccount
python
google__pytype
pytype/pytd/pytd.py
{ "start": 17785, "end": 18317 }
class ____(GenericType): """Special generic type for a Callable that specifies its argument types. A Callable with N arguments has N+1 parameters. The first N parameters are the individual argument types, in the order of the arguments, and the last parameter is the return type. """ @property def args(se...
CallableType
python
milvus-io__pymilvus
tests/test_orm_iterator.py
{ "start": 6404, "end": 7613 }
class ____: """Test iterator-related constants and their usage""" def test_batch_size_limits(self): """Test batch size calculation respects limits""" # Test minimum batch size batch_size = 1 next_param = {PARAMS: {}} result = extend_batch_size(batch_size, next_param, Fal...
TestIteratorConstants
python
pappasam__jedi-language-server
jedi_language_server/initialization_options.py
{ "start": 2881, "end": 2947 }
class ____: enable: bool = False @light_dataclass
SemanticTokens
python
celery__celery
t/integration/test_tasks.py
{ "start": 20015, "end": 22942 }
class ____: """Tests for tasks called via apply() method.""" def test_apply_single_task_ids(self, manager): """Test that a single task called via apply() has correct IDs.""" @manager.app.task(bind=True) def single_apply_task(self): return { 'task_id': self.re...
test_apply_tasks
python
great-expectations__great_expectations
contrib/great_expectations_semantic_types_expectations/great_expectations_semantic_types_expectations/expectations/expect_column_values_bitcoin_address_positive_balance.py
{ "start": 2098, "end": 4926 }
class ____(ColumnMapExpectation): """Expect column values Bitcoin address has got positive balance (>0).""" # These examples will be shown in the public gallery. # They will also be executed as unit tests for your Expectation. examples = [ { "data": { "all_valid": [ ...
ExpectColumnValuesBitcoinAddressPositiveBalance
python
zostera__django-bootstrap4
example/app/forms.py
{ "start": 405, "end": 2732 }
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
kamyu104__LeetCode-Solutions
Python/paint-fence.py
{ "start": 29, "end": 517 }
class ____(object): def numWays(self, n, k): """ :type n: int :type k: int :rtype: int """ if n == 0: return 0 elif n == 1: return k ways = [0] * 3 ways[0] = k ways[1] = (k - 1) * ways[0] + k for i in xra...
Solution
python
gevent__gevent
src/gevent/testing/testcase.py
{ "start": 5144, "end": 6752 }
class ____(gevent.Timeout): _expire_info = '' def __init__(self, timeout, method='Not Given'): gevent.Timeout.__init__( self, timeout, '%r: test timed out (set class __timeout__ to increase)\n' % (method,), ref=False ) def _on_expiration(self...
TestTimeout
python
lepture__authlib
authlib/oauth2/rfc9101/errors.py
{ "start": 789, "end": 999 }
class ____(OAuth2Error): error = "request_uri_not_supported" description = "The authorization server does not support the use of the request_uri parameter." status_code = 400
RequestUriNotSupportedError
python
jmcnamara__XlsxWriter
xlsxwriter/test/worksheet/test_cond_format19.py
{ "start": 345, "end": 4802 }
class ____(unittest.TestCase): """ Test assembling a complete Worksheet file. """ def test_assemble_xml_file(self): """Test writing a worksheet with conditional formatting.""" self.maxDiff = None fh = StringIO() worksheet = Worksheet() worksheet._set_filehandle...
TestAssembleWorksheet
python
getsentry__sentry
tests/sentry/middleware/test_access_log_middleware.py
{ "start": 11065, "end": 11589 }
class ____(LogCaptureAPITestCase): endpoint = "dummy-endpoint" def test_access_log_success(self) -> None: token = None with assume_test_silo_mode(SiloMode.CONTROL): token = ApiToken.objects.create(user=self.user, scope_list=["event:read", "org:read"]) self.login_as(user=self...
TestAccessLogSuccessNotLoggedInDev
python
getsentry__sentry
src/sentry/utils/cursors.py
{ "start": 199, "end": 355 }
class ____(Protocol): def __call__(self, value: T, for_prev: bool = ...) -> CursorValue: ... OnResultCallable = Callable[[Sequence[T]], Any]
KeyCallable
python
pypa__warehouse
warehouse/utils/db/orm.py
{ "start": 114, "end": 599 }
class ____(Exception): """Raised when there is no active SQLAlchemy session""" def orm_session_from_obj(obj) -> Session: """ Returns the session from the ORM object. Adds guard, but it should never happen. The guard helps with type hinting, as the object_session function returns Optional[Sess...
NoSessionError
python
pytorch__pytorch
test/fx/test_z3_gradual_types.py
{ "start": 1313, "end": 2553 }
class ____(unittest.TestCase): def test_dim(self): class BasicBlock(torch.nn.Module): def forward(self, x: TensorType([1, 2])): y = x.dim() return y symbolic_traced: torch.fx.GraphModule = symbolic_trace(BasicBlock()) transformed = transform_all_c...
TorchDynamoUseCases
python
django__django
tests/aggregation/tests.py
{ "start": 92133, "end": 99768 }
class ____(TestCase): @classmethod def setUpTestData(cls): cls.a1 = Author.objects.create(age=1) cls.a2 = Author.objects.create(age=2) cls.p1 = Publisher.objects.create(num_awards=1) cls.p2 = Publisher.objects.create(num_awards=0) cls.b1 = Book.objects.create( ...
AggregateAnnotationPruningTests
python
google__pytype
pytype/blocks/blocks_test.py
{ "start": 616, "end": 891 }
class ____(unittest.TestCase, test_utils.MakeCodeMixin): """A base class for implementing tests testing blocks.py.""" # These tests check disassembled bytecode, which varies from version to # version, so we fix the test version. python_version = (3, 10)
BaseBlocksTest
python
readthedocs__readthedocs.org
readthedocs/rtd_tests/tests/test_build_notifications.py
{ "start": 692, "end": 12572 }
class ____(TestCase): def setUp(self): self.project = get(Project, slug="test", language="en") self.version = get(Version, project=self.project, slug="1.0") self.build = get(Build, version=self.version, commit="abc1234567890") @mock.patch("readthedocs.builds.managers.log") def test_...
BuildNotificationsTests
python
django__django
tests/basic/tests.py
{ "start": 22308, "end": 26978 }
class ____(TestCase): @classmethod def setUpTestData(cls): # Create an Article. cls.a = Article( id=None, headline="Swallow programs in Python", pub_date=datetime(2005, 7, 28), ) # Save it into the database. You have to call save() explicitly. ...
ModelLookupTest
python
pytorch__pytorch
test/jit/fixtures_srcs/test_upgrader_models_generation.py
{ "start": 179, "end": 766 }
class ____(TestCase): def test_all_modules(self): for a_module in ALL_MODULES: module_name = type(a_module).__name__ self.assertTrue( isinstance(a_module, torch.nn.Module), f"The module {module_name} " f"is not a torch.nn.module instanc...
TestUpgraderModelGeneration
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/dataclass18.py
{ "start": 170, "end": 316 }
class ____: a: Final = 1 v1 = DC1(1) reveal_type(v1.a, expected_text="Literal[1]") v2 = DC1() reveal_type(v2.a, expected_text="Literal[1]")
DC1
python
google__jax
jax/_src/numpy/setops.py
{ "start": 36243, "end": 36412 }
class ____(NamedTuple): """Struct returned by :func:`jax.numpy.unique_all`.""" values: Array indices: Array inverse_indices: Array counts: Array
_UniqueAllResult
python
django__django
tests/template_tests/syntax_tests/i18n/test_get_language_info.py
{ "start": 154, "end": 1927 }
class ____(SimpleTestCase): libraries = { "custom": "template_tests.templatetags.custom", "i18n": "django.templatetags.i18n", } # retrieving language information @setup( { "i18n28_2": "{% load i18n %}" '{% get_language_info for "de" as l %}' "...
I18nGetLanguageInfoTagTests
python
keras-team__keras
keras/src/trainers/data_adapters/grain_dataset_adapter_test.py
{ "start": 293, "end": 606 }
class ____(grain.sources.RandomAccessDataSource): def __init__(self, start, stop): self.start = start self.stop = stop def __getitem__(self, idx): return np.expand_dims(np.array([self.start + idx]), axis=0) def __len__(self): return self.stop - self.start
Range2DSource
python
has2k1__plotnine
plotnine/_mpl/layout_manager/_spaces.py
{ "start": 17205, "end": 21136 }
class ____(_side_spaces): """ Space in the figure for artists above the panel area Ordered from the edge of the figure and going inwards """ plot_margin: float = 0 tag_alignment: float = 0 plot_tag_margin_top: float = 0 plot_tag: float = 0 plot_tag_margin_bottom: float = 0 marg...
top_spaces
python
kamyu104__LeetCode-Solutions
Python/minimum-number-of-operations-to-make-array-continuous.py
{ "start": 33, "end": 749 }
class ____(object): def minOperations(self, nums): """ :type nums: List[int] :rtype: int """ def unique(nums): left = 0 for right in xrange(1, len(nums)): if nums[left] != nums[right]: left += 1 n...
Solution
python
optuna__optuna
tests/storages_tests/rdb_tests/test_models.py
{ "start": 2696, "end": 4839 }
class ____: @staticmethod def test_find_by_study_and_key(session: Session) -> None: study = StudyModel(study_id=1, study_name="test-study") session.add( StudySystemAttributeModel(study_id=study.study_id, key="sample-key", value_json="1") ) session.commit() at...
TestStudySystemAttributeModel
python
xlwings__xlwings
xlwings/_xlmac.py
{ "start": 55502, "end": 57377 }
class ____(Collection, base_classes.Pictures): _attr = "pictures" _kw = kw.picture _wrap = Picture def add( self, filename, link_to_file, save_with_document, left, top, width, height, anchor, ): if anchor: t...
Pictures
python
facebook__pyre-check
source/interprocedural_analyses/taint/test/integration/model_query.py
{ "start": 580, "end": 633 }
class ____: def foo(self, x): return 0
Base
python
scikit-learn__scikit-learn
sklearn/_loss/loss.py
{ "start": 21052, "end": 23005 }
class ____(BaseLoss): """Quantile loss aka pinball loss, for regression. Domain: y_true and y_pred all real numbers quantile in (0, 1) Link: y_pred = raw_prediction For a given sample x_i, the pinball loss is defined as:: loss(x_i) = rho_{quantile}(y_true_i - raw_prediction_i) ...
PinballLoss
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/paramSpec10.py
{ "start": 591, "end": 1174 }
class ____: def __init__(self): self._lock = RLock() @with_lock def test_1(self, param1: int) -> str: ... @with_lock def test_2(self) -> str: ... @with_lock def test_3(cls: MyClass, param1: int) -> str: ... testClass = MyClass() res1 = testClass.test_1(42) reveal_type(res1, expected_t...
MyClass
python
PyCQA__pylint
tests/functional/u/used/used_before_assignment.py
{ "start": 4306, "end": 6035 }
class ____: # pylint: disable=missing-docstring """https://github.com/pylint-dev/pylint/issues/9674""" def skip(self, msg) -> NoReturn: raise Exception(msg) # pylint: disable=broad-exception-raised def print_platform_specific_command(self): if sys.platform == "linux": cmd = "l...
PlatformChecks
python
scikit-learn__scikit-learn
sklearn/compose/tests/test_target.py
{ "start": 11722, "end": 12735 }
class ____(DummyRegressor): def fit(self, X, y, sample_weight=None, check_input=True): # on the test below we force this to false, we make sure this is # actually passed to the regressor assert not check_input return super().fit(X, y, sample_weight) def test_transform_target_regres...
DummyRegressorWithExtraFitParams
python
Lightning-AI__lightning
tests/tests_pytorch/trainer/connectors/test_callback_connector.py
{ "start": 3890, "end": 9686 }
class ____(Callback): def __init__(self, unique=None, other=None): self._unique = unique self._other = other @property def state_key(self): return self._generate_state_key(unique=self._unique) def state_dict(self): return {"content1": self._unique} def test_all_callba...
StatefulCallbackContent1
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/typedDictReadOnly2.py
{ "start": 4165, "end": 4256 }
class ____(TypedDict): x: ReadOnly[NotRequired[int]] y: ReadOnly[Required[int]]
TD_B1
python
pytorch__pytorch
torch/_subclasses/meta_utils.py
{ "start": 21975, "end": 22234 }
class ____(Protocol, Generic[_TensorT_cov]): def __call__( self, arg: Callable[[], torch.Tensor], /, **kwargs: Unpack[_MetaTensorCallbackKwargs], ) -> _TensorT_cov: ... @dataclass(frozen=True)
_MetaTensorCallbackOptDevice
python
django__django
tests/admin_views/models.py
{ "start": 17512, "end": 17610 }
class ____(models.Model): recipient = models.ForeignKey(Manager, on_delete=models.CASCADE)
Bonus
python
walkccc__LeetCode
solutions/409. Longest Palindrome/409.py
{ "start": 0, "end": 267 }
class ____: def longestPalindrome(self, s: str) -> int: ans = 0 count = collections.Counter(s) for c in count.values(): ans += c if c % 2 == 0 else c - 1 hasOddCount = any(c % 2 == 1 for c in count.values()) return ans + hasOddCount
Solution
python
numba__numba
numba/tests/test_looplifting.py
{ "start": 6250, "end": 8383 }
class ____(TestCase): def test_annotate_1(self): """ Verify that annotation works as expected with one lifted loop """ from numba import jit # dummy function to force objmode def bar(): pass def foo(x): bar() # force obj ...
TestLoopLiftingAnnotate
python
PyCQA__pylint
pylint/checkers/spelling.py
{ "start": 2974, "end": 3316 }
class ____(Filter): # type: ignore[misc] """Parent class for filters using regular expressions. This filter skips any words the match the expression assigned to the class attribute ``_pattern``. """ _pattern: Pattern[str] def _skip(self, word: str) -> bool: return bool(self._pattern....
RegExFilter
python
tensorflow__tensorflow
tensorflow/python/ops/ragged/ragged_map_flat_values_op_test.py
{ "start": 1302, "end": 10463 }
class ____(test_util.TensorFlowTestCase): def assertRaggedMapInnerValuesReturns(self, op, expected, args=(), kwargs=None): kwargs = kwargs or {} resu...
RaggedMapInnerValuesOpTest
python
doocs__leetcode
solution/0100-0199/0144.Binary Tree Preorder Traversal/Solution2.py
{ "start": 192, "end": 596 }
class ____: def preorderTraversal(self, root: Optional[TreeNode]) -> List[int]: ans = [] if root is None: return ans stk = [root] while stk: node = stk.pop() ans.append(node.val) if node.right: stk.append(node.right) ...
Solution
python
numpy__numpy
numpy/distutils/command/config.py
{ "start": 1229, "end": 20334 }
class ____(old_config): old_config.user_options += [ ('fcompiler=', None, "specify the Fortran compiler type"), ] def initialize_options(self): self.fcompiler = None old_config.initialize_options(self) def _check_compiler (self): old_config._check_compiler(self) ...
config
python
getsentry__sentry
src/sentry/integrations/messaging/metrics.py
{ "start": 1867, "end": 2745 }
class ____(IntegrationEventLifecycleMetric): """An instance to be recorded of a user interacting through a messaging app.""" interaction_type: MessagingInteractionType spec: MessagingIntegrationSpec # Optional attributes to populate extras user: User | RpcUser | None = None organization: Organ...
MessagingInteractionEvent
python
allegroai__clearml
clearml/backend_api/services/v2_23/frames.py
{ "start": 104983, "end": 108553 }
class ____(NonStrictDataModel): """ :param rule_index: Rule index :type rule_index: int :param name: Rule name :type name: str :param count: Number of frames matching this rule :type count: int :param accurate: True if the provided count is accurate. If False, 'reason' will conta...
RuleCount
python
dask__dask
dask/_task_spec.py
{ "start": 17126, "end": 18757 }
class ____(GraphNode): value: Any typ: type __slots__ = tuple(__annotations__) def __init__(self, key: Any, value: Any): if key is None: key = (type(value).__name__, next(_anom_count)) self.key = key self.value = value self.typ = type(value) self._dep...
DataNode
python
numba__numba
numba/core/ir.py
{ "start": 11348, "end": 19376 }
class ____(Inst): """ An IR expression (an instruction which can only be part of a larger statement). """ def __init__(self, op, loc, **kws): assert isinstance(op, str) assert isinstance(loc, Loc) self.op = op self.loc = loc self._kws = kws def __getattr...
Expr
python
doocs__leetcode
solution/2800-2899/2863.Maximum Length of Semi-Decreasing Subarrays/Solution.py
{ "start": 0, "end": 329 }
class ____: def maxSubarrayLength(self, nums: List[int]) -> int: d = defaultdict(list) for i, x in enumerate(nums): d[x].append(i) ans, k = 0, inf for x in sorted(d, reverse=True): ans = max(ans, d[x][-1] - k + 1) k = min(k, d[x][0]) return...
Solution
python
jazzband__django-redis
django_redis/compressors/zlib.py
{ "start": 124, "end": 538 }
class ____(BaseCompressor): min_length = 15 preset = 6 def compress(self, value: bytes) -> bytes: if len(value) > self.min_length: return zlib.compress(value, self.preset) return value def decompress(self, value: bytes) -> bytes: try: return zlib.decompr...
ZlibCompressor
python
mwaskom__seaborn
seaborn/external/kde.py
{ "start": 2870, "end": 13726 }
class ____: """Representation of a kernel-density estimate using Gaussian kernels. Kernel density estimation is a way to estimate the probability density function (PDF) of a random variable in a non-parametric way. `gaussian_kde` works for both uni-variate and multi-variate data. It includes auto...
gaussian_kde
python
getsentry__sentry
tests/sentry/api/serializers/test_project_template.py
{ "start": 311, "end": 2956 }
class ____(TestCase): def setUp(self) -> None: super().setUp() self.user = self.create_user() self.organization = self.create_organization() self.project_template = self.create_project_template(organization=self.organization) self.option = ProjectTemplateOption.objects.creat...
ProjectTemplateSerializerTest
python
apache__airflow
airflow-core/src/airflow/dag_processing/collection.py
{ "start": 4864, "end": 17165 }
class ____(NamedTuple): latest_runs: dict[str, DagRun] num_active_runs: dict[str, int] @classmethod def calculate(cls, dags: dict[str, LazyDeserializedDAG], *, session: Session) -> Self: """ Query the run counts from the db. :param dags: dict of dags to query """ ...
_RunInfo
python
huggingface__transformers
src/transformers/generation/logits_process.py
{ "start": 81101, "end": 82841 }
class ____(LogitsProcessor): r""" [`LogitsProcessor`] that enforces the specified token as the first generated token. Used with encoder-decoder models. Args: bos_token_id (`int`): The id of the token to force as the first generated token. Examples: ```python >>> from t...
ForcedBOSTokenLogitsProcessor
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_hyperlink01.py
{ "start": 346, "end": 2265 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("hyperlink01.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file with hyperlinks""" workbook = Work...
TestCompareXLSXFiles
python
protocolbuffers__protobuf
python/google/protobuf/internal/proto_test.py
{ "start": 3409, "end": 4152 }
class ____(unittest.TestCase): def test_pytype_allows_unset_self_field(self): self.assertEqual( test_proto2_pb2.MessageWithSelfField(something=123).something, 123 ) def test_pytype_allows_unset_self_and_self_underscore_field(self): self.assertEqual( test_proto2_pb2.MessageWithSelfAndSe...
SelfFieldTest
python
TheAlgorithms__Python
searches/hill_climbing.py
{ "start": 60, "end": 6750 }
class ____: """ An interface to define search problems. The interface will be illustrated using the example of mathematical function. """ def __init__(self, x: int, y: int, step_size: int, function_to_optimize): """ The constructor of the search problem. x: the x coordinate...
SearchProblem
python
keras-team__keras
keras/src/utils/file_utils_test.py
{ "start": 7835, "end": 11934 }
class ____(test_case.TestCase): def setUp(self): """Create temporary directories and files for testing.""" self.temp_dir = tempfile.mkdtemp() self.file_content = "Hello, world!" # Create sample files to be archived with open(os.path.join(self.temp_dir, "sample.txt"), "w") as...
ExtractArchiveTest
python
huggingface__transformers
tests/models/sam/test_modeling_sam.py
{ "start": 5448, "end": 9598 }
class ____(ModelTesterMixin, unittest.TestCase): """ Here we also overwrite some of the tests of test_modeling_common.py, as SAM's vision encoder does not use input_ids, inputs_embeds, attention_mask and seq_length. """ all_model_classes = (SamVisionModel,) if is_torch_available() else () test...
SamVisionModelTest
python
mlflow__mlflow
mlflow/utils/async_logging/async_logging_queue.py
{ "start": 1312, "end": 14279 }
class ____: """ This is a queue based run data processor that queues incoming batches and processes them using single worker thread. """ def __init__( self, logging_func: Callable[[str, list[Metric], list[Param], list[RunTag]], None] ) -> None: """Initializes an AsyncLoggingQueu...
AsyncLoggingQueue
python
pytorch__pytorch
test/distributed/elastic/utils/data/cycling_iterator_test.py
{ "start": 342, "end": 1473 }
class ____(unittest.TestCase): def generator(self, epoch, stride, max_epochs): # generate an continuously incrementing list each epoch # e.g. [0,1,2] [3,4,5] [6,7,8] ... return iter([stride * epoch + i for i in range(stride)]) def test_cycling_iterator(self): stride = 3 ...
CyclingIteratorTest
python
django-extensions__django-extensions
tests/management/commands/test_delete_squashed_migrations.py
{ "start": 1162, "end": 4067 }
class ____(BaseDeleteSquashedMigrationsTestCase): """Tests for delete_squashed_migrations command exceptions.""" def test_should_raise_CommandError_if_app_does_not_have_migrations(self): with self.assertRaisesRegex( CommandError, r"App 'testapp_with_no_models_file' does not have...
DeleteSquashedMigrationsExceptionsTests
python
PyCQA__pycodestyle
testing/data/python313.py
{ "start": 116, "end": 146 }
class ____[T = str]: pass
C2
python
great-expectations__great_expectations
great_expectations/expectations/core/expect_column_values_to_be_decreasing.py
{ "start": 1038, "end": 7435 }
class ____(ColumnMapExpectation): """Expect the column values to be decreasing. By default, this expectation only works for numeric or datetime data. If 'strictly=True', then this expectation is only satisfied if each consecutive value \ is strictly decreasing--equal values are treated as failures. ...
ExpectColumnValuesToBeDecreasing
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/dataclassHash1.py
{ "start": 712, "end": 829 }
class ____: a: int def __eq__(self, other) -> bool: return self.a == other.a v7: Hashable = DC7(0)
DC7