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
gevent__gevent
src/greentest/3.11/test_signal.py
{ "start": 12380, "end": 18253 }
class ____(unittest.TestCase): @unittest.skipIf(_testcapi is None, 'need _testcapi') def check_wakeup(self, test_body, *signals, ordered=True): # use a subprocess to have only one thread code = """if 1: import _testcapi import os import signal import struct ...
WakeupSignalTests
python
getsentry__sentry
tests/sentry/uptime/autodetect/test_notifications.py
{ "start": 657, "end": 9214 }
class ____(TestCase): def setUp(self) -> None: super().setUp() self.organization = self.create_organization() self.project = self.create_project(organization=self.organization) self.user1 = self.create_user("user1@example.com") self.user2 = self.create_user("user2@example.com...
UptimeAutoDetectedNotificationsTest
python
pdm-project__pdm
src/pdm/cli/commands/venv/remove.py
{ "start": 261, "end": 1280 }
class ____(BaseCommand): """Remove the virtualenv with the given name""" arguments = (verbose_option,) def add_arguments(self, parser: argparse.ArgumentParser) -> None: parser.add_argument( "-y", "--yes", action="store_true", help="Answer yes on the ...
RemoveCommand
python
doocs__leetcode
solution/2700-2799/2788.Split Strings by Separator/Solution.py
{ "start": 0, "end": 167 }
class ____: def splitWordsBySeparator(self, words: List[str], separator: str) -> List[str]: return [s for w in words for s in w.split(separator) if s]
Solution
python
keras-team__keras
keras/src/metrics/confusion_metrics.py
{ "start": 330, "end": 2938 }
class ____(Metric): """Calculates the number of the given confusion matrix condition. Args: confusion_matrix_cond: One of `metrics_utils.ConfusionMatrix` conditions. thresholds: (Optional) Defaults to `0.5`. A float value or a python list / tuple of float threshold value...
_ConfusionMatrixConditionCount
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/dialects/postgresql/psycopg2.py
{ "start": 22225, "end": 31864 }
class ____(_PGDialect_common_psycopg): driver = "psycopg2" supports_statement_cache = True supports_server_side_cursors = True default_paramstyle = "pyformat" # set to true based on psycopg2 version supports_sane_multi_rowcount = False execution_ctx_cls = PGExecutionContext_psycopg2 pr...
PGDialect_psycopg2
python
ray-project__ray
python/ray/_private/state.py
{ "start": 667, "end": 43929 }
class ____: """A class used to interface with the Ray control state. Attributes: global_state_accessor: The client used to query gcs table from gcs server. """ def __init__(self): """Create a GlobalState object.""" # Args used for lazy init of this object. s...
GlobalState
python
django__django
tests/delete_regress/tests.py
{ "start": 11926, "end": 14357 }
class ____(TestCase): def test_meta_ordered_delete(self): # When a subquery is performed by deletion code, the subquery must be # cleared of all ordering. There was a but that caused _meta ordering # to be used. Refs #19720. h = House.objects.create(address="Foo") OrderedPers...
DeleteTests
python
readthedocs__readthedocs.org
readthedocs/core/migrations/0007_historicaluser.py
{ "start": 312, "end": 5030 }
class ____(migrations.Migration): safe = Safe.after_deploy() dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ("core", "0006_remove_userprofile_allow_email"), ] operations = [ migrations.CreateModel( name="HistoricalUser", field...
Migration
python
Pylons__pyramid
tests/test_urldispatch.py
{ "start": 1628, "end": 11197 }
class ____(unittest.TestCase): def setUp(self): testing.setUp() def tearDown(self): testing.tearDown() def _getRequest(self, **kw): from pyramid.threadlocal import get_current_registry request = DummyRequest(**kw) reg = get_current_registry() request.regist...
RoutesMapperTests
python
conda__conda
conda/models/enums.py
{ "start": 3477, "end": 4670 }
class ____(Enum): generic = "generic" python = "python" @staticmethod def coerce(val): # what a mess if isinstance(val, NoarchType): return val valtype = getattr(val, "type", None) if isinstance(valtype, NoarchType): # see issue #8311 return valt...
NoarchType
python
bokeh__bokeh
tests/unit/bokeh/plotting/test__stack.py
{ "start": 4766, "end": 9021 }
class ____: def test_raises_when_spec_in_kwargs(self) -> None: with pytest.raises(ValueError) as e: bps.double_stack(['a', 'b'], 'foo', 'bar', foo=10) assert str(e.value).endswith("Stack property 'foo' cannot appear in keyword args") with pytest.raises(ValueError) as e: ...
Test_double_stack
python
huggingface__transformers
src/transformers/models/longcat_flash/modeling_longcat_flash.py
{ "start": 28611, "end": 31854 }
class ____(LongcatFlashPreTrainedModel, GenerationMixin): _tied_weights_keys = {"lm_head.weight": "model.embed_tokens.weight"} _tp_plan = {"lm_head": "colwise_rep"} _pp_plan = {"lm_head": (["hidden_states"], ["logits"])} _keys_to_ignore_on_load_unexpected = [r"model\.mtp.*"] def __init__(self, conf...
LongcatFlashForCausalLM
python
huggingface__transformers
src/transformers/models/convnext/modeling_convnext.py
{ "start": 6756, "end": 8227 }
class ____(nn.Module): """ConvNeXT stage, consisting of an optional downsampling layer + multiple residual blocks. Args: config ([`ConvNextConfig`]): Model configuration class. in_channels (`int`): Number of input channels. out_channels (`int`): Number of output channels. depth ...
ConvNextStage
python
pytorch__pytorch
test/inductor/test_pallas.py
{ "start": 22570, "end": 23669 }
class ____(PallasTestsMixin, TestCase): DEVICE = "cpu" @mock.patch("torch._inductor.codegen.pallas.has_tpu_pallas", return_value=False) def test_tpu_not_available_raises_error(self, mock_has_tpu_pallas): def fn(a, b): return a + b with self.assertRaisesRegex( Runtim...
PallasTestsTPU
python
scipy__scipy
scipy/stats/tests/test_generation/reference_distributions.py
{ "start": 14006, "end": 14095 }
class ____(ReferenceDistribution): def _pdf(self, x): return mp.npdf(x)
Normal
python
eriklindernoren__ML-From-Scratch
mlfromscratch/unsupervised_learning/generative_adversarial_network.py
{ "start": 495, "end": 5842 }
class ____(): """A Generative Adversarial Network with deep fully-connected neural nets as Generator and Discriminator. Training Data: MNIST Handwritten Digits (28x28 images) """ def __init__(self): self.img_rows = 28 self.img_cols = 28 self.img_dim = self.img_rows * self.i...
GAN
python
sympy__sympy
sympy/printing/codeprinter.py
{ "start": 549, "end": 966 }
class ____: """ Decorator for registering requirements on print methods. """ def __init__(self, **kwargs): self._req = kwargs def __call__(self, method): def _method_wrapper(self_, *args, **kwargs): for k, v in self._req.items(): getattr(self_, k).update(v) ...
requires
python
joke2k__faker
tests/providers/test_date_time.py
{ "start": 32622, "end": 33027 }
class ____(unittest.TestCase): """Test az_AZ date_time provider methods""" def setUp(self): self.fake = Faker("az_AZ") Faker.seed(0) def test_day(self): day = self.fake.day_of_week() assert day in AzAzProvider.DAY_NAMES.values() def test_month(self): month = se...
TestAzAz
python
joke2k__faker
tests/providers/test_internet.py
{ "start": 32817, "end": 33282 }
class ____: """Test ro_RO internet provider methods""" def test_free_email_domain(self, faker): domain = faker.free_email_domain() assert domain in RoRoInternetProvider.free_email_domains def test_tld(self, faker): tld = faker.tld() assert tld in PlPlInternetProvider.tlds ...
TestRoRo
python
pytorch__pytorch
torch/onnx/_internal/exporter/_onnx_program.py
{ "start": 6655, "end": 18565 }
class ____: """A class to represent an ONNX program that is callable with torch tensors. Attributes: model: The ONNX model as an ONNX IR model object. exported_program: The exported program that produced the ONNX model. """ def __init__( self, model: ir.Model, exported_program:...
ONNXProgram
python
pytorch__pytorch
torch/_inductor/codegen/triton.py
{ "start": 9340, "end": 10338 }
class ____: index_str: str mask_vars: OrderedSet[str] expand_str: Optional[str] _has_rindex: bool index: sympy.Expr expand_shape: Optional[Sequence[Union[int, str]]] def has_mask(self) -> bool: return bool(self.mask_vars) def has_indirect(self) -> bool: return free_symb...
IndexingOptions
python
huggingface__transformers
src/transformers/models/dinov2_with_registers/modeling_dinov2_with_registers.py
{ "start": 12087, "end": 12561 }
class ____(nn.Module): def __init__(self, config: Dinov2WithRegistersConfig): super().__init__() self.attention = Dinov2WithRegistersSelfAttention(config) self.output = Dinov2WithRegistersSelfOutput(config) def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: self_att...
Dinov2WithRegistersAttention
python
dask__distributed
distributed/client.py
{ "start": 26825, "end": 197629 }
class ____(SyncMethodMixin): """Connect to and submit computation to a Dask cluster The Client connects users to a Dask cluster. It provides an asynchronous user interface around functions and futures. This class resembles executors in ``concurrent.futures`` but also allows ``Future`` objects wit...
Client
python
PyCQA__pylint
tests/functional/n/non_ascii_name_class/non_ascii_name_class_method.py
{ "start": 38, "end": 333 }
class ____: """We need a class docstring?""" def public(self): """Say something""" print(self) @classmethod def umlaut_ä(cls): # [non-ascii-name] """do something""" return "ä" # Usage should not raise a second error OkayClass.umlaut_ä()
OkayClass
python
dagster-io__dagster
python_modules/dagster/dagster/_core/definitions/decorators/decorator_assets_definition_builder.py
{ "start": 10976, "end": 30621 }
class ____: def __init__( self, *, named_ins_by_asset_key: Mapping[AssetKey, NamedIn], named_outs_by_asset_key: Mapping[AssetKey, NamedOut], internal_deps: Mapping[AssetKey, set[AssetKey]], op_name: str, args: DecoratorAssetsDefinitionBuilderArgs, fn: ...
DecoratorAssetsDefinitionBuilder
python
streamlit__streamlit
lib/streamlit/elements/write.py
{ "start": 1505, "end": 1550 }
class ____(list[Any]): pass
StreamingOutput
python
dagster-io__dagster
python_modules/libraries/dagster-managed-elements/dagster_managed_elements_tests/example_reconciler.py
{ "start": 157, "end": 568 }
class ____(ManagedElementReconciler): def __init__(self, diff: ManagedElementDiff, apply_diff: Optional[ManagedElementDiff] = None): self._diff = diff self._apply_diff = apply_diff or diff def check(self, **kwargs) -> ManagedElementCheckResult: return self._diff def apply(self, **k...
MyManagedElementReconciler
python
keon__algorithms
tests/test_set.py
{ "start": 72, "end": 324 }
class ____(unittest.TestCase): def test_find_keyboard_row(self): self.assertEqual(["Alaska", "Dad"], find_keyboard_row(["Hello", "Alaska", "Dad", "Peace"]))
TestFindKeyboardRow
python
great-expectations__great_expectations
tests/core/test_expectation_validation_result.py
{ "start": 20268, "end": 23043 }
class ____: @pytest.mark.unit def test_hash_consistency_with_equality(self): config1 = ExpectationConfiguration( type="expect_column_values_to_not_be_null", kwargs={"column": "test_column"} ) config2 = ExpectationConfiguration( type="expect_column_values_to_not_be...
TestExpectationValidationResultHash
python
pallets__jinja
src/jinja2/nodes.py
{ "start": 23380, "end": 23895 }
class ____(_FilterTestCommon): """Apply a filter to an expression. ``name`` is the name of the filter, the other fields are the same as :class:`Call`. If ``node`` is ``None``, the filter is being used in a filter block and is applied to the content of the block. """ node: Expr | None # type: ...
Filter
python
ray-project__ray
rllib/examples/_old_api_stack/models/mobilenet_v2_encoder.py
{ "start": 1094, "end": 1659 }
class ____(TorchModel, Encoder): """A MobileNet v2 encoder for RLlib.""" def __init__(self, config): super().__init__(config) self.net = torch.hub.load( "pytorch/vision:v0.6.0", "mobilenet_v2", pretrained=True ) if config.freeze: # We don't want to train ...
MobileNetV2Encoder
python
huggingface__transformers
tests/models/seed_oss/test_modeling_seed_oss.py
{ "start": 1274, "end": 1483 }
class ____(CausalLMModelTest, unittest.TestCase): model_tester_class = SeedOssModelTester _is_stateful = True model_split_percents = [0.5, 0.6] @slow @require_torch_large_accelerator
SeedOssModelTest
python
PyCQA__pylint
tests/functional/a/assigning/assigning_non_slot.py
{ "start": 370, "end": 518 }
class ____: """ missing not in slots. """ __slots__ = ['member'] def __init__(self): self.missing = 42 # [assigning-non-slot]
Bad
python
crytic__slither
slither/detectors/functions/external_function.py
{ "start": 703, "end": 12476 }
class ____(AbstractDetector): """ Detect public function that could be declared as external IMPROVEMENT: Add InternalDynamicCall check https://github.com/trailofbits/slither/pull/53#issuecomment-432809950 """ ARGUMENT = "external-function" HELP = "Public function that could be declared ext...
ExternalFunction
python
pytorch__pytorch
torch/_dynamo/utils.py
{ "start": 140676, "end": 144825 }
class ____(Generic[_P, R]): """Implements dunder methods for tnp.ndarray via functions from the operator library""" def __init__(self, op: Callable[..., Any]) -> None: self.op = op self.__name__ = f"wrapped_{op.__name__}" def __repr__(self) -> str: return f"<Wrapped operator <origi...
numpy_operator_wrapper
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 202444, "end": 202951 }
class ____(sgqlc.types.Type): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("client_mutation_id", "pull_request_review", "review_edge") client_mutation_id = sgqlc.types.Field(String, graphql_name="clientMutationId") pull_request_review = sgqlc.types.F...
AddPullRequestReviewPayload
python
pytorch__pytorch
test/package/common.py
{ "start": 172, "end": 1288 }
class ____(TestCase): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self._temporary_files = [] def temp(self): t = NamedTemporaryFile() name = t.name if IS_WINDOWS: t.close() # can't read an open file in windows else: ...
PackageTestCase
python
sympy__sympy
sympy/printing/numpy.py
{ "start": 14025, "end": 19166 }
class ____(NumPyPrinter): _kf = {**NumPyPrinter._kf, **_scipy_known_functions} _kc = {**NumPyPrinter._kc, **_scipy_known_constants} def __init__(self, settings=None): super().__init__(settings=settings) self.language = "Python with SciPy and NumPy" def _print_SparseRepMatrix(self, exp...
SciPyPrinter
python
numba__numba
numba/np/ufunc/ufuncbuilder.py
{ "start": 11282, "end": 14610 }
class ____(_BaseUFuncBuilder): # TODO handle scalar def __init__(self, py_func, signature, identity=None, cache=False, targetoptions=None, writable_args=()): if targetoptions is None: targetoptions = {} self.py_func = py_func self.identity = parse_identity(i...
GUFuncBuilder
python
pypa__setuptools
setuptools/_vendor/jaraco/collections/__init__.py
{ "start": 15539, "end": 15872 }
class ____(dict): """ A dictionary that by default maps each key to itself, but otherwise acts like a normal dictionary. >>> d = IdentityOverrideMap() >>> d[42] 42 >>> d['speed'] = 'speedo' >>> print(d['speed']) speedo """ def __missing__(self, key): return key
IdentityOverrideMap
python
MongoEngine__mongoengine
mongoengine/fields.py
{ "start": 11869, "end": 13289 }
class ____(BaseField): """Floating point number field.""" def __init__(self, min_value=None, max_value=None, **kwargs): """ :param min_value: (optional) A min value that will be applied during validation :param max_value: (optional) A max value that will be applied during validation ...
FloatField
python
wandb__wandb
wandb/_pydantic/pagination.py
{ "start": 427, "end": 559 }
class ____(GQLResult): typename__: Literal["PageInfo"] = "PageInfo" end_cursor: Optional[str] has_next_page: bool
PageInfo
python
dagster-io__dagster
python_modules/dagster/dagster/_core/storage/compute_log_manager.py
{ "start": 3891, "end": 5555 }
class ____: def __init__( self, manager: "ComputeLogManager[T_DagsterInstance]", log_key: Sequence[str], cursor: Optional[str], ): self._manager = manager self._log_key = log_key self._cursor = cursor self._observer: Optional[Callable[[CapturedLogD...
CapturedLogSubscription
python
pyqtgraph__pyqtgraph
pyqtgraph/GraphicsScene/mouseEvents.py
{ "start": 5629, "end": 8718 }
class ____(object): """ Instances of this class are delivered to items in a :class:`GraphicsScene <pyqtgraph.GraphicsScene>` via their mouseClickEvent() method when the item is clicked. """ def __init__(self, pressEvent, double=False): self.accepted = False self.currentIt...
MouseClickEvent
python
spyder-ide__spyder
external-deps/qtconsole/qtconsole/frontend_widget.py
{ "start": 3368, "end": 34821 }
class ____(HistoryConsoleWidget, BaseFrontendMixin): """ A Qt frontend for a generic Python kernel. """ # The text to show when the kernel is (re)started. banner = Unicode(config=True) kernel_banner = Unicode() # Whether to show the banner _display_banner = Bool(False) # An option and ...
FrontendWidget
python
conda__conda
conda/activate.py
{ "start": 38865, "end": 39581 }
class ____(_Activator): pathsep_join = '" "'.join sep = "/" path_conversion = staticmethod(win_path_to_unix if on_win else _path_identity) script_extension = ".fish" tempfile_extension = None # output to stdout command_join = ";\n" needs_line_ending_fix = True unset_var_tmpl = "set -e ...
FishActivator
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 508848, "end": 511172 }
class ____(sgqlc.types.Interface): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ( "id", "project", "projects", "projects_resource_path", "projects_url", "viewer_can_create_projects", ) id = sgqlc.types.F...
ProjectOwner
python
google__jax
tests/array_interoperability_test.py
{ "start": 10079, "end": 15487 }
class ____(jtu.JaxTestCase): @jtu.skip_on_devices("cuda") def testCudaArrayInterfaceOnNonCudaFails(self): x = jnp.arange(5) self.assertFalse(hasattr(x, "__cuda_array_interface__")) with self.assertRaisesRegex( AttributeError, "__cuda_array_interface__ is only defined for NVidia GPU buff...
CudaArrayInterfaceTest
python
Textualize__textual
src/textual/color.py
{ "start": 1600, "end": 2140 }
class ____(NamedTuple): """A color in HSL (Hue, Saturation, Lightness) format.""" h: float """Hue in range 0 to 1.""" s: float """Saturation in range 0 to 1.""" l: float """Lightness in range 0 to 1.""" @property def css(self) -> str: """HSL in css format.""" h, s, ...
HSL
python
PrefectHQ__prefect
src/prefect/client/schemas/filters.py
{ "start": 12079, "end": 12301 }
class ____(PrefectBaseModel): """Filter by `TaskRun.state_type`.""" any_: Optional[List[StateType]] = Field( default=None, description="A list of task run state types to include" )
TaskRunFilterStateType
python
huggingface__transformers
src/transformers/models/t5gemma/modeling_t5gemma.py
{ "start": 20316, "end": 23699 }
class ____(GradientCheckpointingLayer): """Decoder sub-layer: an extra cross-attention layer.""" def __init__(self, config, layer_idx: int): super().__init__() self.hidden_size = config.hidden_size self.config = config self.layer_idx = layer_idx self.attention_type = con...
T5GemmaDecoderLayer
python
ray-project__ray
rllib/examples/envs/classes/multi_agent/footsies/footsies_env.py
{ "start": 713, "end": 10329 }
class ____(MultiAgentEnv): metadata = {"render.modes": ["human"]} SPECIAL_CHARGE_FRAMES = 60 GUARD_BREAK_REWARD = 0.3 observation_space = spaces.Dict( { agent: spaces.Box( low=-np.inf, high=np.inf, shape=(constants.OBSERVATION_SPACE_SI...
FootsiesEnv
python
scrapy__scrapy
tests/test_command_fetch.py
{ "start": 177, "end": 1161 }
class ____: def test_output(self, mockserver: MockServer) -> None: _, out, _ = proc("fetch", mockserver.url("/text")) assert out.strip() == "Works" def test_redirect_default(self, mockserver: MockServer) -> None: _, out, _ = proc("fetch", mockserver.url("/redirect")) assert out....
TestFetchCommand
python
sympy__sympy
sympy/core/multidimensional.py
{ "start": 1508, "end": 4233 }
class ____: """ Generalizes a function taking scalars to accept multidimensional arguments. Examples ======== >>> from sympy import vectorize, diff, sin, symbols, Function >>> x, y, z = symbols('x y z') >>> f, g, h = list(map(Function, 'fgh')) >>> @vectorize(0) ... def vsin(x): ...
vectorize
python
RaRe-Technologies__gensim
gensim/test/test_corpora.py
{ "start": 18253, "end": 20025 }
class ____(TestLowCorpus): TEST_CORPUS = [[(1, 1)], [], [(0, 2), (2, 1)], []] CORPUS_LINE = '#3 lang mom wash window window was washed' def setUp(self): self.corpus_class = malletcorpus.MalletCorpus self.file_extension = '.mallet' def test_load_with_metadata(self): fname = d...
TestMalletCorpus
python
PrefectHQ__prefect
tests/server/orchestration/api/test_task_runs.py
{ "start": 25046, "end": 27140 }
class ____: async def test_delete_task_runs(self, task_run, hosted_api_client, session): # delete the task run response = await hosted_api_client.delete(f"/task_runs/{task_run.id}") assert response.status_code == status.HTTP_204_NO_CONTENT # make sure it's deleted task_run_i...
TestDeleteTaskRuns
python
encode__django-rest-framework
tests/test_generics.py
{ "start": 889, "end": 1013 }
class ____(serializers.ModelSerializer): class Meta: model = BasicModel fields = '__all__'
BasicSerializer
python
dagster-io__dagster
examples/docs_snippets/docs_snippets/concepts/declarative_automation/sensors/custom_condition.py
{ "start": 91, "end": 610 }
class ____(dg.AutomationCondition): def evaluate(self, context: dg.AutomationContext) -> dg.AutomationResult: if is_company_holiday(context.evaluation_time): true_subset = context.candidate_subset else: true_subset = context.get_empty_subset() return dg.AutomationResu...
IsCompanyHoliday
python
django__django
tests/queries/models.py
{ "start": 4571, "end": 4744 }
class ____(models.Model): z = models.ForeignKey("self", models.CASCADE) class Meta: ordering = ["z"] # A model and custom default manager combination.
LoopZ
python
pypa__warehouse
tests/common/db/accounts.py
{ "start": 2858, "end": 3276 }
class ____(WarehouseFactory): class Meta: model = Email user = factory.SubFactory(UserFactory) # TODO: Replace when factory_boy supports `unique`. # See https://github.com/FactoryBoy/factory_boy/pull/997 email = factory.Sequence(lambda _: fake.unique.safe_email()) verified = True ...
EmailFactory
python
etianen__django-reversion
tests/test_app/tests/test_models.py
{ "start": 10927, "end": 11298 }
class ____(TestBase): def testFieldDictFieldExclude(self): reversion.register(TestModel, exclude=("name",)) with reversion.create_revision(): obj = TestModel.objects.create() self.assertEqual(Version.objects.get_for_object(obj).get().field_dict, { "id": obj.pk, ...
FieldDictExcludeTest
python
walkccc__LeetCode
solutions/1152. Analyze User Website Visit Pattern/1152.py
{ "start": 0, "end": 675 }
class ____: def mostVisitedPattern( self, username: list[str], timestamp: list[int], website: list[str], ) -> list[str]: userToSites = collections.defaultdict(list) # Sort websites of each user by timestamp. for user, _, site in sorted( zip(username, timestamp, websi...
Solution
python
PyCQA__pyflakes
pyflakes/test/test_other.py
{ "start": 43753, "end": 48916 }
class ____(TestCase): def test_f_string_without_placeholders(self): self.flakes("f'foo'", m.FStringMissingPlaceholders) self.flakes(''' f"""foo bar """ ''', m.FStringMissingPlaceholders) self.flakes(''' print( f'foo' ...
TestStringFormatting
python
apache__airflow
dev/breeze/src/airflow_breeze/prepare_providers/provider_documentation.py
{ "start": 5502, "end": 5633 }
class ____(Exception): """Raised when error occurred when preparing packages changes."""
PrepareReleaseDocsErrorOccurredException
python
pydata__xarray
xarray/namedarray/utils.py
{ "start": 9796, "end": 10485 }
class ____: """Object that prints as the given value, for use with sentinel values.""" __slots__ = ("_value",) _value: str def __init__(self, value: str): self._value = value def __repr__(self) -> str: return self._value def __eq__(self, other: ReprObject | Any) -> bool: ...
ReprObject
python
openai__openai-python
src/openai/types/shared_params/function_definition.py
{ "start": 290, "end": 1510 }
class ____(TypedDict, total=False): name: Required[str] """The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. """ description: str """ A description of what the function does, used by the model to choose when an...
FunctionDefinition
python
getsentry__sentry
src/sentry/lang/dart/apps.py
{ "start": 36, "end": 240 }
class ____(AppConfig): name = "sentry.lang.dart" def ready(self) -> None: from sentry.plugins.base import register from .plugin import DartPlugin register(DartPlugin)
Config
python
pytorch__pytorch
test/dynamo/test_guard_manager.py
{ "start": 33839, "end": 34175 }
class ____(torch._dynamo.test_case.TestCase): def setUp(self): self._prev = torch._dynamo.config.use_recursive_dict_tags_for_guards torch._dynamo.config.use_recursive_dict_tags_for_guards = True def tearDown(self): torch._dynamo.config.use_recursive_dict_tags_for_guards = self._prev
RecursiveDictTagTests
python
numba__numba
numba/tests/test_function_type.py
{ "start": 34568, "end": 35378 }
class ____(MemoryLeakMixin, TestCase): def test_base(self): # The test is adapted from https://github.com/numba/numba/issues/9071 nb_array = typeof(np.ones(2)) callee_int_type = types.FunctionType(int64(int64)) sig_int = int64(callee_int_type, int64) callee_array_type = type...
TestMultiFunctionType
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 554310, "end": 554651 }
class ____(sgqlc.types.Type): """Autogenerated return type of DeleteEnvironment""" __schema__ = github_schema __field_names__ = ("client_mutation_id",) client_mutation_id = sgqlc.types.Field(String, graphql_name="clientMutationId") """A unique identifier for the client performing the mutation.""" ...
DeleteEnvironmentPayload
python
pytorch__pytorch
torch/_inductor/cpu_vec_isa.py
{ "start": 6024, "end": 6664 }
class ____(VecISA): # this function can be repurposed for SVE with variable vec length _bit_width = 256 _macro = [ "CPU_CAPABILITY_SVE", "CPU_CAPABILITY_SVE256", "AT_BUILD_ARM_VEC256_WITH_SLEEF", "__ARM_FEATURE_BF16", ] _arch_flags = "-march=armv8-a+sve+bf16 -msve-vec...
VecSVE256
python
plotly__plotly.py
plotly/graph_objs/treemap/pathbar/_textfont.py
{ "start": 233, "end": 17161 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "treemap.pathbar" _path_str = "treemap.pathbar.textfont" _valid_props = { "color", "colorsrc", "family", "familysrc", "lineposition", "linepositionsrc", "shadow", "shadowsrc", "siz...
Textfont
python
apache__airflow
airflow-core/src/airflow/metrics/base_stats_logger.py
{ "start": 2175, "end": 3098 }
class ____: """If no StatsLogger is configured, NoStatsLogger is used as a fallback.""" @classmethod def incr(cls, stat: str, count: int = 1, rate: int = 1, *, tags: dict[str, str] | None = None) -> None: """Increment stat.""" @classmethod def decr(cls, stat: str, count: int = 1, rate: int...
NoStatsLogger
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/index1.py
{ "start": 1741, "end": 1898 }
class ____: __slots__ = ["x"] def func3(g: ClassG): reveal_type(g.x, expected_text="Unbound") reveal_type(g.x[0], expected_text="Unknown")
ClassG
python
RaRe-Technologies__gensim
gensim/test/test_similarities.py
{ "start": 32704, "end": 34883 }
class ____(unittest.TestCase): def setUp(self): try: import nmslib # noqa:F401 except ImportError as e: raise unittest.SkipTest("NMSLIB library is not available: %s" % e) from gensim.similarities.nmslib import NmslibIndexer self.model = doc2vec.Doc2Vec(SEN...
TestDoc2VecNmslibIndexer
python
RaRe-Technologies__gensim
gensim/test/test_hdpmodel.py
{ "start": 618, "end": 1703 }
class ____(unittest.TestCase, basetmtests.TestBaseTopicModel): def setUp(self): self.corpus = mmcorpus.MmCorpus(datapath('testcorpus.mm')) self.class_ = hdpmodel.HdpModel self.model = self.class_(corpus, id2word=dictionary, random_state=np.random.seed(0)) def test_topic_values(self): ...
TestHdpModel
python
ansible__ansible
test/integration/targets/ignore_unreachable/fake_connectors/bad_put_file.py
{ "start": 210, "end": 435 }
class ____(ansible_local.Connection): def put_file(self, in_path, out_path): display.debug('Intercepted call to send data') raise AnsibleConnectionFailure('BADLOCAL Error: this is supposed to fail')
Connection
python
apache__airflow
providers/fab/src/airflow/providers/fab/auth_manager/schemas/role_and_permission_schema.py
{ "start": 1907, "end": 2144 }
class ____(SQLAlchemySchema): """Role item schema.""" class Meta: """Meta.""" model = Role name = auto_field() permissions = fields.List(fields.Nested(ActionResourceSchema), data_key="actions")
RoleSchema
python
pypa__pipenv
pipenv/vendor/tomlkit/source.py
{ "start": 1779, "end": 4877 }
class ____(str): EOF = TOMLChar("\0") def __init__(self, _: str) -> None: super().__init__() # Collection of TOMLChars self._chars = iter([(i, TOMLChar(c)) for i, c in enumerate(self)]) self._idx = 0 self._marker = 0 self._current = TOMLChar("") self._...
Source
python
allegroai__clearml
clearml/backend_api/services/v2_23/auth.py
{ "start": 5623, "end": 7022 }
class ____(Request): """ Creates a new set of credentials for the authenticated user. New key/secret is returned. Note: Secret will never be returned in any other API call. If a secret is lost or compromised, the key should be r...
CreateCredentialsRequest
python
tensorflow__tensorflow
tensorflow/python/ops/gradients_test.py
{ "start": 63708, "end": 66079 }
class ____(test_util.TensorFlowTestCase): @test_util.run_v1_only("b/120545219") def test_gradients_v1(self): x = variable_scope.get_variable( name="x", shape=(), initializer=init_ops.constant_initializer(1.0), use_resource=True) z = variable_scope.get_variable( name="z", shape=(), i...
GradPassThroughTest
python
airbytehq__airbyte
airbyte-integrations/connectors/source-salesforce/source_salesforce/streams.py
{ "start": 42375, "end": 43150 }
class ____(BulkSalesforceStream, IncrementalRestSalesforceStream): state_checkpoint_interval = None def request_params( self, stream_state: Mapping[str, Any], stream_slice: Mapping[str, Any] = None, next_page_token: Mapping[str, Any] = None ) -> MutableMapping[str, Any]: start_date = stream...
BulkIncrementalSalesforceStream
python
mlflow__mlflow
mlflow/genai/evaluation/entities.py
{ "start": 5048, "end": 6221 }
class ____: """Holds the result of the evaluation for an eval item.""" eval_item: EvalItem """A collection of assessments from scorers.""" assessments: list[Feedback] = field(default_factory=list) """Error message encountered in processing the eval item.""" eval_error: str | None = None de...
EvalResult
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/ruff/RUF012.py
{ "start": 1295, "end": 1516 }
class ____(BaseSettings): mutable_default: list[int] = [] immutable_annotation: Sequence[int] = [] without_annotation = [] class_variable: ClassVar[list[int]] = [] final_variable: Final[list[int]] = []
F
python
ansible__ansible
lib/ansible/modules/group.py
{ "start": 14107, "end": 16460 }
class ____(Group): """ This is a Mac macOS Darwin Group manipulation class. This overrides the following methods from the generic class:- - group_del() - group_add() - group_mod() group manipulation are done using dseditgroup(1). """ platform = 'Darwin' distribution = No...
DarwinGroup
python
ray-project__ray
python/ray/train/v2/_internal/exceptions.py
{ "start": 3773, "end": 3935 }
class ____(RayTrainError): """Exception raised when an internal Ray Train collective operation of the worker group times out. """
CollectiveTimeoutError
python
kamyu104__LeetCode-Solutions
Python/meeting-scheduler.py
{ "start": 55, "end": 713 }
class ____(object): def minAvailableDuration(self, slots1, slots2, duration): """ :type slots1: List[List[int]] :type slots2: List[List[int]] :type duration: int :rtype: List[int] """ min_heap = list(filter(lambda slot: slot[1] - slot[0] >= duration, slots1 + ...
Solution
python
facebook__pyre-check
client/command_arguments.py
{ "start": 1873, "end": 3637 }
class ____: local_configuration: Optional[str] = None version: VersionKind = VersionKind.NONE debug: bool = False sequential: bool = False strict: bool = False show_error_traces: bool = False output: str = TEXT enable_profiling: bool = False enable_memory_profiling: bool = False ...
CommandArguments
python
walkccc__LeetCode
solutions/253. Meeting Rooms II/253-2.py
{ "start": 0, "end": 388 }
class ____: def minMeetingRooms(self, intervals: list[list[int]]) -> int: n = len(intervals) ans = 0 starts = [] ends = [] for start, end in intervals: starts.append(start) ends.append(end) starts.sort() ends.sort() j = 0 for i in range(n): if starts[i] < ends[...
Solution
python
altair-viz__altair
altair/vegalite/v6/schema/core.py
{ "start": 902153, "end": 921373 }
class ____(PositionDef): r""" PositionFieldDef schema wrapper. Parameters ---------- shorthand : str, dict, Sequence[str], :class:`RepeatRef` shorthand for field, aggregate, and type aggregate : dict, :class:`Aggregate`, :class:`ArgmaxDef`, :class:`ArgminDef`, :class:`NonArgAggregateOp`...
PositionFieldDef
python
readthedocs__readthedocs.org
readthedocs/projects/migrations/0092_add_new_fields.py
{ "start": 149, "end": 871 }
class ____(migrations.Migration): safe = Safe.after_deploy() dependencies = [ ("projects", "0091_upate_meta_options"), ] operations = [ migrations.AddField( model_name="domain", name="skip_validation", field=models.BooleanField( defaul...
Migration
python
wandb__wandb
wandb/apis/internal.py
{ "start": 125, "end": 7611 }
class ____: """Internal proxy to the official internal API.""" # TODO: Move these methods to PublicApi. def __init__(self, *args: Any, **kwargs: Any) -> None: self._api_args = args self._api_kwargs = kwargs self._api = None def __getstate__(self): """Use for serializin...
Api
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/dialects/postgresql/asyncpg.py
{ "start": 10035, "end": 10105 }
class ____(sqltypes.Boolean): render_bind_cast = True
AsyncpgBoolean
python
matplotlib__matplotlib
lib/matplotlib/tri/_triinterpolate.py
{ "start": 9204, "end": 11481 }
class ____(TriInterpolator): """ Linear interpolator on a triangular grid. Each triangle is represented by a plane so that an interpolated value at point (x, y) lies on the plane of the triangle containing (x, y). Interpolated values are therefore continuous across the triangulation, but their ...
LinearTriInterpolator
python
mlflow__mlflow
tests/pyfunc/sample_code/python_model.py
{ "start": 76, "end": 224 }
class ____(PythonModel): def predict(self, context, model_input): return f"This was the input: {model_input}" set_model(MyModel())
MyModel
python
spack__spack
lib/spack/spack/cray_manifest.py
{ "start": 10189, "end": 10375 }
class ____(spack.error.SpackError): """Raised if a compiler, listed in the Cray manifest, cannot be detected correctly based on the paths provided. """
CrayCompilerDetectionError
python
networkx__networkx
networkx/generators/tests/test_line.py
{ "start": 115, "end": 2999 }
class ____: def test_star(self): G = nx.star_graph(5) L = nx.line_graph(G) assert nx.is_isomorphic(L, nx.complete_graph(5)) def test_path(self): G = nx.path_graph(5) L = nx.line_graph(G) assert nx.is_isomorphic(L, nx.path_graph(4)) def test_cycle(self): ...
TestGeneratorLine
python
ZoranPandovski__al-go-rithms
data_structures/Linked_list/Python/double_linked_list_test.py
{ "start": 47, "end": 498 }
class ____(unittest.TestCase): def testNoRepeated(self): l=List() l.insert(None, Node(4)) l.insert(l.head,Node(6)) l.insert(l.head,Node(8)) self.assertEqual(l.removeRepeated().toNativeList(), [4,8,6]) def testRepeated(self): l=List() l.insert(None, Node(4)) l.insert(l.head,Node(6)) l.insert(l.h...
TestMyMethods
python
getsentry__sentry
tests/sentry/integrations/slack/test_link_team.py
{ "start": 1006, "end": 4283 }
class ____(TestCase): url: str def setUp(self) -> None: super().setUp() self.login_as(self.user) self.external_id = "new-slack-id" self.channel_name = "my-channel" self.channel_id = "my-channel_id" self.response_url = "http://example.slack.com/response_url" ...
SlackIntegrationLinkTeamTestBase