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
huggingface__transformers
src/transformers/models/evolla/modeling_evolla.py
{ "start": 59158, "end": 62811 }
class ____(EvollaPreTrainedModel, GenerationMixin): def __init__(self, config): super().__init__(config) self.model = EvollaModel(config) self.vocab_size = config.vocab_size self.lm_head = nn.Linear(config.hidden_size, self.vocab_size, bias=False) self.post_init() def g...
EvollaForProteinText2Text
python
EpistasisLab__tpot
tpot/builtin_modules/zero_count.py
{ "start": 1603, "end": 2779 }
class ____(TransformerMixin, BaseEstimator ): """Adds the count of zeros and count of non-zeros per sample as features.""" def fit(self, X, y=None): """Dummy function to fit in with the sklearn API.""" return self def transform(self, X, y=None): """Transform data by adding two virt...
ZeroCount
python
fastapi__sqlmodel
docs_src/tutorial/indexes/tutorial002_py310.py
{ "start": 71, "end": 1596 }
class ____(SQLModel, table=True): id: int | None = Field(default=None, primary_key=True) name: str = Field(index=True) secret_name: str age: int | None = Field(default=None, index=True) sqlite_file_name = "database.db" sqlite_url = f"sqlite:///{sqlite_file_name}" engine = create_engine(sqlite_url, ec...
Hero
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/flake8_pyi/PYI036.py
{ "start": 3021, "end": 3185 }
class ____: def __exit__(self, *args: Any) -> None: ... # PYI036: Bad star-args annotation async def __aexit__(self) -> None: ... # PYI036: Missing args
BadOne
python
xlwings__xlwings
xlwings/base_classes.py
{ "start": 500, "end": 3068 }
class ____: @property def xl(self): raise NotImplementedError() @xl.setter def xl(self, value): raise NotImplementedError() @property def api(self): raise NotImplementedError() @property def selection(self): raise NotImplementedError() def activate...
App
python
sphinx-doc__sphinx
sphinx/ext/inheritance_diagram.py
{ "start": 3728, "end": 12530 }
class ____: """Given a list of classes, determines the set of classes that they inherit from all the way to the root "object", and then is able to generate a graphviz dot graph from them. """ def __init__( self, class_names: list[str], currmodule: str, show_builtins:...
InheritanceGraph
python
Unity-Technologies__ml-agents
ml-agents/mlagents/trainers/policy/checkpoint_manager.py
{ "start": 456, "end": 3958 }
class ____: @staticmethod def get_checkpoints(behavior_name: str) -> List[Dict[str, Any]]: checkpoint_list = GlobalTrainingStatus.get_parameter_state( behavior_name, StatusType.CHECKPOINTS ) if not checkpoint_list: checkpoint_list = [] GlobalTrainingSt...
ModelCheckpointManager
python
facebook__pyre-check
source/interprocedural_analyses/taint/test/integration/taint_in_taint_out.py
{ "start": 3139, "end": 9401 }
class ____: def evaluate_lazy_field(self, field): if callable(field): return field() else: return field def evaluate_lazy_payload(self, payload): def _evaluate(field): if isinstance(field, dict): return self.evaluate_lazy_payload(field...
ComplexEvaluator
python
huggingface__transformers
src/transformers/models/ibert/modeling_ibert.py
{ "start": 31627, "end": 32497 }
class ____(nn.Module): """I-BERT Head for masked language modeling.""" def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) self.layer_norm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps) self.decoder = nn.L...
IBertLMHead
python
allegroai__clearml
clearml/backend_api/services/v2_9/models.py
{ "start": 75603, "end": 76737 }
class ____(Response): """ Response of models.make_public endpoint. :param updated: Number of models updated :type updated: int """ _service = "models" _action = "make_public" _version = "2.9" _schema = { "definitions": {}, "properties": { "updated": { ...
MakePublicResponse
python
scipy__scipy
scipy/spatial/tests/test_kdtree.py
{ "start": 4171, "end": 4516 }
class ____(ConsistencyTests): def setup_method(self): self.n = 100 self.m = 4 np.random.seed(1234) self.data = np.random.randn(self.n, self.m) self.kdtree = self.kdtree_type(self.data, leafsize=2) self.x = np.random.randn(self.m) self.d = 0.2 self.k = ...
_Test_random
python
oauthlib__oauthlib
oauthlib/oauth2/rfc6749/errors.py
{ "start": 7273, "end": 7761 }
class ____(InvalidRequestError): """ If the server supporting PKCE does not support the requested transformation, the authorization endpoint MUST return the authorization error response with "error" value set to "invalid_request". The "error_description" or the response of "error_uri" SHOULD ex...
UnsupportedCodeChallengeMethodError
python
apache__airflow
providers/amazon/src/airflow/providers/amazon/aws/transfers/s3_to_ftp.py
{ "start": 1171, "end": 3014 }
class ____(BaseOperator): """ This operator enables the transferring of files from S3 to a FTP server. .. seealso:: For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:S3ToFTPOperator` :param s3_bucket: The targeted s3 bucket. This is the S3...
S3ToFTPOperator
python
spack__spack
lib/spack/spack/test/cmd/repo.py
{ "start": 9708, "end": 30506 }
class ____(spack.repo.RepoDescriptor): def __init__(self, to_construct: Dict[str, Union[spack.repo.Repo, Exception]]): self.to_construct = to_construct self.initialized = False def initialize(self, fetch=True, git=None) -> None: self.initialized = True def get_commit(self, git: Opt...
MockDescriptor
python
kamyu104__LeetCode-Solutions
Python/best-team-with-no-conflicts.py
{ "start": 4986, "end": 5615 }
class ____(object): def bestTeamScore(self, scores, ages): """ :type scores: List[int] :type ages: List[int] :rtype: int """ players = sorted(zip(scores, ages)) dp = [0]*len(players) result = 0 for i in xrange(len(players)): dp[i] =...
Solution5
python
tensorflow__tensorflow
tensorflow/python/data/kernel_tests/shuffle_test.py
{ "start": 20367, "end": 23646 }
class ____(checkpoint_test_base.CheckpointTestBase, parameterized.TestCase): def _build_shuffle_dataset( self, range_limit=10, num_repeats=5, buffer_size=5, seed=None, reshuffle_each_iteration=None, symbolic_checkpoint=None, ): dataset = ( ...
ShuffleCheckpointTest
python
django__django
tests/model_forms/models.py
{ "start": 8400, "end": 8446 }
class ____(Book, BookXtra): pass
DerivedBook
python
ethereum__web3.py
tests/integration/go_ethereum/test_goethereum_http.py
{ "start": 5177, "end": 6725 }
class ____(GoEthereumAsyncEthModuleTest): @pytest.mark.asyncio async def test_async_http_provider_disconnects_gracefully(self, async_w3) -> None: w3_1 = async_w3 w3_2 = AsyncWeb3(AsyncHTTPProvider(async_w3.provider.endpoint_uri)) assert w3_1 != w3_2 await w3_1.eth.get_block("la...
TestGoEthereumAsyncEthModuleTest
python
huggingface__transformers
src/transformers/models/llama/modeling_llama.py
{ "start": 21681, "end": 21965 }
class ____(GenericForTokenClassification, LlamaPreTrainedModel): ... __all__ = [ "LlamaForCausalLM", "LlamaModel", "LlamaPreTrainedModel", "LlamaForSequenceClassification", "LlamaForQuestionAnswering", "LlamaForTokenClassification", ]
LlamaForTokenClassification
python
PyCQA__pylint
tests/functional/s/self/self_cls_assignment.py
{ "start": 920, "end": 1239 }
class ____: """Test class for nonlocal assignment of self""" def function(self, param): """This function uses nonlocal to reassign self""" def _set_param(param): nonlocal self self = param # [self-cls-assignment] _set_param(param) return self
TestNonLocal
python
huggingface__transformers
src/transformers/models/beit/modeling_beit.py
{ "start": 28277, "end": 29448 }
class ____(PreTrainedModel): config: BeitConfig base_model_prefix = "beit" input_modalities = ("image",) main_input_name = "pixel_values" supports_gradient_checkpointing = True _no_split_modules = ["BeitLayer"] _keys_to_ignore_on_load_unexpected = [r".*relative_position_index.*"] _suppor...
BeitPreTrainedModel
python
mlflow__mlflow
mlflow/langchain/langchain_tracer.py
{ "start": 1646, "end": 24086 }
class ____(BaseCallbackHandler, metaclass=ExceptionSafeAbstractClass): """ Callback for auto-logging traces. We need to inherit ExceptionSafeAbstractClass to avoid invalid new input arguments added to original function call. Args: prediction_context: Optional prediction context object to be...
MlflowLangchainTracer
python
getsentry__sentry
src/sentry/replays/usecases/query/conditions/event_ids.py
{ "start": 324, "end": 1775 }
class ____(ComputedBase): """Look at both debug_id and info_id if info_id is queried""" event_id_columns: list[str] = ["info_id", "debug_id"] @classmethod def visit_eq(cls, value: UUID) -> Condition: return Condition( Function( "or", _make_conditions...
InfoIdScalar
python
kamyu104__LeetCode-Solutions
Python/lowest-common-ancestor-of-a-binary-tree-iv.py
{ "start": 132, "end": 1217 }
class ____(object): def lowestCommonAncestor(self, root, nodes): """ :type root: TreeNode :type nodes: List[TreeNode] """ def iter_dfs(root, lookup): result = [0] stk = [(1, (root, result))] while stk: step, args = stk.pop()...
Solution
python
kamyu104__LeetCode-Solutions
Python/maximal-square.py
{ "start": 31, "end": 1093 }
class ____(object): # @param {character[][]} matrix # @return {integer} def maximalSquare(self, matrix): if not matrix: return 0 m, n = len(matrix), len(matrix[0]) size = [[0 for j in xrange(n)] for i in xrange(2)] max_size = 0 for j in xrange(n): ...
Solution
python
pyca__cryptography
tests/hazmat/asn1/test_api.py
{ "start": 404, "end": 3549 }
class ____: def test_repr_printable_string(self) -> None: my_string = "MyString" assert ( repr(asn1.PrintableString(my_string)) == f"PrintableString({my_string!r})" ) def test_printable_string_as_str(self) -> None: my_string = "MyString" assert as...
TestTypesAPI
python
sympy__sympy
sympy/printing/jscode.py
{ "start": 1130, "end": 11981 }
class ____(CodePrinter): """"A Printer to convert Python expressions to strings of JavaScript code """ printmethod = '_javascript' language = 'JavaScript' _default_settings: dict[str, Any] = dict(CodePrinter._default_settings, **{ 'precision': 17, 'user_functions': {}, 'cont...
JavascriptCodePrinter
python
pytorch__pytorch
test/dynamo/test_subclasses.py
{ "start": 86822, "end": 89091 }
class ____(torch.nn.Module): def forward( self, primals_1: "Sym(s97)", # PlainAOTInput(idx=0) primals_2: "Sym(s98)", # PlainAOTInput(idx=1) primals_3: "f32[s97, s98]", # SubclassGetAttrAOTInput(base=PlainAOTInput(idx=2), attr='a') primals_4: "f32[s97, s98]", # SubclassGet...
GraphModule
python
kamyu104__LeetCode-Solutions
Python/binary-tree-postorder-traversal.py
{ "start": 1212, "end": 1768 }
class ____(object): def postorderTraversal(self, root): """ :type root: TreeNode :rtype: List[int] """ result, stack = [], [(root, False)] while stack: root, is_visited = stack.pop() if root is None: continue if is_v...
Solution2
python
scipy__scipy
benchmarks/benchmarks/sparse.py
{ "start": 6436, "end": 7239 }
class ____(Benchmark): param_names = ['sparse_type', 'num_matrices'] params = [ ['spmatrix', 'sparray'], [1000, 5000, 10000, 15000, 20000], ] def setup(self, sparse_type, num_matrices): coo = sparse.coo_array if sparse_type == "sparray" else sparse.coo_matrix self.matric...
BlockDiagDenseConstruction
python
pytorch__pytorch
test/distributed/test_c10d_gloo.py
{ "start": 6423, "end": 6830 }
class ____(TestCase): @retry_on_connect_failures def test_tcp_init(self): rendezvous_iterator = dist.rendezvous("tcp://127.0.0.1:0", rank=0, world_size=1) store, rank, world_size = next(rendezvous_iterator) self.assertEqual(rank, 0) self.assertEqual(world_size, 1) # port ...
RendezvousTCPTest
python
doocs__leetcode
solution/0100-0199/0139.Word Break/Solution2.py
{ "start": 0, "end": 374 }
class ____: def __init__(self): self.children: List[Trie | None] = [None] * 26 self.isEnd = False def insert(self, w: str): node = self for c in w: idx = ord(c) - ord('a') if not node.children[idx]: node.children[idx] = Trie() ...
Trie
python
joke2k__faker
tests/providers/test_bank.py
{ "start": 16595, "end": 16956 }
class ____: """Test base bank provider""" def test_bank_not_implemented_error(self, faker): """Test that bank() raises AttributeError when no banks attribute exists""" provider = BankProvider(faker) assert not hasattr(provider, "banks") with pytest.raises(AttributeError): ...
TestBaseBankProvider
python
aio-libs__aiohttp
aiohttp/connector.py
{ "start": 28770, "end": 58395 }
class ____(BaseConnector): """TCP connector. verify_ssl - Set to True to check ssl certifications. fingerprint - Pass the binary sha256 digest of the expected certificate in DER format to verify that the certificate the server presents matches. See also https://en.wikipedia.org/wiki...
TCPConnector
python
ansible__ansible
test/lib/ansible_test/_internal/cli/parsers/base_argument_parsers.py
{ "start": 247, "end": 773 }
class ____(NamespaceParser, metaclass=abc.ABCMeta): """Base class for controller namespace parsers.""" @property def dest(self) -> str: """The name of the attribute where the value should be stored.""" return 'controller' def parse(self, state: ParserState) -> t.Any: """Parse t...
ControllerNamespaceParser
python
pytorch__pytorch
torch/testing/_internal/common_utils.py
{ "start": 23811, "end": 24548 }
class ____: """ Explicit subtest case for use with test parametrization. Allows for explicit naming of individual subtest cases as well as applying decorators to the parametrized test. Args: arg_values (iterable): Iterable of arg values (e.g. range(10)) or tuples of arg values (...
subtest
python
openai__openai-python
src/openai/resources/realtime/calls.py
{ "start": 32531, "end": 33169 }
class ____: def __init__(self, calls: AsyncCalls) -> None: self._calls = calls self.create = async_to_custom_streamed_response_wrapper( calls.create, AsyncStreamedBinaryAPIResponse, ) self.accept = async_to_streamed_response_wrapper( calls.accept,...
AsyncCallsWithStreamingResponse
python
huggingface__transformers
tests/models/glm4/test_modeling_glm4.py
{ "start": 1145, "end": 1272 }
class ____(CausalLMModelTester): if is_torch_available(): base_model_class = Glm4Model @require_torch
Glm4ModelTester
python
anthropics__anthropic-sdk-python
src/anthropic/resources/beta/skills/versions.py
{ "start": 12176, "end": 23102 }
class ____(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncVersionsWithRawResponse: """ This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.g...
AsyncVersions
python
mlflow__mlflow
mlflow/store/tracking/dbmodels/models.py
{ "start": 48046, "end": 54858 }
class ____(Base): """ DB model for evaluation dataset records. """ __tablename__ = "evaluation_dataset_records" RECORD_ID_PREFIX = "dr-" dataset_record_id = Column(String(36), primary_key=True) """ Dataset record ID: `String` (limit 36 characters). *Primary Key* for ``evaluation_da...
SqlEvaluationDatasetRecord
python
dagster-io__dagster
python_modules/dagster/dagster/_core/secrets/loader.py
{ "start": 180, "end": 415 }
class ____(ABC, MayHaveInstanceWeakref[T_DagsterInstance]): @abstractmethod def get_secrets_for_environment(self, location_name: Optional[str]) -> Mapping[str, str]: pass def dispose(self): return
SecretsLoader
python
apache__airflow
providers/edge3/src/airflow/providers/edge3/models/edge_logs.py
{ "start": 1224, "end": 3022 }
class ____(Base, LoggingMixin): """ Temporary collected logs from a Edge Worker while job runs on remote site. As the Edge Worker in most cases has a local file system and the web UI no access to read files from remote site, Edge Workers will send incremental chunks of logs of running jobs to the c...
EdgeLogsModel
python
pytorch__pytorch
torch/_inductor/ir.py
{ "start": 260226, "end": 262020 }
class ____(ExternKernel): """ This needs to be a custom class to handle mutation properly. This class handles both aten.scatter_ and aten.scatter_reduce_. It also handle the case `src` being a scalar properly. """ def codegen(self, wrapper: PythonWrapperCodegen) -> None: wrapper.generat...
ScatterFallback
python
django__django
tests/utils_tests/test_module_loading.py
{ "start": 5968, "end": 8451 }
class ____(SimpleTestCase): def tearDown(self): sys.path_importer_cache.clear() sys.modules.pop("utils_tests.test_module.another_bad_module", None) sys.modules.pop("utils_tests.test_module.another_good_module", None) sys.modules.pop("utils_tests.test_module.bad_module", None) ...
AutodiscoverModulesTestCase
python
pyca__cryptography
tests/hazmat/primitives/test_rsa.py
{ "start": 94819, "end": 101209 }
class ____: @pytest.mark.parametrize( ("key_path", "loader_func", "encoding", "format"), [ ( os.path.join("asymmetric", "public", "PKCS1", "rsa.pub.pem"), serialization.load_pem_public_key, serialization.Encoding.PEM, serial...
TestRSAPEMPublicKeySerialization
python
numba__numba
numba/tests/test_listobject.py
{ "start": 2257, "end": 3120 }
class ____(MemoryLeakMixin, TestCase): def test_list_allocation(self): @njit def foo_kwarg(n): l = listobject.new_list(int32, allocated=n) return l._allocated() for i in range(16): self.assertEqual(foo_kwarg(i), i) @njit def foo_posarg(n...
TestAllocation
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 572711, "end": 573107 }
class ____(sgqlc.types.Type): """An edge in a connection.""" __schema__ = github_schema __field_names__ = ("cursor", "node") cursor = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name="cursor") """A cursor for use in pagination.""" node = sgqlc.types.Field("DeploymentReview", graphq...
DeploymentReviewEdge
python
huggingface__transformers
tests/models/convnext/test_modeling_convnext.py
{ "start": 5648, "end": 9507 }
class ____(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): """ Here we also overwrite some of the tests of test_modeling_common.py, as ConvNext does not use input_ids, inputs_embeds, attention_mask and seq_length. """ all_model_classes = ( ( ConvNextModel, ...
ConvNextModelTest
python
pallets__quart
src/quart/asgi.py
{ "start": 13769, "end": 15720 }
class ____: def __init__(self, app: Quart, scope: LifespanScope) -> None: self.app = app async def __call__( self, receive: ASGIReceiveCallable, send: ASGISendCallable ) -> None: while True: event = await receive() if event["type"] == "lifespan.startup": ...
ASGILifespan
python
PyCQA__pylint
tests/functional/a/assigning/assigning_non_slot.py
{ "start": 3232, "end": 3483 }
class ____: __slots__ = [] def release(self): self.__class__ = ClassWithSlots # [assigning-non-slot] self.test = 'test' # [assigning-non-slot] # pylint: disable=attribute-defined-outside-init
ClassReassingingInvalidLayoutClass
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/forLoop1.py
{ "start": 1158, "end": 1365 }
class ____: def __init__(self): self.__iter__ = lambda: iter([]) # This should generate an error because A # is not iterable. The __iter__ method is an # instance variable. for a in A(): ...
A
python
PrefectHQ__prefect
src/prefect/server/schemas/filters.py
{ "start": 2354, "end": 2950 }
class ____(PrefectFilterBaseModel): """Base model for Prefect filters that combines criteria with a user-provided operator""" operator: Operator = Field( default=Operator.and_, description="Operator for combining filter criteria. Defaults to 'and_'.", ) @db_injector def as_sql_filt...
PrefectOperatorFilterBaseModel
python
openai__openai-python
src/openai/lib/_tools.py
{ "start": 344, "end": 815 }
class ____(Dict[str, Any]): """Dictionary wrapper so we can pass the given base model throughout the entire request stack without having to special case it. """ model: type[pydantic.BaseModel] def __init__(self, defn: FunctionDefinition, model: type[pydantic.BaseModel]) -> None: super(...
PydanticFunctionTool
python
python__mypy
mypy/stubutil.py
{ "start": 21871, "end": 33478 }
class ____: # These names should be omitted from generated stubs. IGNORED_DUNDERS: Final = { "__all__", "__author__", "__about__", "__copyright__", "__email__", "__license__", "__summary__", "__title__", "__uri__", "__str__", ...
BaseStubGenerator
python
pyinstaller__pyinstaller
PyInstaller/lib/modulegraph/modulegraph.py
{ "start": 21023, "end": 22678 }
class ____(Node): """ Graph node representing the aliasing of an existing source module under a non-existent target module name (i.e., the desired alias). """ def __init__(self, name, node=None): """ Initialize this alias. Parameters ---------- name : str ...
AliasNode
python
ray-project__ray
python/ray/data/tests/test_namespace_expressions.py
{ "start": 21949, "end": 22321 }
class ____: """Tests for proper error handling.""" def test_list_invalid_index_type(self): """Test list bracket notation rejects invalid types.""" with pytest.raises(TypeError, match="List indices must be integers or slices"): col("items").list["invalid"] if __name__ == "__main__...
TestNamespaceErrors
python
getsentry__sentry
src/sentry/api/serializers/models/dashboard.py
{ "start": 1963, "end": 2135 }
class ____(TypedDict): orderby: list[dict[str, str]] | None equations: list[dict[str, str | list[str]]] | None selected_columns: list[str]
WidgetChangedReasonType
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/dialects/oracle/vector.py
{ "start": 891, "end": 1603 }
class ____(Enum): """Enum representing different types of vector distance metrics. See :ref:`oracle_vector_datatype` for background. .. versionadded:: 2.0.41 """ EUCLIDEAN = "EUCLIDEAN" """Euclidean distance (L2 norm). Measures the straight-line distance between two vectors in space. ...
VectorDistanceType
python
pytorch__pytorch
torch/distributed/tensor/experimental/_tp_transform.py
{ "start": 2184, "end": 20437 }
class ____(PassBase): """ This pass is responsible for transforming a single-device graph into a tensor parallel graph. It will mark the OpSpec of each node in the graph, partition the graph into distributed graph, then shard the parameters/buffers accordingly. """ def __init__( self, ...
_TensorParallelTransformPass
python
google__pytype
pytype/tools/config.py
{ "start": 851, "end": 1216 }
class ____(abc.ABC): """A section of a config file.""" @classmethod @abc.abstractmethod def create_from_file( cls: type[_ConfigSectionT], filepath: str, section: str ) -> _ConfigSectionT: """Create a ConfigSection if the file at filepath has section.""" @abc.abstractmethod def items(self) -> I...
ConfigSection
python
django__django
tests/migrations/migrations_test_apps/lookuperror_a/models.py
{ "start": 101, "end": 253 }
class ____(models.Model): b2 = models.ForeignKey("lookuperror_b.B2", models.CASCADE) c2 = models.ForeignKey("lookuperror_c.C2", models.CASCADE)
A3
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 350298, "end": 351532 }
class ____(sgqlc.types.Type): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ( "git_hub_services_sha", "git_ip_addresses", "hook_ip_addresses", "importer_ip_addresses", "is_password_authentication_verifiable", "pa...
GitHubMetadata
python
scipy__scipy
scipy/integrate/tests/test_cubature.py
{ "start": 36604, "end": 37039 }
class ____(Rule): """ A rule with fake high error so that cubature will keep on subdividing. """ def estimate(self, f, a, b, args=()): xp = array_namespace(a, b) underlying = GaussLegendreQuadrature(10, xp=xp) return underlying.estimate(f, a, b, args) def estimate_error(se...
BadErrorRule
python
ray-project__ray
rllib/core/rl_module/rl_module.py
{ "start": 32188, "end": 33885 }
class ____: observation_space: gym.Space = None action_space: gym.Space = None inference_only: bool = False learner_only: bool = False model_config_dict: Dict[str, Any] = field(default_factory=dict) catalog_class: Type["Catalog"] = None def get_catalog(self) -> Optional["Catalog"]: ...
RLModuleConfig
python
google__jax
tests/pallas/triton_pallas_test.py
{ "start": 1169, "end": 1864 }
class ____(jtu.JaxTestCase): INTERPRET = False def setUp(self): if jtu.test_device_matches(["cpu"]): if not self.INTERPRET: self.skipTest("On CPU the test works only in interpret mode") elif jtu.test_device_matches(["gpu"]): if not jtu.is_cuda_compute_capability_at_least("9.0"): ...
PallasBaseTest
python
huggingface__transformers
src/transformers/models/splinter/tokenization_splinter.py
{ "start": 1368, "end": 7787 }
class ____(TokenizersBackend): r""" Construct a Splinter tokenizer (backed by HuggingFace's tokenizers library). Based on WordPiece. This tokenizer inherits from [`TokenizersBackend`] which contains most of the main methods. Users should refer to this superclass for more information regarding those met...
SplinterTokenizer
python
anthropics__anthropic-sdk-python
src/anthropic/types/cache_creation.py
{ "start": 150, "end": 407 }
class ____(BaseModel): ephemeral_1h_input_tokens: int """The number of input tokens used to create the 1 hour cache entry.""" ephemeral_5m_input_tokens: int """The number of input tokens used to create the 5 minute cache entry."""
CacheCreation
python
PyCQA__pylint
doc/data/messages/u/useless-parent-delegation/good.py
{ "start": 73, "end": 198 }
class ____(Animal): """There is no need to override 'eat' it has the same signature as the implementation in Animal."""
Human
python
astropy__astropy
astropy/cosmology/_src/flrw/w0wzcdm.py
{ "start": 543, "end": 6728 }
class ____(FLRW): """FLRW cosmology with a variable dark energy EoS and curvature. The equation for the dark energy equation of state (EoS) uses the simple form: :math:`w(z) = w_0 + w_z z`. This form is not recommended for z > 1. Parameters ---------- H0 : float or scalar quantity-like ['...
w0wzCDM
python
HypothesisWorks__hypothesis
hypothesis-python/tests/django/toystore/forms.py
{ "start": 4036, "end": 4096 }
class ____(ReprForm): _url = forms.URLField()
URLFieldForm
python
huggingface__transformers
tests/models/squeezebert/test_modeling_squeezebert.py
{ "start": 11466, "end": 12065 }
class ____(unittest.TestCase): @slow def test_inference_classification_head(self): model = SqueezeBertForSequenceClassification.from_pretrained("squeezebert/squeezebert-mnli") input_ids = torch.tensor([[1, 29414, 232, 328, 740, 1140, 12695, 69, 13, 1588, 2]]) output = model(input_ids)[0...
SqueezeBertModelIntegrationTest
python
scipy__scipy
scipy/interpolate/_fitpack_repro.py
{ "start": 19409, "end": 23127 }
class ____: """ The r.h.s. of ``f(p) = s``. Given scalar `p`, we solve the system of equations in the LSQ sense: | A | @ | c | = | y | | B / p | | 0 | | 0 | where `A` is the matrix of b-splines and `b` is the discontinuity matrix (the jumps of the k-th derivatives of b-splin...
F
python
django__django
tests/model_inheritance_regress/models.py
{ "start": 1134, "end": 1185 }
class ____(ParkingLot4, Place): pass
ParkingLot4A
python
walkccc__LeetCode
solutions/1526. Minimum Number of Increments on Subarrays to Form a Target Array/1526.py
{ "start": 0, "end": 190 }
class ____: def minNumberOperations(self, target: list[int]) -> int: ans = target[0] for a, b in zip(target, target[1:]): if a < b: ans += b - a return ans
Solution
python
mlflow__mlflow
tests/crewai/test_crewai_autolog.py
{ "start": 2736, "end": 4535 }
class ____(int): def __eq__(self, other): return isinstance(other, int) ANY_INT = AnyInt() # CrewAI >= 0.175.0 changed behavior: TaskOutput.name falls back to description when None # See: https://github.com/crewAIInc/crewAI/pull/3382 _CREWAI_VERSION = Version(crewai.__version__) _TASK_DESCRIPTION = "Anal...
AnyInt
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 352411, "end": 353369 }
class ____(sgqlc.types.Interface): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ( "email", "is_valid", "payload", "signature", "signer", "state", "was_signed_by_git_hub", ) email = sgqlc.types.Fi...
GitSignature
python
sdispater__pendulum
src/pendulum/datetime.py
{ "start": 1455, "end": 42361 }
class ____(datetime.datetime, Date): EPOCH: ClassVar[DateTime] min: ClassVar[DateTime] max: ClassVar[DateTime] # Formats _FORMATS: ClassVar[dict[str, str | Callable[[datetime.datetime], str]]] = { "atom": ATOM, "cookie": COOKIE, "iso8601": lambda dt: dt.isoformat("T"), ...
DateTime
python
python__mypy
mypyc/test-data/fixtures/ir.py
{ "start": 3085, "end": 5312 }
class ____: @overload def __init__(self) -> None: pass @overload def __init__(self, x: object) -> None: pass def __add__(self, x: str) -> str: pass def __mul__(self, x: int) -> str: pass def __rmul__(self, x: int) -> str: pass def __eq__(self, x: object) -> bool: pass def __ne__(self...
str
python
apache__airflow
providers/google/tests/unit/google/cloud/hooks/test_cloud_build.py
{ "start": 12832, "end": 14469 }
class ____: @pytest.fixture def hook(self): return CloudBuildAsyncHook( gcp_conn_id="google_cloud_default", ) @pytest.mark.asyncio @mock.patch(CLOUD_BUILD_PATH.format("CloudBuildAsyncHook.get_credentials")) @mock.patch(CLOUD_BUILD_PATH.format("CloudBuildAsyncClient.get_b...
TestAsyncHook
python
pappasam__jedi-language-server
jedi_language_server/initialization_options.py
{ "start": 906, "end": 1048 }
class ____: enable: bool = True did_open: bool = True did_save: bool = True did_change: bool = True @light_dataclass
Diagnostics
python
celery__celery
t/smoke/tests/quorum_queues/test_quorum_queues.py
{ "start": 269, "end": 1035 }
class ____: def test_queue_type(self, celery_setup: CeleryTestSetup): broker: RabbitMQManagementBroker = celery_setup.broker api = broker.get_management_url() + "/api/queues" response = requests.get(api, auth=HTTPBasicAuth("guest", "guest")) assert response.status_code == 200 ...
test_broker_configuration
python
getsentry__sentry
tests/sentry/search/eap/test_ourlogs.py
{ "start": 605, "end": 13577 }
class ____(TestCase): def setUp(self) -> None: self.resolver = SearchResolver( params=SnubaParams(), config=SearchResolverConfig(), definitions=OURLOG_DEFINITIONS ) def test_freetext_search_query(self) -> None: where, having, _ = self.resolver.resolve_query("foo") as...
SearchResolverQueryTest
python
getsentry__sentry
src/sentry/integrations/analytics.py
{ "start": 955, "end": 1129 }
class ____(analytics.Event): provider: str id: int organization_id: int @analytics.eventclass("integration.issue.assignee.synced")
IntegrationIssueStatusSyncedEvent
python
falconry__falcon
tests/test_httpstatus.py
{ "start": 1718, "end": 1956 }
class ____: def on_get(self, req, resp): resp.status_code = 500 resp.set_header('X-Failed', 'True') resp.text = 'Fail' def on_patch(self, req, resp): raise HTTPStatus(200, text=None)
TestHookResource
python
allegroai__clearml
clearml/backend_api/session/jsonmodels/fields.py
{ "start": 8448, "end": 10392 }
class ____(BaseField): """Field for embedded models.""" def __init__( self, model_types: Union[List[Union[str, Type]], Tuple[Union[str, Type]]], *args: Any, **kwargs: Any, ) -> None: self._assign_model_types(model_types) super(EmbeddedField, self).__init__(*a...
EmbeddedField
python
protocolbuffers__protobuf
python/google/protobuf/internal/type_checkers.py
{ "start": 8724, "end": 8902 }
class ____(IntValueChecker): # We're sure to use ints instead of longs here since comparison may be more # efficient. _MIN = -2147483648 _MAX = 2147483647
Int32ValueChecker
python
jmcnamara__XlsxWriter
xlsxwriter/test/xmlwriter/test_xmlwriter.py
{ "start": 301, "end": 5009 }
class ____(unittest.TestCase): """ Test the XML Writer class. """ def setUp(self): self.fh = StringIO() self.writer = XMLwriter() self.writer._set_filehandle(self.fh) def test_xml_declaration(self): """Test _xml_declaration()""" self.writer._xml_declaratio...
TestXMLwriter
python
allegroai__clearml
clearml/backend_api/services/v2_9/tasks.py
{ "start": 160937, "end": 162784 }
class ____(Response): """ Response of tasks.edit endpoint. :param updated: Number of tasks updated (0 or 1) :type updated: int :param fields: Updated fields names and values :type fields: dict """ _service = "tasks" _action = "edit" _version = "2.9" _schema = { "def...
EditResponse
python
getsentry__sentry
tests/sentry_plugins/pivotal/test_pivotal_plugin.py
{ "start": 274, "end": 2106 }
class ____(PluginTestCase): @cached_property def plugin(self) -> PivotalPlugin: return PivotalPlugin() def test_get_issue_label(self) -> None: group = self.create_group(message="Hello world", culprit="foo.bar") assert self.plugin.get_issue_label(group, "1") == "#1" def test_get...
PivotalPluginTest
python
pypa__pip
src/pip/_vendor/pkg_resources/__init__.py
{ "start": 4395, "end": 8335 }
class ____(RuntimeWarning): """ Used when there is an issue with a version or specifier not complying with PEP 440. """ parse_version = _packaging_version.Version _state_vars: dict[str, str] = {} def _declare_state(vartype: str, varname: str, initial_value: _T) -> _T: _state_vars[varname] = va...
PEP440Warning
python
run-llama__llama_index
llama-index-integrations/embeddings/llama-index-embeddings-fireworks/llama_index/embeddings/fireworks/base.py
{ "start": 502, "end": 2547 }
class ____(OpenAIEmbedding): """ Fireworks class for embeddings. Args: model (str): Model for embedding. Defaults to "nomic-ai/nomic-embed-text-v1.5" """ additional_kwargs: Dict[str, Any] = Field( default_factory=dict, description="Additional kwargs for the OpenAI API....
FireworksEmbedding
python
pydantic__pydantic
tests/mypy/modules/plugin_fail.py
{ "start": 4185, "end": 4368 }
class ____: name: str slug: Optional[str] description: Optional[str] p = AddProject(name='x', slug='y', description='z') # Same as Model, but with frozen = True
AddProject
python
falconry__falcon
falcon/errors.py
{ "start": 61623, "end": 64288 }
class ____(HTTPError): """431 Request Header Fields Too Large. The 431 status code indicates that the server is unwilling to process the request because its header fields are too large. The request MAY be resubmitted after reducing the size of the request header fields. It can be used both when t...
HTTPRequestHeaderFieldsTooLarge
python
spack__spack
lib/spack/spack/install_test.py
{ "start": 29271, "end": 41579 }
class ____: """The class that manages specs for ``spack test run`` execution.""" def __init__(self, specs: Iterable[Spec], alias: Optional[str] = None) -> None: # copy so that different test suites have different package objects # even if they contain the same spec self.specs = [spec.co...
TestSuite
python
google__pytype
pytype/pytd/pytd.py
{ "start": 6947, "end": 7084 }
class ____(enum.Enum): METHOD = 'method' STATICMETHOD = 'staticmethod' CLASSMETHOD = 'classmethod' PROPERTY = 'property'
MethodKind
python
TheAlgorithms__Python
web_programming/instagram_crawler.py
{ "start": 592, "end": 4274 }
class ____: """ Class Instagram crawl instagram user information Usage: (doctest failing on GitHub Actions) # >>> instagram_user = InstagramUser("github") # >>> instagram_user.is_verified True # >>> instagram_user.biography 'Built for developers.' """ def __init__(self, usernam...
InstagramUser
python
zarr-developers__zarr-python
src/zarr/core/buffer/gpu.py
{ "start": 3713, "end": 7776 }
class ____(core.NDBuffer): """A n-dimensional memory block on the GPU We use NDBuffer throughout Zarr to represent a n-dimensional memory block. A NDBuffer is backed by an underlying ndarray-like instance that represents the memory. The memory type is unspecified; can be regular host memory, CUDA ...
NDBuffer
python
patrick-kidger__equinox
equinox/nn/_attention.py
{ "start": 2682, "end": 14017 }
class ____(Module): r""" Computes $$\text{MultiheadAttention}(Q, K, V) = \sum_i \text{Attention}\left(QW^Q_i, KW^K_i, VW^V_i\right)W^O_i$$ where: - The inputs are $Q \in \mathbb{R}^{d_\text{seq} \times d_\text{query}}$, $K \in \mathbb{R}^{d_\text{seq} \times d_\text{key}}$, ...
MultiheadAttention
python
apache__airflow
task-sdk/src/airflow/sdk/definitions/asset/decorators.py
{ "start": 6756, "end": 8328 }
class ____: """ Common class for things that take Dag-like arguments. This exists so we don't need to define these arguments separately for ``@asset`` and ``@asset.multi``. """ schedule: ScheduleArg is_paused_upon_creation: bool | None = None dag_id: str | None = None dag_display_...
_DAGFactory
python
django-import-export__django-import-export
tests/core/tests/test_instance_loaders.py
{ "start": 860, "end": 1802 }
class ____(TestCase): def setUp(self): self.resource = resources.modelresource_factory(Book)() self.dataset = tablib.Dataset(headers=["id", "name", "author_email"]) self.book = Book.objects.create(name="Some book") self.book2 = Book.objects.create(name="Some other book") row ...
CachedInstanceLoaderTest