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
ray-project__ray
python/ray/train/v2/_internal/execution/scaling_policy/scaling_policy.py
{ "start": 421, "end": 526 }
class ____(ScalingDecision): num_workers: int resources_per_worker: Dict[str, float]
ResizeDecision
python
weaviate__weaviate-python-client
weaviate/collections/classes/filters.py
{ "start": 17852, "end": 19776 }
class ____: def __init__(self, target: _TargetRefs) -> None: self.__target = target self.__last_target = self.__target # use this to append to the end of the chain def by_ref(self, link_on: str) -> "_FilterByRef": """Filter on the given reference.""" self.__last_target.target =...
_FilterByRef
python
getsentry__sentry
tests/sentry/integrations/api/endpoints/test_data_forwarding.py
{ "start": 5900, "end": 14492 }
class ____(DataForwardingIndexEndpointTest): method = "POST" def test_without_revamp_feature_flag_access(self) -> None: with self.feature( { "organizations:data-forwarding-revamp-access": False, "organizations:data-forwarding": True, } ): ...
DataForwardingIndexPostTest
python
cython__cython
Cython/Debugger/libpython.py
{ "start": 88479, "end": 89556 }
class ____(PythonCodeExecutor): """ Context manager that fetches the error indicator in the inferior and restores it on exit. """ def __init__(self): self.sizeof_PyObjectPtr = gdb.lookup_type('PyObject').pointer().sizeof self.pointer = self.malloc(self.sizeof_PyObjectPtr * 3) ...
FetchAndRestoreError
python
pyparsing__pyparsing
pyparsing/core.py
{ "start": 151533, "end": 152063 }
class ____(PositionToken): """Matches if current position is at the beginning of the parse string """ def __init__(self) -> None: super().__init__() self.set_name("start of text") def parseImpl(self, instring, loc, do_actions=True) -> ParseImplReturnType: # see if entire st...
StringStart
python
airbytehq__airbyte
airbyte-integrations/connectors/source-tplcentral/source_tplcentral/streams.py
{ "start": 2337, "end": 3051 }
class ____(TplcentralStream): # https://api.3plcentral.com/rels/inventory/stocksummaries collection_field = "Summaries" primary_key = ["FacilityId", "_item_identifier_id"] page_size = 500 def path( self, stream_state: Mapping[str, Any] = None, stream_slice: Mapping[str, Any] = None, next_pa...
StockSummaries
python
scipy__scipy
scipy/cluster/tests/test_hierarchy.py
{ "start": 11901, "end": 14123 }
class ____: @make_xp_test_case(single, is_isomorphic) @pytest.mark.parametrize("criterion,t", [("inconsistent", t) for t in hierarchy_test_data.fcluster_inconsistent] + [("distance", t) for t in hierarchy_test_data.fcluster_distance] + [("maxclust", t) for t in hierarchy_test_data.fclus...
TestFcluster
python
pytorch__pytorch
test/dynamo/cpython/3_13/test_set.py
{ "start": 41295, "end": 43697 }
class ____(__TestCase): def setUp(self): self.set = set((2, 4, 6)) super().setUp() def test_eq(self): # SF bug 643115 self.assertEqual(self.set, set({2:1,4:3,6:5})) def test_union_subset(self): result = self.set | set([2]) self.assertEqual(result, set((...
TestBinaryOps
python
RaRe-Technologies__gensim
gensim/matutils.py
{ "start": 18261, "end": 36601 }
class ____: """Convert a matrix in scipy.sparse format into a streaming Gensim corpus. See Also -------- :func:`~gensim.matutils.corpus2csc` Convert gensim corpus format to `scipy.sparse.csc` matrix :class:`~gensim.matutils.Dense2Corpus` Convert dense matrix to gensim corpus. "...
Sparse2Corpus
python
Unity-Technologies__ml-agents
ml-agents-trainer-plugin/mlagents_trainer_plugin/a2c/a2c_optimizer.py
{ "start": 801, "end": 1285 }
class ____(OnPolicyHyperparamSettings): beta: float = 5.0e-3 lambd: float = 0.95 num_epoch: int = attr.ib(default=1) # A2C does just one pass shared_critic: bool = False @num_epoch.validator def _check_num_epoch_one(self, attribute, value): if value != 1: raise TrainerConfi...
A2CSettings
python
ansible__ansible
lib/ansible/utils/collection_loader/_collection_finder.py
{ "start": 32649, "end": 36214 }
class ____(_AnsibleCollectionPkgLoaderBase): # HACK: stash this in a better place _redirected_package_map = {} # type: dict[str, str] _allows_package_code = True def _validate_args(self): super(_AnsibleCollectionLoader, self)._validate_args() if len(self._split_name) < 4: r...
_AnsibleCollectionLoader
python
allegroai__clearml
clearml/backend_api/services/v2_9/models.py
{ "start": 72076, "end": 73336 }
class ____(Request): """ Convert public models to private :param ids: IDs of the models to convert. Only the models originated by the company can be converted :type ids: Sequence[str] """ _service = "models" _action = "make_private" _version = "2.9" _schema = { "def...
MakePrivateRequest
python
oauthlib__oauthlib
tests/oauth1/rfc5849/endpoints/test_base.py
{ "start": 14008, "end": 16520 }
class ____(TestCase): def setUp(self): v = ClientValidator() self.e = BaseEndpoint(v) self.uri = 'https://example.com/' self.sig = ('oauth_signature=%s&' 'oauth_timestamp=1234567890&' 'oauth_nonce=abcdefghijklmnopqrstuvwxyz&' ...
SignatureVerificationTest
python
python-attrs__attrs
tests/test_dunders.py
{ "start": 27351, "end": 28742 }
class ____: def test_filenames(self): """ The created dunder methods have a "consistent" filename. """ assert ( OriginalC.__init__.__code__.co_filename == "<attrs generated methods tests.test_dunders.C>" ) assert ( OriginalC.__eq__....
TestFilenames
python
numpy__numpy
benchmarks/benchmarks/bench_linalg.py
{ "start": 1911, "end": 2316 }
class ____(Benchmark): params = sorted(set(TYPES1) - {'float16'}) param_names = ['dtype'] def setup(self, typename): np.seterr(all='ignore') self.a = get_squares_()[typename] def time_svd(self, typename): np.linalg.svd(self.a) def time_pinv(self, typename): np.lina...
Linalg
python
dask__dask
dask/dataframe/dask_expr/_expr.py
{ "start": 92340, "end": 92425 }
class ____(Binop): operation = operator.floordiv _operator_repr = "//"
FloorDiv
python
huggingface__transformers
src/transformers/models/maskformer/modeling_maskformer_swin.py
{ "start": 19467, "end": 20128 }
class ____(nn.Module): def __init__(self, config, dim): super().__init__() self.dense = nn.Linear(dim, int(config.mlp_ratio * dim)) if isinstance(config.hidden_act, str): self.intermediate_act_fn = ACT2FN[config.hidden_act] else: self.intermediate_act_fn = con...
MaskFormerSwinIntermediate
python
scikit-learn__scikit-learn
sklearn/compose/tests/test_column_transformer.py
{ "start": 1553, "end": 1860 }
class ____(BaseEstimator): def __init__(self, csr_container): self.csr_container = csr_container def fit(self, X, y=None): return self def transform(self, X, y=None): n_samples = len(X) return self.csr_container(sparse.eye(n_samples, n_samples))
SparseMatrixTrans
python
numba__numba
numba/tests/test_nested_calls.py
{ "start": 1433, "end": 4082 }
class ____(TestCase): def compile_func(self, pyfunc, objmode=False): def check(*args, **kwargs): expected = pyfunc(*args, **kwargs) result = f(*args, **kwargs) self.assertPreciseEqual(result, expected) flags = dict(forceobj=True) if objmode else dict(nopython=Tru...
TestNestedCall
python
scipy__scipy
scipy/fft/_pocketfft/tests/test_basic.py
{ "start": 28718, "end": 28853 }
class ____: def __init__(self, data): self._data = data self.__array_interface__ = data.__array_interface__
FakeArray
python
huggingface__transformers
tests/models/moshi/test_modeling_moshi.py
{ "start": 16284, "end": 22824 }
class ____: def __init__( self, parent, batch_size=4, # need batch_size != num_hidden_layers seq_length=7, is_training=True, vocab_size=99, hidden_size=32, num_hidden_layers=2, num_attention_heads=8, intermediate_size=4, hidden...
MoshiTester
python
django__django
tests/admin_views/tests.py
{ "start": 148866, "end": 149818 }
class ____(TestCase): """Regression test for #17333""" @classmethod def setUpTestData(cls): # User who can change Reports cls.changeuser = User.objects.create_user( username="changeuser", password="secret", is_staff=True ) cls.changeuser.user_permissions.add( ...
AdminViewsNoUrlTest
python
getsentry__sentry
tests/sentry/utils/locking/backends/test_redis.py
{ "start": 2191, "end": 2382 }
class ____(RedisBackendTestCaseBase, TestCase): backend_class = RedisLockBackend @cached_property def cluster(self): return clusters.get("default")
RedisLockBackendTestCase
python
dask__distributed
distributed/worker.py
{ "start": 7434, "end": 124705 }
class ____(BaseWorker, ServerNode): """Worker node in a Dask distributed cluster Workers perform two functions: 1. **Serve data** from a local dictionary 2. **Perform computation** on that data and on data from peers Workers keep the scheduler informed of their data and use that scheduler to ...
Worker
python
HypothesisWorks__hypothesis
hypothesis-python/tests/cover/test_pretty.py
{ "start": 3604, "end": 3696 }
class ____: _repr_pretty_ = None def __repr__(self): return "Dummy2()"
Dummy2
python
kamyu104__LeetCode-Solutions
Python/maximum-area-of-longest-diagonal-rectangle.py
{ "start": 37, "end": 255 }
class ____(object): def areaOfMaxDiagonal(self, dimensions): """ :type dimensions: List[List[int]] :rtype: int """ return max((l**2+w**2, l*w) for l, w in dimensions)[1]
Solution
python
apache__airflow
airflow-ctl/src/airflowctl/api/datamodels/generated.py
{ "start": 36999, "end": 37441 }
class ____(BaseModel): model_config = ConfigDict( extra="forbid", ) action: Annotated[ Literal["create"], Field(description="The action to be performed on the entities.", title="Action") ] entities: Annotated[ list[VariableBody], Field(description="A list of entities to be cr...
BulkCreateActionVariableBody
python
huggingface__transformers
src/transformers/models/bamba/modeling_bamba.py
{ "start": 3731, "end": 9082 }
class ____: """ A dynamic cache that can handle both the attention cache (which has a seq_len dimension) and the mamba cache (which has a constant shape regardless of seq_len). This cache has two sets of lists of tensors: `key_cache` and `value_cache` for attention cache and `conv_states` and `ssm_...
HybridMambaAttentionDynamicCache
python
kubernetes-client__python
kubernetes/client/models/v1_group_subject.py
{ "start": 383, "end": 3888 }
class ____(object): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. """ """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attri...
V1GroupSubject
python
getsentry__sentry
src/sentry/search/eap/columns.py
{ "start": 6761, "end": 7484 }
class ____(ResolvedFunction): """ A formula is a type of function that may accept a parameter, it divides an attribute, aggregate or formula by another. The FormulaDefinition contains a method `resolve`, which takes in the argument passed into the function and returns the resolved formula. For example i...
ResolvedFormula
python
justquick__django-activity-stream
runtests/testapp/models.py
{ "start": 257, "end": 423 }
class ____(models.Model): name = models.CharField(max_length=255) def __str__(self): return self.name class Meta: abstract = True
Abstract
python
sphinx-doc__sphinx
sphinx/builders/texinfo.py
{ "start": 1079, "end": 9908 }
class ____(Builder): """Builds Texinfo output to create Info documentation.""" name = 'texinfo' format = 'texinfo' epilog = __('The Texinfo files are in %(outdir)s.') if os.name == 'posix': epilog += __( "\nRun 'make' in that directory to run these through " 'makeinf...
TexinfoBuilder
python
xlwings__xlwings
xlwings/_xlmac.py
{ "start": 44690, "end": 45353 }
class ____(base_classes.Collection): def __init__(self, parent): self._parent = parent self.xl = getattr(self.parent.xl, self._attr) @property def parent(self): return self._parent @property def api(self): return self.xl def __call__(self, key): if not ...
Collection
python
plotly__plotly.py
plotly/graph_objs/volume/colorbar/_title.py
{ "start": 233, "end": 3964 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "volume.colorbar" _path_str = "volume.colorbar.title" _valid_props = {"font", "side", "text"} @property def font(self): """ Sets this color bar's title font. The 'font' property is an instance of Font that may ...
Title
python
PrefectHQ__prefect
tests/server/orchestration/api/test_variables.py
{ "start": 1409, "end": 5836 }
class ____: async def test_create_variable( self, client: AsyncClient, ): variable = VariableCreate( name="my_variable", value="my-value", tags=["123", "456"] ) res = await client.post( "/variables/", json=variable.model_dump(mode="json...
TestCreateVariable
python
coleifer__peewee
tests/mysql_ext.py
{ "start": 2842, "end": 3668 }
class ____(ModelTestCase): requires = [KJ] def test_mysql_json_field(self): values = ( 0, 1.0, 2.3, True, False, 'string', ['foo', 'bar', 'baz'], {'k1': 'v1', 'k2': 'v2'}, {'k3': [0, 1.0, 2.3], 'k4': {'x1': 'y1', 'x2': 'y2'}}) ...
TestMySQLJSONField
python
lazyprogrammer__machine_learning_examples
tensorflow/input_data.py
{ "start": 2478, "end": 5870 }
class ____(object): def __init__(self, images, labels, fake_data=False): if fake_data: self._num_examples = 10000 else: assert images.shape[0] == labels.shape[0], ( "images.shape: %s labels.shape: %s" % (images.shape, labels.shape)) ...
DataSet
python
PrefectHQ__prefect
src/prefect/futures.py
{ "start": 7994, "end": 12360 }
class ____(PrefectTaskRunFuture[R]): """ Represents the result of a computation happening anywhere. This class is typically used to interact with the result of a task run scheduled to run in a Prefect task worker but can be used to interact with any task run scheduled in Prefect's API. """ ...
PrefectDistributedFuture
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/operators/cloud_memorystore.py
{ "start": 33673, "end": 37614 }
class ____(GoogleCloudBaseOperator): """ Updates the metadata and configuration of a specific Redis instance. .. seealso:: For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:CloudMemorystoreScaleInstanceOperator` :param memory_size_gb: Redi...
CloudMemorystoreScaleInstanceOperator
python
PrefectHQ__prefect
tests/server/api/test_logs.py
{ "start": 5968, "end": 7589 }
class ____: """Test the API endpoint converts LogCreate to Log objects for messaging""" async def test_post_logs_api_converts_logcreate_to_log_for_messaging( self, client, flow_run_id ): """Test posting LogCreate to API results in Log objects passed to publish_logs""" log_create_dat...
TestLogSchemaConversionAPI
python
aio-libs__aiohttp
aiohttp/resolver.py
{ "start": 2607, "end": 6044 }
class ____(AbstractResolver): """Use the `aiodns` package to make asynchronous DNS lookups""" def __init__(self, *args: Any, **kwargs: Any) -> None: if aiodns is None: raise RuntimeError("Resolver requires aiodns library") self._loop = asyncio.get_running_loop() self._manag...
AsyncResolver
python
pypa__pip
src/pip/_vendor/urllib3/contrib/appengine.py
{ "start": 2264, "end": 2316 }
class ____(HTTPError): pass
AppEnginePlatformError
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_hyperlink02.py
{ "start": 315, "end": 1168 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("hyperlink02.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file with hyperlinks.""" workbook = Wor...
TestCompareXLSXFiles
python
openai__openai-python
src/openai/types/beta/chatkit/chat_session_expires_after_param.py
{ "start": 228, "end": 519 }
class ____(TypedDict, total=False): anchor: Required[Literal["created_at"]] """Base timestamp used to calculate expiration. Currently fixed to `created_at`.""" seconds: Required[int] """Number of seconds after the anchor when the session expires."""
ChatSessionExpiresAfterParam
python
kamyu104__LeetCode-Solutions
Python/longest-special-path-ii.py
{ "start": 2105, "end": 3270 }
class ____(object): def longestSpecialPath(self, edges, nums): """ :type edges: List[List[int]] :type nums: List[int] :rtype: List[int] """ def dfs(u, p, d, left): prev_d, lookup[nums[u]-1] = lookup[nums[u]-1], d new_left = left[:] ...
Solution2
python
django-import-export__django-import-export
import_export/widgets.py
{ "start": 16542, "end": 18040 }
class ____(Widget): """ Widget for a JSON object (especially required for jsonb fields in PostgreSQL database.) :param value: Defaults to JSON format. The widget covers two cases: Proper JSON string with double quotes, else it tries to use single quotes and then convert it to proper JSON. "...
JSONWidget
python
huggingface__transformers
src/transformers/models/dinov3_vit/modeling_dinov3_vit.py
{ "start": 10823, "end": 13418 }
class ____(nn.Module): """ Multi-headed attention compatible with ALL_ATTENTION_FUNCTIONS. """ def __init__(self, config: DINOv3ViTConfig): super().__init__() self.config = config self.embed_dim = config.hidden_size self.num_heads = config.num_attention_heads sel...
DINOv3ViTAttention
python
sympy__sympy
sympy/physics/quantum/fermion.py
{ "start": 3580, "end": 4552 }
class ____(Ket): """Fock state ket for a fermionic mode. Parameters ========== n : Number The Fock state number. """ def __new__(cls, n): if n not in (0, 1): raise ValueError("n must be 0 or 1") return Ket.__new__(cls, n) @property def n(self): ...
FermionFockKet
python
neetcode-gh__leetcode
python/0516-longest-palindromic-subsequence.py
{ "start": 55, "end": 1347 }
class ____: def longestPalindromeSubseq(self, s: str) -> int: # Dynamic Programming dp = [ [0] * (len(s) + 1) for i in range(len(s) + 1)] res = 0 for i in range(len(s)): for j in range(len(s) - 1, i - 1, -1): if s[i] == s[j]: ...
Solution
python
ApeWorX__ape
src/ape/plugins/_utils.py
{ "start": 20724, "end": 24077 }
class ____(BaseModel): """ A group of plugin metadata by type. """ plugin_type: PluginType plugins: dict[str, PluginMetadata] = {} def __bool__(self) -> bool: return len(self.plugins) > 0 @log_instead_of_fail(default="<PluginGroup>") def __repr__(self) -> str: return f...
PluginGroup
python
scipy__scipy
benchmarks/benchmarks/go_benchmark_functions/go_funcs_B.py
{ "start": 103, "end": 1194 }
class ____(Benchmark): r""" Bartels-Conn objective function. The BartelsConn [1]_ global optimization problem is a multimodal minimization problem defined as follows: .. math:: f_{\text{BartelsConn}}(x) = \lvert {x_1^2 + x_2^2 + x_1x_2} \rvert + \lvert {\sin(x_1)} \rvert + \lver...
BartelsConn
python
cython__cython
Cython/Compiler/ParseTreeTransforms.py
{ "start": 83832, "end": 85631 }
class ____(CythonTransform, SkipDeclarations): """ Only part of the CythonUtilityCode pipeline. Must be run before DecoratorTransform in case this is a decorator for a cdef class. It filters out @cname('my_cname') decorators and rewrites them to CnameDecoratorNodes. """ def handle_function(...
CnameDirectivesTransform
python
pypa__hatch
tests/project/test_core.py
{ "start": 3777, "end": 4604 }
class ____: def test_missing(self, temp_dir): project = Project(temp_dir) project.find_project_root() assert project.raw_config == {"project": {"name": temp_dir.name}} def test_exists(self, temp_dir): project_file = temp_dir / "pyproject.toml" project_file.touch() ...
TestRawConfig
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/ext/mutable.py
{ "start": 12588, "end": 14770 }
class ____ a ``weakref.WeakKeyDictionary`` available via the :meth:`MutableBase._parents` attribute which isn't picklable. If we need to pickle instances of ``Point`` or its owning class ``Vertex``, we at least need to define a ``__getstate__`` that doesn't include the ``_parents`` dictionary. Below we define both a ``...
uses
python
tensorflow__tensorflow
tensorflow/python/data/ops/readers.py
{ "start": 9908, "end": 10694 }
class ____(dataset_ops.DatasetV1Adapter): """A `Dataset` comprising lines from one or more text files.""" def __init__(self, filenames, compression_type=None, buffer_size=None, num_parallel_reads=None, name=None): wrapped = TextLineData...
TextLineDatasetV1
python
apache__airflow
airflow-core/tests/unit/listeners/xcom_listener.py
{ "start": 864, "end": 1634 }
class ____: def __init__(self, path: str, task_id: str): self.path = path self.task_id = task_id def write(self, line: str): with open(self.path, "a") as f: f.write(line + "\n") @hookimpl def on_task_instance_running(self, previous_state, task_instance): tas...
XComListener
python
viewflow__viewflow
viewflow/workflow/flow/views/create.py
{ "start": 275, "end": 1238 }
class ____( FormLayoutMixin, FormAjaxCompleteMixin, FormDependentSelectMixin, mixins.SuccessMessageMixin, mixins.TaskSuccessUrlMixin, mixins.TaskViewTemplateNames, generic.UpdateView, ): """Default view to start a process""" success_message = _("Process {process} has been started.")...
CreateProcessView
python
readthedocs__readthedocs.org
readthedocs/rtd_tests/tests/test_api.py
{ "start": 28092, "end": 68370 }
class ____(TestCase): fixtures = ["eric.json", "test_data.json"] def test_create_key_for_project_with_long_slug(self): user = get(User) project = get(Project, users=[user], slug="a" * 60) build_api_key_obj, build_api_key = BuildAPIKey.objects.create_key(project) self.assertTrue(...
APITests
python
fastapi__sqlmodel
docs_src/tutorial/select/tutorial003_py310.py
{ "start": 71, "end": 1106 }
class ____(SQLModel, table=True): id: int | None = Field(default=None, primary_key=True) name: str secret_name: str age: int | None = None sqlite_file_name = "database.db" sqlite_url = f"sqlite:///{sqlite_file_name}" engine = create_engine(sqlite_url, echo=True) def create_db_and_tables(): SQLM...
Hero
python
django__django
django/core/validators.py
{ "start": 14174, "end": 15655 }
class ____(BaseValidator): message = _("Ensure this value is a multiple of step size %(limit_value)s.") code = "step_size" def __init__(self, limit_value, message=None, offset=None): super().__init__(limit_value, message) if offset is not None: self.message = _( ...
StepValueValidator
python
facebook__pyre-check
source/interprocedural_analyses/taint/test/integration/model_query_type_annotation.py
{ "start": 1340, "end": 1489 }
class ____: taint_1: Annotated[str, "foo"] = "" taint_2: Annotated[int, "bar"] = 0 no_taint_1: List[int] = [] no_taint_2: int = 0
Test9_C
python
redis__redis-py
redis/commands/search/hybrid_query.py
{ "start": 6469, "end": 6555 }
class ____(Enum): RRF = "RRF" LINEAR = "LINEAR" @experimental
CombinationMethods
python
getsentry__sentry
tests/sentry/debug_files/test_artifact_bundles.py
{ "start": 2862, "end": 6082 }
class ____(TestCase): def clear_cache(self): redis_client = get_redis_cluster_for_artifact_bundles() redis_client.flushall() def test_indexing_artifacts(self) -> None: self.clear_cache() bundle = make_compressed_zip_file( { "path/in/zip/foo": { ...
ArtifactLookupTest
python
tensorflow__tensorflow
tensorflow/python/profiler/tfprof_logger_test.py
{ "start": 922, "end": 2863 }
class ____(test.TestCase): def _BuildSmallPlaceholderlModel(self): a = array_ops.placeholder(dtypes.int32, [2, 2]) b = array_ops.placeholder(dtypes.int32, [2, 2]) y = math_ops.matmul(a, b) return a, b, y def _BuildSmallModel(self): a = constant_op.constant([[1, 2], [3, 4]]) b = constant_op...
TFProfLoggerTest
python
HypothesisWorks__hypothesis
hypothesis-python/src/hypothesis/strategies/_internal/strategies.py
{ "start": 39286, "end": 43626 }
class ____(SearchStrategy[MappedTo], Generic[MappedFrom, MappedTo]): """A strategy which is defined purely by conversion to and from another strategy. Its parameter and distribution come from that other strategy. """ def __init__( self, strategy: SearchStrategy[MappedFrom], ...
MappedStrategy
python
pdm-project__pdm
src/pdm/models/cached_package.py
{ "start": 205, "end": 3023 }
class ____: """A package cached in the central package store. The directory name is similar to wheel's filename: $PACKAGE_ROOT/<checksum[:2]>/<dist_name>-<version>-<impl>-<abi>-<plat>/ The checksum is stored in a file named `.checksum` under the directory. Under the directory there could be a...
CachedPackage
python
getsentry__sentry
src/sentry/search/snuba/backend.py
{ "start": 10851, "end": 11140 }
class ____: """\ Adds a single filter to a ``QuerySet`` object. Used with ``QuerySetBuilder``. """ def apply( self, queryset: BaseQuerySet[Group, Group], search_filter: SearchFilter ) -> BaseQuerySet[Group, Group]: raise NotImplementedError
Condition
python
celery__celery
t/unit/utils/test_serialization.py
{ "start": 1283, "end": 1484 }
class ____: def test_init(self): x = UnpickleableExceptionWrapper('foo', 'Bar', [10, lambda x: x]) assert x.exc_args assert len(x.exc_args) == 2
test_UnpickleExceptionWrapper
python
apache__airflow
airflow-core/tests/unit/models/test_deadline.py
{ "start": 22236, "end": 25929 }
class ____: class MyCustomRef(ReferenceModels.BaseDeadlineReference): def _evaluate_with(self, *, session: Session, **kwargs) -> datetime: return timezone.datetime(DEFAULT_DATE) class MyInvalidCustomRef: pass class MyCustomRefWithKwargs(ReferenceModels.BaseDeadlineReference): ...
TestCustomDeadlineReference
python
google__jax
tests/state_test.py
{ "start": 41309, "end": 42045 }
class ____(NamedTuple): vmap_index_param: VmappableIndexParam bat_ref: np.ndarray bat_idxs: tuple[np.ndarray, ...] @hps.composite def get_vmap_params(draw): vmap_index_param: VmappableIndexParam = draw( vmappable_index_params(op_type="get")) bat_ref = draw(hnp.arrays(np.float32, vmap_index_param.bat_re...
GetVmapParams
python
coleifer__peewee
tests/regressions.py
{ "start": 51431, "end": 52276 }
class ____(ModelTestCase): requires = [CharPK, CharFK] def test_model_conversion_regression(self): cpks = [CharPK.create(id=str(i), name='u%s' % i) for i in range(3)] query = CharPK.select().where(CharPK.id << cpks) self.assertEqual(sorted([c.id for c in query]), ['0', '1', '2']) ...
TestModelConversionRegression
python
numba__numba
numba/tests/test_dyn_array.py
{ "start": 35779, "end": 38092 }
class ____(TestCase): def setUp(self): v = np.array([1, 2, 3]) hv = np.array([[1, 2, 3]]) vv = np.transpose(hv) self.vectors = [v, hv, vv] a3x4 = np.arange(12).reshape(3, 4) a4x3 = np.arange(12).reshape(4, 3) self.matricies = [a3x4, a4x3] def func(q):...
TestNdDiag
python
ray-project__ray
python/ray/data/tests/test_pandas_block.py
{ "start": 3326, "end": 7967 }
class ____: @pytest.fixture def all_null_series(self): return pd.Series([None] * 3, dtype=np.float64) def test_count_all_null(self, all_null_series): accessor = PandasBlockColumnAccessor(all_null_series) # When ignoring nulls, count should be 0; otherwise, count returns length. ...
TestPandasBlockColumnAccessorAllNullSeries
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 843784, "end": 844532 }
class ____(sgqlc.types.relay.Connection): """The connection type for ProjectV2Actor.""" __schema__ = github_schema __field_names__ = ("edges", "nodes", "page_info", "total_count") edges = sgqlc.types.Field(sgqlc.types.list_of("ProjectV2ActorEdge"), graphql_name="edges") """A list of edges.""" ...
ProjectV2ActorConnection
python
cython__cython
Cython/Compiler/Code.py
{ "start": 139443, "end": 139857 }
class ____: # f file output file # level int indentation level def __init__(self, outfile_name): self.f = Utils.open_new_file(outfile_name) self.level = 0 def putln(self, code): self.f.write("%s%s\n" % (" " * self.level, code)) def inde...
PyrexCodeWriter
python
bokeh__bokeh
src/bokeh/application/handlers/server_lifecycle.py
{ "start": 1748, "end": 5083 }
class ____(LifecycleHandler): ''' Load a script which contains server lifecycle callbacks. ''' def __init__(self, *, filename: PathLike, argv: list[str] = [], package: ModuleType | None = None) -> None: ''' Keyword Args: filename (str) : path to a module to load lifecycle call...
ServerLifecycleHandler
python
qdrant__qdrant-client
qdrant_client/http/models/models.py
{ "start": 30441, "end": 30702 }
class ____(BaseModel, extra="forbid"): target: "VectorInput" = Field(..., description="") context: Union[List["ContextPair"], "ContextPair"] = Field( ..., description="Search space will be constrained by these pairs of vectors" )
DiscoverInput
python
airbytehq__airbyte
airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_source.py
{ "start": 1550, "end": 7412 }
class ____: def test_check_connection_ok(self, config, logger_mock, fb_marketing): ok, error_msg = fb_marketing.check_connection(logger_mock, config=config) assert ok assert not error_msg def test_check_connection_find_account_was_called(self, api_find_account, config, logger_mock, fb_...
TestSourceFacebookMarketing
python
PyCQA__pylint
tests/functional/m/match_class_pattern.py
{ "start": 494, "end": 2442 }
class ____(NamedTuple): # inherits from tuple -> match self x: int y: int def f1(x): """Check too many positional sub-patterns""" match x: case A(1): ... case A(1, 2): ... # [too-many-positional-sub-patterns] case B(1, 2): ... case B(1, 2, 3): ... # [too-many-posi...
Result
python
getsentry__sentry
src/sentry/interfaces/contexts.py
{ "start": 5889, "end": 6017 }
class ____(ContextType): type = "app" context_to_tag_mapping = {"device": "{device_app_hash}"} @contexttype
AppContextType
python
gwtw__py-sorting
test/bubble_sort_test.py
{ "start": 406, "end": 737 }
class ____(unittest.TestCase, BaseCustomComparisonSortTest, BasePositiveIntegerSortTest, BaseNegativeIntegerSortTest, BaseStringSortTest): def setUp(self): self.sort = bubble_sort.sort if __name__ == '__main__': unittest.main()...
BubbleSortTest
python
ansible__ansible
lib/ansible/plugins/action/assemble.py
{ "start": 1195, "end": 6153 }
class ____(ActionBase): TRANSFERS_FILES = True def _assemble_from_fragments(self, src_path, delimiter=None, compiled_regexp=None, ignore_hidden=False, decrypt=True): """ assemble a file from a directory of fragments """ tmpfd, temp_path = tempfile.mkstemp(dir=C.DEFAULT_LOCAL_TMP) tmp ...
ActionModule
python
django__django
tests/middleware_exceptions/middleware.py
{ "start": 3109, "end": 3254 }
class ____(BaseMiddleware): async def process_template_response(self, request, response): return None
AsyncNoTemplateResponseMiddleware
python
scipy__scipy
scipy/optimize/_differentialevolution.py
{ "start": 25680, "end": 85674 }
class ____: """This class implements the differential evolution solver Parameters ---------- func : callable The objective function to be minimized. Must be in the form ``f(x, *args)``, where ``x`` is the argument in the form of a 1-D array and ``args`` is a tuple of any additi...
DifferentialEvolutionSolver
python
openai__openai-python
src/openai/types/realtime/realtime_tools_config_param.py
{ "start": 2488, "end": 4708 }
class ____(TypedDict, total=False): server_label: Required[str] """A label for this MCP server, used to identify it in tool calls.""" type: Required[Literal["mcp"]] """The type of the MCP tool. Always `mcp`.""" allowed_tools: Optional[McpAllowedTools] """List of allowed tool names or a filter ...
Mcp
python
huggingface__transformers
src/transformers/models/blip/configuration_blip.py
{ "start": 10444, "end": 14630 }
class ____(PreTrainedConfig): r""" [`BlipConfig`] is the configuration class to store the configuration of a [`BlipModel`]. It is used to instantiate a BLIP model according to the specified arguments, defining the text model and vision model configs. Instantiating a configuration with the defaults will ...
BlipConfig
python
ansible__ansible
lib/ansible/module_utils/facts/network/linux.py
{ "start": 893, "end": 18392 }
class ____(Network): """ This is a Linux-specific subclass of Network. It defines - interfaces (a list of interface names) - interface_<name> dictionary of ipv4, ipv6, and mac address information. - all_ipv4_addresses and all_ipv6_addresses: lists of all configured addresses. - ipv4_address and...
LinuxNetwork
python
numpy__numpy
numpy/linalg/tests/test_linalg.py
{ "start": 12594, "end": 12923 }
class ____(LinalgTestCase): def test_herm_cases(self): self.check_cases(require={'hermitian'}, exclude={'generalized', 'size-0'}) def test_empty_herm_cases(self): self.check_cases(require={'hermitian', 'size-0'}, exclude={'generalized'})
HermitianTestCase
python
django__django
tests/admin_inlines/admin.py
{ "start": 7117, "end": 7219 }
class ____(admin.StackedInline): model = ChildModel2 # admin for #19425 and #18388
ChildModel2Inline
python
altair-viz__altair
altair/vegalite/v6/schema/core.py
{ "start": 637656, "end": 639137 }
class ____(Gradient): """ LinearGradient schema wrapper. Parameters ---------- gradient : Literal['linear'] The type of gradient. Use ``"linear"`` for a linear gradient. stops : Sequence[dict, :class:`GradientStop`] An array of gradient stops defining the gradient color sequence...
LinearGradient
python
django__django
django/contrib/gis/forms/fields.py
{ "start": 4255, "end": 4324 }
class ____(GeometryField): geom_type = "MULTIPOINT"
MultiPointField
python
ApeWorX__ape
src/ape_ethereum/provider.py
{ "start": 59373, "end": 68024 }
class ____(Web3Provider, ABC): # optimal values for geth block_page_size: int = 5000 concurrency: int = 16 name: str = "node" # NOTE: Appends user-agent to base User-Agent string. request_header: dict = {"User-Agent": f"EthereumNodeProvider/web3.py/{web3_version}"} @property def conne...
EthereumNodeProvider
python
mwaskom__seaborn
seaborn/_statistics.py
{ "start": 7169, "end": 14259 }
class ____: """Univariate and bivariate histogram estimator.""" def __init__( self, stat="count", bins="auto", binwidth=None, binrange=None, discrete=False, cumulative=False, ): """Initialize the estimator with its parameters. Paramete...
Histogram
python
PyCQA__pylint
pylint/utils/pragma_parser.py
{ "start": 2993, "end": 3110 }
class ____(PragmaParserError): """Thrown in case the of a valid but unrecognized option."""
UnRecognizedOptionError
python
huggingface__transformers
src/transformers/models/flex_olmo/modeling_flex_olmo.py
{ "start": 5824, "end": 9862 }
class ____(nn.Module): def __init__(self, config): super().__init__() self.config = config self.hidden_size = config.hidden_size self.intermediate_size = config.intermediate_size self.gate_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False) self.up_...
FlexOlmoMLP
python
walkccc__LeetCode
solutions/3547. Maximum Sum of Edge Values in a Graph/3547.py
{ "start": 0, "end": 1546 }
class ____: def maxScore(self, n: int, edges: list[list[int]]) -> int: ans = 0 graph = [[] for _ in range(n)] cycleSizes = [] # components where all nodes have degree 2 pathSizes = [] # components that are not cycleSizes seen = set() for u, v in edges: graph[u].append(v) graph[v...
Solution
python
PrefectHQ__prefect
tests/server/models/test_flow_runs.py
{ "start": 49030, "end": 52683 }
class ____: async def test_delete_flow_run(self, flow, session): # create a flow run to delete flow_run = await models.flow_runs.create_flow_run( session=session, flow_run=schemas.core.FlowRun(flow_id=flow.id), ) assert await models.flow_runs.delete_flow_run(...
TestDeleteFlowRun
python
mlflow__mlflow
mlflow/tracing/export/mlflow_v3.py
{ "start": 1264, "end": 10803 }
class ____(SpanExporter): """ An exporter implementation that logs the traces to MLflow Tracking Server using the V3 trace schema and API. """ def __init__(self, tracking_uri: str | None = None) -> None: self._client = TracingClient(tracking_uri) self._is_async_enabled = self._shoul...
MlflowV3SpanExporter
python
langchain-ai__langchain
libs/partners/openai/tests/unit_tests/embeddings/test_base_standard.py
{ "start": 210, "end": 916 }
class ____(EmbeddingsUnitTests): @property def embeddings_class(self) -> type[Embeddings]: return OpenAIEmbeddings @property def init_from_env_params(self) -> tuple[dict, dict, dict]: return ( { "OPENAI_API_KEY": "api_key", "OPENAI_ORG_ID": "o...
TestOpenAIStandard
python
nryoung__algorithms
tests/test_math.py
{ "start": 813, "end": 1517 }
class ____(unittest.TestCase): def test_extended_gcd(self): # Find extended_gcd of 35 and 77 (a, b) = extended_gcd(35, 77) print(a, b) self.assertIs(35 * a + 77 * b, 7) # Find extended_gcd of 15 and 19 (a, b) = extended_gcd(15, 19) self.assertIs(15 * a + 19 ...
TestExtendedGCD