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
kamyu104__LeetCode-Solutions
Python/maximum-difference-by-remapping-a-digit.py
{ "start": 41, "end": 604 }
class ____(object): def minMaxDifference(self, num): """ :type num: int :rtype: int """ def f(dst): result = 0 base = 1 while base <= num: base *= 10 base //= 10 src = -1 while base: ...
Solution
python
lazyprogrammer__machine_learning_examples
rl/epsilon_greedy_starter.py
{ "start": 505, "end": 2214 }
class ____: def __init__(self, p): # p: the win rate self.p = p self.p_estimate = # TODO self.N = # TODO def pull(self): # draw a 1 with probability p return np.random.random() < self.p def update(self, x): self.N = # TODO self.p_estimate = # TODO def experiment(): bandits = ...
Bandit
python
huggingface__transformers
src/transformers/models/ibert/quant_modules.py
{ "start": 27043, "end": 30074 }
class ____(Function): """ Function to perform fixed-point arithmetic that can match integer arithmetic on hardware. Args: pre_act (`torch.Tensor`): Input tensor. pre_act_scaling_factor (`torch.Tensor`): Scaling factor of the input tensor *pre_act*. bit_num (`...
FixedPointMul
python
sqlalchemy__sqlalchemy
test/engine/test_processors.py
{ "start": 3994, "end": 4263 }
class ____(_DateProcessorTest): __requires__ = ("cextensions",) @classmethod def setup_test_class(cls): from sqlalchemy.engine import _processors_cy assert _processors_cy._is_compiled() cls.module = _processors_cy
CyDateProcessorTest
python
pydata__xarray
xarray/tests/test_plot.py
{ "start": 3977, "end": 4943 }
class ____: @pytest.fixture(autouse=True) def setup(self) -> Generator: yield # Remove all matplotlib figures plt.close("all") def pass_in_axis(self, plotmethod, subplot_kw=None) -> None: _fig, axs = plt.subplots(ncols=2, subplot_kw=subplot_kw, squeeze=False) ax = ax...
PlotTestCase
python
sympy__sympy
sympy/tensor/array/mutable_ndim_array.py
{ "start": 54, "end": 277 }
class ____(NDimArray): def as_immutable(self): raise NotImplementedError("abstract method") def as_mutable(self): return self def _sympy_(self): return self.as_immutable()
MutableNDimArray
python
mlflow__mlflow
tests/pyfunc/test_spark.py
{ "start": 4919, "end": 58676 }
class ____(NamedTuple): model: Any inference_data: Any @pytest.fixture(scope="module") def sklearn_model(): iris = datasets.load_iris() X = iris.data[:, :2] # we only take the first two features. y = iris.target knn_model = KNeighborsClassifier() knn_model.fit(X, y) return ModelWithDa...
ModelWithData
python
pytorch__pytorch
torch/nn/modules/activation.py
{ "start": 27439, "end": 29560 }
class ____(Module): r"""Applies the soft shrinkage function element-wise. .. math:: \text{SoftShrinkage}(x) = \begin{cases} x - \lambda, & \text{ if } x > \lambda \\ x + \lambda, & \text{ if } x < -\lambda \\ 0, & \text{ otherwise } \end{cases} Args: ...
Softshrink
python
django__django
tests/migrations/test_migrations_squashed_complex/6_auto.py
{ "start": 35, "end": 188 }
class ____(migrations.Migration): dependencies = [("migrations", "5_auto")] operations = [migrations.RunPython(migrations.RunPython.noop)]
Migration
python
pennersr__django-allauth
allauth/idp/oidc/forms.py
{ "start": 1827, "end": 2627 }
class ____(forms.Form): code = forms.CharField( label=_("Code"), required=True, widget=forms.TextInput( attrs={"placeholder": _("Code"), "autocomplete": "one-time-code"}, ), ) def __init__(self, *args, **kwargs): self.code = kwargs.pop("code", None) ...
ConfirmCodeForm
python
ipython__ipython
IPython/extensions/autoreload.py
{ "start": 14488, "end": 14764 }
class ____: def __init__(self, obj): self.obj = obj def __call__(self): return self.obj mod_attrs = [ "__name__", "__doc__", "__package__", "__loader__", "__spec__", "__file__", "__cached__", "__builtins__", ]
StrongRef
python
getsentry__sentry-python
sentry_sdk/consts.py
{ "start": 511, "end": 839 }
class ____(Enum): """ The type of an endpoint. This is an enum, rather than a constant, for historical reasons (the old /store endpoint). The enum also preserve future compatibility, in case we ever have a new endpoint. """ ENVELOPE = "envelope" OTLP_TRACES = "integration/otlp/v1/traces"
EndpointType
python
psf__black
src/black/cache.py
{ "start": 523, "end": 1409 }
class ____(NamedTuple): st_mtime: float st_size: int hash: str def get_cache_dir() -> Path: """Get the cache directory used by black. Users can customize this directory on all systems using `BLACK_CACHE_DIR` environment variable. By default, the cache directory is the user cache directory ...
FileData
python
airbytehq__airbyte
airbyte-integrations/connectors/source-bing-ads/unit_tests/integrations/test_report_stream.py
{ "start": 1048, "end": 17282 }
class ____(TestReportStream): stream_name: Optional[str] = None report_file: str report_file_with_records_further_start_date: Optional[str] = None records_number: int second_read_records_number: Optional[int] = None state_file: str state_file_after_migration: Optional[str] = None state_f...
TestSuiteReportStream
python
apache__airflow
providers/teradata/src/airflow/providers/teradata/triggers/teradata_compute_cluster.py
{ "start": 1218, "end": 6944 }
class ____(BaseTrigger): """ Fetch the status of the suspend or resume operation for the specified compute cluster. :param teradata_conn_id: The :ref:`Teradata connection id <howto/connection:teradata>` reference to a specific Teradata database. :param compute_profile_name: Name of the Comput...
TeradataComputeClusterSyncTrigger
python
scipy__scipy
scipy/special/tests/test_hypergeometric.py
{ "start": 118, "end": 3855 }
class ____: def test_negative_x(self): a, b, x = np.meshgrid( [-1, -0.5, 0, 0.5, 1], [-1, -0.5, 0, 0.5, 1], np.linspace(-100, -1, 10), ) assert np.all(np.isnan(sc.hyperu(a, b, x))) def test_special_cases(self): assert sc.hyperu(0, 1, 1) == 1....
TestHyperu
python
ansible__ansible
lib/ansible/errors/__init__.py
{ "start": 6259, "end": 6346 }
class ____(AnsibleError): """Unable to get user input."""
AnsiblePromptNoninteractive
python
huggingface__transformers
src/transformers/models/depth_pro/modeling_depth_pro.py
{ "start": 21082, "end": 22395 }
class ____(nn.Module): def __init__(self, config: DepthProConfig): super().__init__() self.config = config combined_feature_dims = config.scaled_images_feature_dims + config.intermediate_feature_dims self.projections = nn.ModuleList() for i, in_channels in enumerate(combined...
DepthProFeatureProjection
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql_tests/graphql/test_reload_repository_location.py
{ "start": 2745, "end": 3150 }
class ____(ReadonlyGraphQLContextTestMatrix): def test_reload_workspace_permission_failure(self, graphql_context): result = execute_dagster_graphql(graphql_context, RELOAD_WORKSPACE_QUERY) assert result assert result.data assert result.data["reloadWorkspace"] assert result.d...
TestReloadWorkspaceReadOnly
python
django__django
tests/admin_views/models.py
{ "start": 19924, "end": 20031 }
class ____(models.Model): title = models.CharField(max_length=100) content = models.TextField()
Story
python
doocs__leetcode
solution/3000-3099/3064.Guess the Number Using Bitwise Questions I/Solution.py
{ "start": 75, "end": 195 }
class ____: def findNumber(self) -> int: return sum(1 << i for i in range(32) if commonSetBits(1 << i))
Solution
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/orm/strategy_options.py
{ "start": 71898, "end": 74585 }
class ____(_LoadElement): """Loader strategies against wildcard attributes e.g.:: raiseload("*") Load(User).lazyload("*") defer("*") load_only(User.name, User.email) # will create a defer('*') joinedload(User.addresses).raiseload("*") """ __visit_name__ = "to...
_TokenStrategyLoad
python
pytorch__pytorch
torch/distributed/optim/post_localSGD_optimizer.py
{ "start": 134, "end": 4498 }
class ____(torch.optim.Optimizer): r""" Wraps an arbitrary :class:`torch.optim.Optimizer` and runs `post-local SGD <https://arxiv.org/abs/1808.07217>`_, This optimizer runs local optimizer at every step. After the warm-up stage, it averages parameters periodically after the local optimizer is applied. ...
PostLocalSGDOptimizer
python
jazzband__django-waffle
waffle/testutils.py
{ "start": 1079, "end": 2027 }
class ____(_overrider[bool]): """ override_switch is a contextmanager for easier testing of switches. It accepts two parameters, name of the switch and it's state. Example usage:: with override_switch('happy_mode', active=True): ... If `Switch` already existed, it's value woul...
override_switch
python
pytorch__pytorch
setup.py
{ "start": 50827, "end": 63311 }
class ____(setuptools.command.sdist.sdist): def run(self) -> None: with concat_license_files(): super().run() def get_cmake_cache_vars() -> defaultdict[str, CMakeValue]: try: return defaultdict(lambda: False, cmake.get_cmake_cache_variables()) except FileNotFoundError: ...
sdist
python
nedbat__coveragepy
tests/mixins.py
{ "start": 543, "end": 1689 }
class ____: """A base class to connect to pytest in a test class hierarchy.""" @pytest.fixture(autouse=True) def connect_to_pytest( self, request: pytest.FixtureRequest, monkeypatch: pytest.MonkeyPatch, ) -> None: """Captures pytest facilities for use by other test helpe...
PytestBase
python
joke2k__faker
faker/providers/bank/ro_RO/__init__.py
{ "start": 60, "end": 883 }
class ____(BankProvider): """Implement bank provider for ``ro_RO`` locale.""" country_code = "RO" bban_format = "????################" swift_bank_codes = ( "NBOR", "ABNA", "BUCU", "ARBL", "MIND", "BPOS", "CARP", "RNCB", "BROM", ...
Provider
python
ansible__ansible
test/units/plugins/lookup/test_password.py
{ "start": 10738, "end": 13159 }
class ____(unittest.TestCase): def _assert_valid_chars(self, res, chars): for res_char in res: self.assertIn(res_char, chars) def test_default(self): res = password.random_password() self.assertEqual(len(res), DEFAULT_LENGTH) self.assertTrue(isinstance(res, str)) ...
TestRandomPassword
python
Netflix__metaflow
metaflow/_vendor/packaging/version.py
{ "start": 4491, "end": 16312 }
class ____(_BaseVersion): """This class abstracts handling of a project's versions. A :class:`Version` instance is comparison aware and can be compared and sorted using the standard Python interfaces. >>> v1 = Version("1.0a5") >>> v2 = Version("1.0") >>> v1 <Version('1.0a5')> >>> v2 ...
Version
python
modin-project__modin
modin/config/envvars.py
{ "start": 23033, "end": 23177 }
class ____(EnvironmentVariable, type=bool): """Whether to Turn on experimental features.""" varname = "MODIN_EXPERIMENTAL"
IsExperimental
python
django-haystack__django-haystack
test_haystack/test_utils.py
{ "start": 2238, "end": 14472 }
class ____(TestCase): def setUp(self): super().setUp() self.document_1 = "This is a test of the highlightable words detection. This is only a test. Were this an actual emergency, your text would have exploded in mid-air." self.document_2 = ( "The content of words in no particular...
HighlighterTestCase
python
pypa__pip
src/pip/_vendor/packaging/_elffile.py
{ "start": 515, "end": 569 }
class ____(enum.IntEnum): Lsb = 1 Msb = 2
EIData
python
doocs__leetcode
solution/0000-0099/0071.Simplify Path/Solution.py
{ "start": 0, "end": 335 }
class ____: def simplifyPath(self, path: str) -> str: stk = [] for s in path.split('/'): if not s or s == '.': continue if s == '..': if stk: stk.pop() else: stk.append(s) return '/' + '/'...
Solution
python
pytorch__pytorch
benchmarks/operator_benchmark/pt/interpolate_test.py
{ "start": 104, "end": 4250 }
class ____(op_bench.TorchBenchmarkBase): def init( self, input_size, output_size, channels_last=False, mode="linear", dtype=torch.float, ): input_image = torch.randint( 0, 256, size=input_size, dtype=dtype, ...
InterpolateBenchmark
python
huggingface__transformers
src/transformers/models/colqwen2/configuration_colqwen2.py
{ "start": 799, "end": 3791 }
class ____(PreTrainedConfig): r""" Configuration class to store the configuration of a [`ColQ2en2ForRetrieval`]. It is used to instantiate an instance of `ColQwen2ForRetrieval` according to the specified arguments, defining the model architecture following the methodology from the "ColPali: Efficient Do...
ColQwen2Config
python
getsentry__sentry
tests/sentry/middleware/integrations/parsers/test_plugin.py
{ "start": 624, "end": 3909 }
class ____(TestCase): factory = RequestFactory() def get_response(self, request: HttpRequest) -> HttpResponse: return HttpResponse(status=200, content="passthrough") @responses.activate def test_routing_webhooks_no_region(self) -> None: routes = [ reverse("sentry-plugins-gi...
PluginRequestParserTest
python
cookiecutter__cookiecutter
cookiecutter/exceptions.py
{ "start": 2327, "end": 2494 }
class ____(CookiecutterException): """ Exception for a empty directory name. Raised when the directory name provided is empty. """
EmptyDirNameException
python
getsentry__sentry
src/sentry/models/team.py
{ "start": 3971, "end": 7109 }
class ____(ReplicatedRegionModel): """ A team represents a group of individuals which maintain ownership of projects. """ __relocation_scope__ = RelocationScope.Organization category = OutboxCategory.TEAM_UPDATE organization = FlexibleForeignKey("sentry.Organization") slug = SentrySlugFiel...
Team
python
apache__airflow
providers/amazon/tests/unit/amazon/aws/operators/test_s3.py
{ "start": 5083, "end": 6398 }
class ____: def setup_method(self): self.get_bucket_tagging_operator = S3GetBucketTaggingOperator( task_id="test-s3-get-bucket-tagging-operator", bucket_name=BUCKET_NAME, ) @mock_aws @mock.patch.object(S3Hook, "get_bucket_tagging") @mock.patch.object(S3Hook, "che...
TestS3GetBucketTaggingOperator
python
dask__distributed
distributed/tests/test_nanny.py
{ "start": 29783, "end": 31242 }
class ____(Nanny): def __init__(self, *args, in_instantiate, wait_instantiate, **kwargs): super().__init__(*args, **kwargs) self.in_instantiate = in_instantiate self.wait_instantiate = wait_instantiate async def instantiate(self): self.in_instantiate.set() self.wait_inst...
SlowDistNanny
python
Textualize__textual
docs/examples/styles/outline_vs_border.py
{ "start": 384, "end": 690 }
class ____(App): CSS_PATH = "outline_vs_border.tcss" def compose(self): yield Label(TEXT, classes="outline") yield Label(TEXT, classes="border") yield Label(TEXT, classes="outline border") if __name__ == "__main__": app = OutlineBorderApp() app.run()
OutlineBorderApp
python
doocs__leetcode
solution/1400-1499/1477.Find Two Non-overlapping Sub-arrays Each With Target Sum/Solution.py
{ "start": 0, "end": 471 }
class ____: def minSumOfLengths(self, arr: List[int], target: int) -> int: d = {0: 0} s, n = 0, len(arr) f = [inf] * (n + 1) ans = inf for i, v in enumerate(arr, 1): s += v f[i] = f[i - 1] if s - target in d: j = d[s - targe...
Solution
python
facebook__pyre-check
source/interprocedural_analyses/taint/test/integration/string_conversion.py
{ "start": 1399, "end": 1472 }
class ____: f: str = "" def __str__(self): return self.f
B
python
pytest-dev__pytest
src/_pytest/python.py
{ "start": 60020, "end": 66875 }
class ____(PyobjMixin, nodes.Item): """Item responsible for setting up and executing a Python test function. :param name: The full function name, including any decorations like those added by parametrization (``my_func[my_param]``). :param parent: The parent Node. :param config:...
Function
python
scipy__scipy
benchmarks/benchmarks/go_benchmark_functions/go_funcs_univariate.py
{ "start": 5865, "end": 6823 }
class ____(Benchmark): """ Univariate Problem08 objective function. This class defines the Univariate Problem08 global optimization problem. This is a multimodal minimization problem defined as follows: .. math:: f_{\\text{Problem08}}(x) = - \\sum_{k=1}^6 k \\cos[(k+1)x+k] Bound cons...
Problem08
python
huggingface__transformers
src/transformers/models/lxmert/modeling_lxmert.py
{ "start": 18089, "end": 18642 }
class ____(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.intermediate_size, config.hidden_size) self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=1e-12) self.dropout = nn.Dropout(config.hidden_dropout_prob) def forward(self, hidden_...
LxmertOutput
python
pennersr__django-allauth
allauth/socialaccount/admin.py
{ "start": 1022, "end": 1366 }
class ____(admin.ModelAdmin): search_fields = [] raw_id_fields = ("user",) list_display = ("user", "uid", "provider") list_filter = ("provider",) def get_search_fields(self, request): base_fields = get_adapter().get_user_search_fields() return list(map(lambda a: "user__" + a, base_f...
SocialAccountAdmin
python
pytorch__pytorch
test/dynamo/test_aot_compile.py
{ "start": 2882, "end": 2984 }
class ____(torch.nn.Module): def forward(self, x): return super().forward(x)
MultiModalMixin
python
realpython__materials
python-type-checking/hearts.py
{ "start": 151, "end": 976 }
class ____: SUITS = "♠ ♡ ♢ ♣".split() RANKS = "2 3 4 5 6 7 8 9 10 J Q K A".split() def __init__(self, suit: str, rank: str) -> None: self.suit = suit self.rank = rank @property def value(self) -> int: """The value of a card is rank as a number""" return self.RANKS.i...
Card
python
coleifer__peewee
tests/sql.py
{ "start": 484, "end": 43074 }
class ____(BaseTestCase): def test_select(self): query = (User .select(User.c.id, User.c.username) .where(User.c.username == 'foo')) self.assertSQL(query, ( 'SELECT "t1"."id", "t1"."username" ' 'FROM "users" AS "t1" ' 'WHERE ("t1"...
TestSelectQuery
python
readthedocs__readthedocs.org
readthedocs/projects/views/private.py
{ "start": 27089, "end": 27271 }
class ____(ProjectTranslationsMixin, CreateView): success_message = _("Translation created") template_name = "projects/project_translations_form.html"
ProjectTranslationsCreate
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_chart_data_labels37.py
{ "start": 315, "end": 1624 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("chart_data_labels37.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file.""" workbook = Workbook(se...
TestCompareXLSXFiles
python
django__django
django/db/models/functions/json.py
{ "start": 236, "end": 2499 }
class ____(Func): function = "JSON_ARRAY" output_field = JSONField() def as_sql(self, compiler, connection, **extra_context): if not connection.features.supports_json_field: raise NotSupportedError( "JSONFields are not supported on this database backend." ) ...
JSONArray
python
astropy__astropy
astropy/visualization/wcsaxes/tests/test_frame.py
{ "start": 346, "end": 1043 }
class ____(BaseFrame): spine_names = "abcdef" def update_spines(self): xmin, xmax = self.parent_axes.get_xlim() ymin, ymax = self.parent_axes.get_ylim() ymid = 0.5 * (ymin + ymax) xmid1 = (xmin + xmax) / 4.0 xmid2 = (xmin + xmax) * 3.0 / 4.0 self["a"].data = np...
HexagonalFrame
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/sql/selectable.py
{ "start": 242624, "end": 247766 }
class ____(SelectBase, ExecutableReturnsRows, Generative): """Wrap a :class:`_expression.TextClause` construct within a :class:`_expression.SelectBase` interface. This allows the :class:`_expression.TextClause` object to gain a ``.c`` collection and other FROM-like capabilities such as :met...
TextualSelect
python
facebookresearch__faiss
tests/test_residual_quantizer.py
{ "start": 6097, "end": 11655 }
class ____(unittest.TestCase): def test_training(self): """check that the error is in the same ballpark as PQ """ ds = datasets.SyntheticDataset(32, 3000, 1000, 0) xt = ds.get_train() xb = ds.get_database() rq = faiss.ResidualQuantizer(ds.d, 4, 6) rq.verbose ...
TestResidualQuantizer
python
huggingface__transformers
tests/models/udop/test_processing_udop.py
{ "start": 1233, "end": 4346 }
class ____(ProcessorTesterMixin, unittest.TestCase): tokenizer_class = UdopTokenizer rust_tokenizer_class = UdopTokenizerFast processor_class = UdopProcessor maxDiff = None @classmethod def _setup_image_processor(cls): image_processor_class = cls._get_component_class_from_processor("ima...
UdopProcessorTest
python
ray-project__ray
python/ray/dashboard/subprocesses/module.py
{ "start": 580, "end": 1393 }
class ____: """ Configuration for a SubprocessModule. Pickleable. """ cluster_id_hex: str gcs_address: str session_name: str temp_dir: str session_dir: str # Logger configs. Will be set up in subprocess entrypoint `run_module`. logging_level: str logging_format: str ...
SubprocessModuleConfig
python
spyder-ide__spyder
spyder/plugins/onlinehelp/plugin.py
{ "start": 733, "end": 4255 }
class ____(SpyderDockablePlugin): """ Online Help Plugin. """ NAME = 'onlinehelp' REQUIRES = [Plugins.Application] TABIFY = [Plugins.VariableExplorer, Plugins.Help] CONF_SECTION = NAME CONF_FILE = False WIDGET_CLASS = PydocBrowser LOG_PATH = get_conf_path(NAME) REQUIRE_WEB_W...
OnlineHelp
python
pypa__pip
tests/lib/configuration_helpers.py
{ "start": 430, "end": 1866 }
class ____: def setup_method(self) -> None: self.configuration = pip._internal.configuration.Configuration( isolated=False, ) def patch_configuration(self, variant: Kind, di: dict[str, Any]) -> None: old = self.configuration._load_config_files @functools.wraps(old) ...
ConfigurationMixin
python
sqlalchemy__sqlalchemy
test/ext/test_associationproxy.py
{ "start": 94295, "end": 94426 }
class ____( ScalarRemoveScalarObjectNoCascade ): create_on_none_assignment = True
ScalarRemoveScalarObjectNoCascadeNoneAssign
python
huggingface__transformers
tests/models/mamba/test_modeling_mamba.py
{ "start": 8491, "end": 16565 }
class ____(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (MambaModel, MambaForCausalLM) if is_torch_available() else () has_attentions = False # Mamba does not support attentions test_missing_keys = False pipeline_model_mapping = ( {"feat...
MambaModelTest
python
pytorch__pytorch
test/lazy/test_extract_compiled_graph.py
{ "start": 517, "end": 763 }
class ____(nn.Module): """ addcmul function takes a at::Scalar which results in a special TSData containing a Scalar rather than a Tensor. """ def forward(self, a, b, c): return torch.addcmul(a, b, c, value=5)
ModuleAddcmul
python
cython__cython
tests/run/pure_py.py
{ "start": 11502, "end": 13548 }
class ____(object): def __init__(self, *args): pass def same_type_cast(): """ >>> same_type_cast() True """ f = EmptyClass() return f is cython.cast(EmptyClass, f) def multi_args_init_cast(): """ >>> multi_args_init_cast() True """ f = Foo(10, 20, 30) retur...
EmptyClass
python
sympy__sympy
sympy/polys/rootoftools.py
{ "start": 1137, "end": 4087 }
class ____: """A minimal dictionary that makes sure that the key is a univariate PurePoly instance. Examples ======== Only the following actions are guaranteed: >>> from sympy.polys.rootoftools import _pure_key_dict >>> from sympy import PurePoly >>> from sympy.abc import x, y 1)...
_pure_key_dict
python
mlflow__mlflow
mlflow/genai/optimize/types.py
{ "start": 4785, "end": 5324 }
class ____: """ Result of the :py:func:`mlflow.genai.optimize_prompts()` API. Args: optimized_prompts: The optimized prompts. optimizer_name: The name of the optimizer. initial_eval_score: The evaluation score before optimization (optional). final_eval_score: The evaluation ...
PromptOptimizationResult
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 179056, "end": 179752 }
class ____(sgqlc.types.Input): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ( "project_id", "name", "body", "state", "public", "client_mutation_id", ) project_id = sgqlc.types.Field(sgqlc.types.non_null(...
UpdateProjectInput
python
kamyu104__LeetCode-Solutions
Python/minimum-cost-path-with-teleportations.py
{ "start": 68, "end": 1360 }
class ____(object): def minCost(self, grid, k): """ :type grid: List[List[int]] :type k: int :rtype: int """ m = len(grid) n = len(grid[0]) dp = [[float("inf")]*n for _ in xrange(m)] dp[-1][-1] = 0 mx = max(max(row) for row in grid) ...
Solution
python
django__django
django/urls/resolvers.py
{ "start": 10824, "end": 13702 }
class ____(CheckURLMixin): regex = LocaleRegexRouteDescriptor() def __init__(self, route, name=None, is_endpoint=False): self._route = route self._regex, self.converters = _route_to_regex(str(route), is_endpoint) self._regex_dict = {} self._is_endpoint = is_endpoint self...
RoutePattern
python
scipy__scipy
scipy/interpolate/tests/test_interpolate.py
{ "start": 71721, "end": 76810 }
class ____: def test_simple(self, xp): x = xp.asarray([0, 1]) c = xp.asarray([[3]]) bp = BPoly(c, x) xp_assert_close(bp(0.1), xp.asarray(3., dtype=xp.float64)) def test_simple2(self, xp): x = xp.asarray([0, 1]) c = xp.asarray([[3], [1]]) bp = BPoly(c, x) ...
TestBPoly
python
getsentry__sentry
src/sentry/net/http.py
{ "start": 6756, "end": 7276 }
class ____(HTTPAdapter): def __init__(self, *args, **kwargs): timeout = kwargs.pop("timeout", None) HTTPAdapter.__init__(self, *args, **kwargs) if timeout is None: timeout = 10.0 self.default_timeout = timeout def send(self, *args, **kwargs): if kwargs.get("t...
TimeoutAdapter
python
sqlalchemy__sqlalchemy
test/typing/plain_files/orm/dataclass_transforms_one.py
{ "start": 388, "end": 793 }
class ____(Base): __tablename__ = "a" id: Mapped[int] = mapped_column(primary_key=True, init=False) data: Mapped[str] x: Mapped[Optional[int]] = mapped_column(default=None) y: Mapped[Optional[int]] = mapped_column(kw_only=True) tis = TestInitialSupport(data="some data", y=5) assert_type(tis.data...
TestInitialSupport
python
google__jax
tests/pallas/tpu_pallas_test.py
{ "start": 137959, "end": 138791 }
class ____(PallasBaseTest): @parameterized.parameters( (dict(foo='bar'),), (dict(foo='afjafo'),), (dict(problem_info=json.dumps(dict(tiling_info=dict(bm=128, bk=128)))),), ) def test_metadata_is_preserved(self, metadata): def kernel(x_ref, y_ref, out_ref): out_ref[...] = x_ref[...] +...
PallasKernelMetadataTest
python
qdrant__qdrant-client
qdrant_client/http/models/models.py
{ "start": 9323, "end": 9828 }
class ____(BaseModel): enabled: bool = Field(..., description="") status: Optional["ClusterStatusTelemetry"] = Field(default=None, description="") config: Optional["ClusterConfigTelemetry"] = Field(default=None, description="") peers: Optional[Dict[str, "PeerInfo"]] = Field(default=None, description="")...
ClusterTelemetry
python
qdrant__qdrant-client
qdrant_client/http/models/models.py
{ "start": 62239, "end": 62505 }
class ____(BaseModel): time: Optional[float] = Field(default=None, description="Time spent to process this request") status: Optional[str] = Field(default=None, description="") result: Optional[bool] = Field(default=None, description="")
InlineResponse2009
python
google__jax
tests/lazy_loader_test.py
{ "start": 732, "end": 1351 }
class ____(absltest.TestCase): def testLazyLoader(self): self.assertEmpty([m for m in sys.modules if "lazy_test_submodule" in m]) self.assertEqual(["lazy_test_submodule"], l.__all__) self.assertEqual(["lazy_test_submodule"], dir(l)) # The submodule should be imported only after it is accessed. ...
LazyLoaderTest
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/pool/impl.py
{ "start": 14795, "end": 16895 }
class ____(Pool): """A Pool of exactly one connection, used for all requests. Reconnect-related functions such as ``recycle`` and connection invalidation (which is also used to support auto-reconnect) are only partially supported right now and may not yield good results. The :class:`.StaticPool` c...
StaticPool
python
pypa__setuptools
setuptools/_distutils/errors.py
{ "start": 3013, "end": 3092 }
class ____(DistutilsError): """Byte compile error."""
DistutilsByteCompileError
python
huggingface__transformers
src/transformers/models/luke/modeling_luke.py
{ "start": 78720, "end": 83333 }
class ____(LukePreTrainedModel): def __init__(self, config): super().__init__(config) self.num_labels = config.num_labels self.luke = LukeModel(config, add_pooling_layer=False) self.dropout = nn.Dropout( config.classifier_dropout if config.classifier_dropout is not None ...
LukeForTokenClassification
python
airbytehq__airbyte
airbyte-integrations/connectors/source-monday/components.py
{ "start": 5566, "end": 17057 }
class ____(HttpRequester): NEXT_PAGE_TOKEN_FIELD_NAME = "next_page_token" schema_loader: InlineSchemaLoader limit: Union[InterpolatedString, str, int] = None nested_limit: Union[InterpolatedString, str, int] = None def __post_init__(self, parameters: Mapping[str, Any]): super(MondayGraphql...
MondayGraphqlRequester
python
great-expectations__great_expectations
tests/integration/cloud/rest_contracts/conftest.py
{ "start": 5156, "end": 9573 }
class ____(pydantic.BaseModel): """Represents a Python API (Consumer) request and expected minimal response, given a state in the Cloud backend (Provider). The given state is something you know to be true about the Cloud backend data requested. Args: method: A string (e.g. "GET" or "POST") ...
ContractInteraction
python
matplotlib__matplotlib
lib/matplotlib/animation.py
{ "start": 22654, "end": 24220 }
class ____(FFMpegBase, FileMovieWriter): """ File-based ffmpeg writer. Frames are written to temporary files on disk and then stitched together at the end. This effectively works as a slideshow input to ffmpeg with the fps passed as ``-framerate``, so see also `their notes on frame rates`_ for fur...
FFMpegFileWriter
python
great-expectations__great_expectations
great_expectations/execution_engine/sqlite_execution_engine.py
{ "start": 935, "end": 1061 }
class ____(SqlAlchemyExecutionEngine): """SqlAlchemyExecutionEngine for SQLite databases.""" pass
SqliteExecutionEngine
python
huggingface__transformers
src/transformers/models/jetmoe/modular_jetmoe.py
{ "start": 15483, "end": 17221 }
class ____(LlamaDecoderLayer): def __init__(self, config: JetMoeConfig, layer_idx: Optional[int] = None): super().__init__(config, layer_idx) self.input_layernorm = JetMoeRMSNorm(config.hidden_size) self.self_attention = JetMoeAttention(config, layer_idx) self.post_attention_layernor...
JetMoeDecoderLayer
python
numpy__numpy
numpy/distutils/system_info.py
{ "start": 71613, "end": 72172 }
class ____(lapack_opt_info, _ilp64_opt_info_mixin): notfounderror = LapackILP64NotFoundError lapack_order = ['openblas64_', 'openblas_ilp64', 'accelerate'] order_env_var_name = 'NPY_LAPACK_ILP64_ORDER' def _calc_info(self, name): print('lapack_ilp64_opt_info._calc_info(name=%s)' % (name)) ...
lapack_ilp64_opt_info
python
eventlet__eventlet
eventlet/green/http/__init__.py
{ "start": 2837, "end": 8738 }
class ____(IntEnum): """HTTP status codes and reason phrases Status codes from the following RFCs are all observed: * RFC 7231: Hypertext Transfer Protocol (HTTP/1.1), obsoletes 2616 * RFC 6585: Additional HTTP Status Codes * RFC 3229: Delta encoding in HTTP * RFC 4918: HTTP Ex...
HTTPStatus
python
openai__openai-python
src/openai/types/responses/tool_choice_allowed.py
{ "start": 224, "end": 1023 }
class ____(BaseModel): mode: Literal["auto", "required"] """Constrains the tools available to the model to a pre-defined set. `auto` allows the model to pick from among the allowed tools and generate a message. `required` requires the model to call one or more of the allowed tools. """ to...
ToolChoiceAllowed
python
redis__redis-py
redis/exceptions.py
{ "start": 5390, "end": 5602 }
class ____(RedisClusterException): """ Raised when a transaction or watch is triggered in a pipeline and not all keys or all commands belong to the same slot. """ pass
CrossSlotTransactionError
python
tensorflow__tensorflow
tensorflow/python/ops/parallel_for/control_flow_ops_test.py
{ "start": 95208, "end": 98098 }
class ____(PForTestCase): def test_create_variable_once(self): x = array_ops.ones(shape=(3, 2, 2), dtype=dtypes.float32) y = array_ops.ones(shape=(2, 3), dtype=dtypes.float32) a_var = [] def f(z): if not a_var: a_var.append(variables.Variable(lambda: y, name="a")) return math_ops...
VariableTest
python
prompt-toolkit__python-prompt-toolkit
src/prompt_toolkit/filters/base.py
{ "start": 6176, "end": 6855 }
class ____(Filter): """ Turn any callable into a Filter. The callable is supposed to not take any arguments. This can be used as a decorator:: @Condition def feature_is_active(): # `feature_is_active` becomes a Filter. return True :param func: Callable which takes no ...
Condition
python
viewflow__viewflow
tests/workflow/test_fields__flow.py
{ "start": 155, "end": 567 }
class ____(TestCase): def test_crud(self): obj = TestFlowModel.objects.create(flow_class=TestFieldsFlow) self.assertEqual(obj.flow_class, TestFieldsFlow) obj = TestFlowModel.objects.get() self.assertEqual(obj.flow_class, TestFieldsFlow) obj = TestFlowModel.objects.filter(fl...
Test
python
pypa__setuptools
setuptools/_vendor/importlib_metadata/__init__.py
{ "start": 1053, "end": 1352 }
class ____(ModuleNotFoundError): """The package was not found.""" def __str__(self) -> str: return f"No package metadata was found for {self.name}" @property def name(self) -> str: # type: ignore[override] (name,) = self.args return name
PackageNotFoundError
python
networkx__networkx
networkx/algorithms/flow/utils.py
{ "start": 1084, "end": 1270 }
class ____: """Active and inactive nodes in a level.""" __slots__ = ("active", "inactive") def __init__(self): self.active = set() self.inactive = set()
Level
python
getsentry__sentry
src/sentry/api/serializers/models/environment.py
{ "start": 234, "end": 359 }
class ____(TypedDict): id: str name: str isHidden: bool @register(Environment)
EnvironmentProjectSerializerResponse
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/pycodestyle/E23.py
{ "start": 2930, "end": 3046 }
class ____[A: object="foo"[::-1], B: object =[[["foo", "bar"]]], C: object= bytes](): pass
PEP696GoodWithEmptyBases
python
scipy__scipy
scipy/sparse/linalg/_special_sparse_arrays.py
{ "start": 19386, "end": 25405 }
class ____(LinearOperator): """ Construct a Sakurai matrix in various formats and its eigenvalues. Constructs the "Sakurai" matrix motivated by reference [1]_: square real symmetric positive definite and 5-diagonal with the main diagonal ``[5, 6, 6, ..., 6, 6, 5], the ``+1`` and ``-1`` diagonal...
Sakurai
python
celery__celery
celery/backends/base.py
{ "start": 47870, "end": 48464 }
class ____(BaseBackend): """Dummy result backend.""" _cache = {} # need this attribute to reset cache in tests. def store_result(self, *args, **kwargs): pass def ensure_chords_allowed(self): raise NotImplementedError(E_CHORD_NO_BACKEND.strip()) def _is_disabled(self, *args, **kw...
DisabledBackend
python
django__django
django/contrib/gis/db/backends/mysql/schema.py
{ "start": 227, "end": 3607 }
class ____(DatabaseSchemaEditor): sql_add_spatial_index = "CREATE SPATIAL INDEX %(index)s ON %(table)s(%(column)s)" def quote_value(self, value): if isinstance(value, self.connection.ops.Adapter): return super().quote_value(str(value)) return super().quote_value(value) def _fie...
MySQLGISSchemaEditor
python
airbytehq__airbyte
airbyte-integrations/connectors/destination-pgvector/destination_pgvector/common/sql/sql_processor.py
{ "start": 2039, "end": 3707 }
class ____(BaseModel, abc.ABC): """Common configuration for SQL connections.""" schema_name: str """The name of the schema to write to.""" table_prefix: Optional[str] = "" """A prefix to add to created table names.""" @abc.abstractmethod def get_sql_alchemy_url(self) -> SecretString: ...
SqlConfig
python
charliermarsh__ruff
crates/ruff_python_parser/resources/valid/statement/class.py
{ "start": 931, "end": 982 }
class ____[**P = [int, str]](): ... # Mixed types
Test