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
python-jsonschema__jsonschema
jsonschema/tests/_suite.py
{ "start": 5752, "end": 8374 }
class ____: version: Version subject: str case_description: str description: str data: Any schema: Mapping[str, Any] | bool valid: bool _remotes: referencing.jsonschema.SchemaRegistry comment: str | None = None def __repr__(self): # pragma: no cover return f"<Test...
_Test
python
ApeWorX__ape
src/ape/exceptions.py
{ "start": 11489, "end": 12270 }
class ____(NetworkError): """ Raised when the ecosystem with the given name was not found. """ def __init__(self, ecosystem: str, options: Optional[Collection[str]] = None): self.ecosystem = ecosystem self.options = options message = f"No ecosystem named '{ecosystem}'." ...
EcosystemNotFoundError
python
spyder-ide__spyder
spyder/plugins/editor/panels/classfunctiondropdown.py
{ "start": 662, "end": 8287 }
class ____(Panel): """ Class and Function/Method Dropdowns Widget. Parameters ---------- editor : :class:`spyder.plugins.editor.widgets.codeeditor.CodeEditor` The editor to act on. """ def __init__(self): super().__init__() # Internal data self._tree = Inte...
ClassFunctionDropdown
python
h5py__h5py
h5py/_hl/base.py
{ "start": 13053, "end": 13826 }
class ____(Mapping): """ Wraps a Group, AttributeManager or DimensionManager object to provide an immutable mapping interface. We don't inherit directly from MutableMapping because certain subclasses, for example DimensionManager, are read-only. """ def keys(self): ...
MappingHDF5
python
django__django
tests/m2m_through/models.py
{ "start": 3386, "end": 3673 }
class ____(models.Model): name = models.CharField(max_length=5) subordinates = models.ManyToManyField( "self", through="Relationship", through_fields=("source", "target"), symmetrical=False, ) class Meta: ordering = ("pk",)
Employee
python
openai__gym
gym/envs/mujoco/half_cheetah_v4.py
{ "start": 191, "end": 13251 }
class ____(MujocoEnv, utils.EzPickle): """ ### Description This environment is based on the work by P. Wawrzyński in ["A Cat-Like Robot Real-Time Learning to Run"](http://staff.elka.pw.edu.pl/~pwawrzyn/pub-s/0812_LSCLRR.pdf). The HalfCheetah is a 2-dimensional robot consisting of 9 links and 8 ...
HalfCheetahEnv
python
pytorch__pytorch
benchmarks/tensorexpr/softmax.py
{ "start": 48, "end": 1370 }
class ____(benchmark.Benchmark): def __init__(self, mode, device, dtype, M, N): super().__init__(mode, device, dtype) self.M = M self.N = N self.dtype = dtype self.inputs = [ self.randn( [M, N], device=device, dtype=dtype, requires_grad=self.requir...
SoftmaxBench
python
pypa__packaging
src/packaging/version.py
{ "start": 4763, "end": 12622 }
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
openai__gym
gym/envs/box2d/bipedal_walker.py
{ "start": 2418, "end": 27451 }
class ____(gym.Env, EzPickle): """ ### Description This is a simple 4-joint walker robot environment. There are two versions: - Normal, with slightly uneven terrain. - Hardcore, with ladders, stumps, pitfalls. To solve the normal version, you need to get 300 points in 1600 time steps. T...
BipedalWalker
python
getsentry__sentry
src/sentry/analytics/events/eventuser_snuba_query.py
{ "start": 78, "end": 306 }
class ____(analytics.Event): project_ids: list[int] query: str query_try: int count_rows_returned: int count_rows_filtered: int query_time_ms: int analytics.register(EventUserSnubaQuery)
EventUserSnubaQuery
python
tiangolo__fastapi
fastapi/dependencies/models.py
{ "start": 638, "end": 3004 }
class ____: path_params: List[ModelField] = field(default_factory=list) query_params: List[ModelField] = field(default_factory=list) header_params: List[ModelField] = field(default_factory=list) cookie_params: List[ModelField] = field(default_factory=list) body_params: List[ModelField] = field(defau...
Dependant
python
huggingface__transformers
src/transformers/models/eomt/modular_eomt.py
{ "start": 17852, "end": 25509 }
class ____(Mask2FormerForUniversalSegmentation): def __init__(self, config: EomtConfig): PreTrainedModel.__init__(self, config) self.config = config self.num_hidden_layers = config.num_hidden_layers self.embeddings = EomtEmbeddings(config) self.layernorm = nn.LayerNorm(config...
EomtForUniversalSegmentation
python
getsentry__sentry
tests/sentry/event_manager/grouping/test_seer_grouping.py
{ "start": 1469, "end": 7396 }
class ____(TestCase): """Test whether Seer is called during ingest and if so, how the results are used""" def test_obeys_seer_similarity_flags(self) -> None: existing_event = save_new_event({"message": "Dogs are great!"}, self.project) assert existing_event.group_id seer_result_data = S...
SeerEventManagerGroupingTest
python
pypa__pip
src/pip/_internal/utils/logging.py
{ "start": 7377, "end": 12108 }
class ____(Filter): """ A logging Filter that excludes records from a logger (or its children). """ def filter(self, record: logging.LogRecord) -> bool: # The base Filter class allows only records from a logger (or its # children). return not super().filter(record) def setup_l...
ExcludeLoggerFilter
python
tensorflow__tensorflow
tensorflow/python/keras/saving/utils_v1/export_output.py
{ "start": 13287, "end": 13656 }
class ____(_SupervisedOutput): """Represents the output of a supervised training process. This class generates the appropriate signature def for exporting training output by type-checking and wrapping loss, predictions, and metrics values. """ def _get_signature_def_fn(self): return unexported_signatu...
TrainOutput
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/orm/evaluator.py
{ "start": 943, "end": 1108 }
class ____(operators.ColumnOperators): def operate(self, *arg, **kw): return None def reverse_operate(self, *arg, **kw): return None
_NoObject
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_chartsheet04.py
{ "start": 315, "end": 1428 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("chartsheet04.xlsx") def test_create_file(self): """Test the worksheet properties of an XlsxWriter chartsheet file.""" workbook = W...
TestCompareXLSXFiles
python
pytorch__pytorch
torchgen/model.py
{ "start": 103577, "end": 106289 }
class ____: name: BaseOperatorName overload_name: str @staticmethod def parse(op_name: str) -> OperatorName: if "." in op_name: name, overload_name = op_name.split(".", 1) else: name = op_name overload_name = "" r = OperatorName(name=BaseOpera...
OperatorName
python
pytorch__pytorch
torch/_functorch/fx_minifier.py
{ "start": 450, "end": 564 }
class ____: size: list[int] stride: list[int] dtype: torch.dtype device: torch.device
LoadTensorMeta
python
matplotlib__matplotlib
lib/matplotlib/cbook.py
{ "start": 20652, "end": 25597 }
class ____: """ Stack of elements with a movable cursor. Mimics home/back/forward in a web browser. """ def __init__(self): self._pos = -1 self._elements = [] def clear(self): """Empty the stack.""" self._pos = -1 self._elements = [] def __call__(s...
_Stack
python
django__django
django/contrib/postgres/aggregates/statistics.py
{ "start": 1339, "end": 1397 }
class ____(StatAggregate): function = "REGR_SXX"
RegrSXX
python
astropy__astropy
astropy/modeling/tests/test_parameters.py
{ "start": 26638, "end": 28226 }
class ____: def setup_class(self): self.x1 = np.arange(1, 10, 0.1) self.y, self.x = np.mgrid[:10, :7] self.x11 = np.array([self.x1, self.x1]).T self.gmodel = models.Gaussian1D( [12, 10], [3.5, 5.2], stddev=[0.4, 0.7], n_models=2 ) def test_change_par(self): ...
TestMultipleParameterSets
python
tensorflow__tensorflow
tensorflow/python/ops/numpy_ops/np_utils.py
{ "start": 7582, "end": 7641 }
class ____: def __init__(self, v): self.value = v
Link
python
ansible__ansible
lib/ansible/_internal/_templating/_lazy_containers.py
{ "start": 15778, "end": 22616 }
class ____(_AnsibleTaggedList, _AnsibleLazyTemplateMixin): __slots__ = _AnsibleLazyTemplateMixin._SLOTS def __init__(self, contents: t.Iterable | _LazyValueSource, /) -> None: if isinstance(contents, _AnsibleLazyTemplateList): super().__init__(list.__iter__(contents)) elif isinstanc...
_AnsibleLazyTemplateList
python
pytorch__pytorch
torch/_export/db/examples/nested_function.py
{ "start": 41, "end": 491 }
class ____(torch.nn.Module): """ Nested functions are traced through. Side effects on global captures are not supported though. """ def forward(self, a, b): x = a + b z = a - b def closure(y): nonlocal x x += 1 return x * y + z r...
NestedFunction
python
google__pytype
pytype/pyi/types.py
{ "start": 2008, "end": 2093 }
class ____: # pylint: disable=redefined-builtin pass @dataclasses.dataclass
Ellipsis
python
huggingface__transformers
src/transformers/models/segformer/image_processing_segformer.py
{ "start": 2091, "end": 22482 }
class ____(BaseImageProcessor): r""" Constructs a Segformer image processor. Args: do_resize (`bool`, *optional*, defaults to `True`): Whether to resize the image's (height, width) dimensions to the specified `(size["height"], size["width"])`. Can be overridden by the `do_re...
SegformerImageProcessor
python
openai__openai-python
src/openai/types/beta/thread.py
{ "start": 633, "end": 936 }
class ____(BaseModel): vector_store_ids: Optional[List[str]] = None """ The [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) attached to this thread. There can be a maximum of 1 vector store attached to the thread. """
ToolResourcesFileSearch
python
mlflow__mlflow
mlflow/utils/search_utils.py
{ "start": 40943, "end": 47357 }
class ____(SearchUtils): VALID_SEARCH_ATTRIBUTE_KEYS = {"name", "creation_time", "last_update_time"} VALID_ORDER_BY_ATTRIBUTE_KEYS = {"name", "experiment_id", "creation_time", "last_update_time"} NUMERIC_ATTRIBUTES = {"creation_time", "last_update_time"} @classmethod def _invalid_statement_token_se...
SearchExperimentsUtils
python
openai__gym
gym/wrappers/time_limit.py
{ "start": 103, "end": 2526 }
class ____(gym.Wrapper): """This wrapper will issue a `truncated` signal if a maximum number of timesteps is exceeded. If a truncation is not defined inside the environment itself, this is the only place that the truncation signal is issued. Critically, this is different from the `terminated` signal that o...
TimeLimit
python
langchain-ai__langchain
libs/partners/huggingface/langchain_huggingface/embeddings/huggingface.py
{ "start": 353, "end": 6439 }
class ____(BaseModel, Embeddings): """HuggingFace sentence_transformers embedding models. To use, you should have the `sentence_transformers` python package installed. Example: ```python from langchain_huggingface import HuggingFaceEmbeddings model_name = "sentence-transformers/al...
HuggingFaceEmbeddings
python
ray-project__ray
python/ray/serve/_private/common.py
{ "start": 29765, "end": 30363 }
class ____: bundles: List[Dict[str, float]] strategy: str target_node_id: str name: str runtime_env: Optional[str] = None # This error is used to raise when a by-value DeploymentResponse is converted to an # ObjectRef. OBJ_REF_NOT_SUPPORTED_ERROR = RuntimeError( "Converting by-value Deployment...
CreatePlacementGroupRequest
python
falconry__falcon
tests/test_utils.py
{ "start": 48021, "end": 52225 }
class ____: class CustomContextType(structures.Context): def __init__(self): pass @pytest.mark.parametrize( 'context_type', [ CustomContextType, structures.Context, ], ) def test_attributes(self, context_type): ctx = context_ty...
TestContextType
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 835988, "end": 836384 }
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("PinnedDiscussion", graphq...
PinnedDiscussionEdge
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/typeNarrowingIsinstance1.py
{ "start": 287, "end": 399 }
class ____: class_var1: int def __init__(self) -> None: self.property: None = None
UnrelatedClass
python
django__django
django/db/models/query.py
{ "start": 83900, "end": 84052 }
class ____(type): def __instancecheck__(self, instance): return isinstance(instance, QuerySet) and instance.query.is_empty()
InstanceCheckMeta
python
sqlalchemy__sqlalchemy
examples/versioned_history/test_versioning.py
{ "start": 29901, "end": 30038 }
class ____(TestVersioningNewBase, unittest.TestCase): pass if __name__ == "__main__": unittest.main()
TestVersioningNewBaseUnittest
python
pytorch__pytorch
torch/distributed/fsdp/api.py
{ "start": 18826, "end": 18975 }
class ____: state_dict_type: StateDictType state_dict_config: StateDictConfig optim_state_dict_config: OptimStateDictConfig
StateDictSettings
python
kamyu104__LeetCode-Solutions
Python/closest-binary-search-tree-value-ii.py
{ "start": 33, "end": 1916 }
class ____(object): def closestKValues(self, root, target, k): """ :type root: TreeNode :type target: float :type k: int :rtype: List[int] """ # Helper to make a stack to the next node. def nextNode(stack, child1, child2): if stack: ...
Solution
python
django__django
tests/mail/custombackend.py
{ "start": 448, "end": 606 }
class ____(BaseEmailBackend): def send_messages(self, email_messages): raise ValueError("FailingEmailBackend is doomed to fail.")
FailingEmailBackend
python
modin-project__modin
asv_bench/benchmarks/benchmarks.py
{ "start": 36069, "end": 36325 }
class ____(BaseCategories): params = [get_benchmark_shapes("TimeRemoveCategories")] param_names = ["shape"] def time_remove_categories(self, shape): execute(self.ts.cat.remove_categories(self.ts.cat.categories[::2]))
TimeRemoveCategories
python
pytorch__pytorch
test/jit/test_ignorable_args.py
{ "start": 481, "end": 2334 }
class ____(JitTestCase): def test_slice_ignorable_args_for_slice(self): graph_str = """graph(): %13 : int = prim::Constant[value=0]() %10 : bool = prim::Constant[value=0]() %8 : NoneType = prim::Constant() %0 : int = prim::Constant[value=1]() %1 : ...
TestIgnorableArgs
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/logs/events.py
{ "start": 14369, "end": 15560 }
class ____(graphene.ObjectType, AssetEventMixin): class Meta: interfaces = (GrapheneMessageEvent, GrapheneStepEvent, GrapheneDisplayableEvent) name = "FailedToMaterializeEvent" materializationFailureReason = graphene.NonNull(GrapheneAssetMaterializationFailureReason) materializationFailureT...
GrapheneFailedToMaterializeEvent
python
huggingface__transformers
src/transformers/models/timesfm/modeling_timesfm.py
{ "start": 4410, "end": 5137 }
class ____(nn.Module): def __init__(self, hidden_size, eps=1e-6): """ TimesFmRMSNorm is equivalent to T5LayerNorm """ super().__init__() self.weight = nn.Parameter(torch.ones(hidden_size)) self.variance_epsilon = eps def forward(self, hidden_states): inpu...
TimesFmRMSNorm
python
spulec__freezegun
tests/test_datetimes.py
{ "start": 609, "end": 9668 }
class ____: """Temporarily change the locale.""" def __init__(self, *targets: str): self.targets = targets def __enter__(self) -> None: self.old = locale.setlocale(locale.LC_ALL) for target in self.targets: try: locale.setlocale(locale.LC_ALL, target) ...
temp_locale
python
huggingface__transformers
tests/models/mgp_str/test_modeling_mgp_str.py
{ "start": 7915, "end": 8994 }
class ____(unittest.TestCase): @slow def test_inference(self): model_name = "alibaba-damo/mgp-str-base" model = MgpstrForSceneTextRecognition.from_pretrained(model_name).to(torch_device) processor = MgpstrProcessor.from_pretrained(model_name) image = prepare_img() inputs...
MgpstrModelIntegrationTest
python
realpython__materials
top-python-game-engines/arcade/arcade_basic.py
{ "start": 458, "end": 2125 }
class ____(arcade.Window): """Main game window""" def __init__(self, width: int, height: int, title: str): """Initialize the window to a specific size Arguments: width {int} -- Width of the window height {int} -- Height of the window title {str} -- Title for...
ArcadeBasic
python
has2k1__plotnine
plotnine/themes/themeable.py
{ "start": 59479, "end": 59648 }
class ____(themeable): """ Legend key background height Parameters ---------- theme_element : float Value in points. """
legend_key_height
python
pydata__xarray
xarray/core/treenode.py
{ "start": 461, "end": 604 }
class ____(ValueError): """Raised when operation can't be completed because one node is not part of the expected tree."""
NotFoundInTreeError
python
pytorch__pytorch
torch/testing/_internal/common_quantization.py
{ "start": 77197, "end": 77682 }
class ____(torch.nn.Module): def __init__(self) -> None: super().__init__() self.sub1 = LinearReluModel() self.sub2 = QuantWrapper(TwoLayerLinearModel()) self.fc3 = QuantWrapper(torch.nn.Linear(5, 5).to(dtype=torch.float)) self.fc3.qconfig = default_qconfig self.sub2....
AnnotatedSubNestedModel
python
pytorch__pytorch
test/inductor/test_memory_planning.py
{ "start": 1008, "end": 6206 }
class ____(TestCase): device = GPU_TYPE def _generate(self, *, device): """ Generate a simple test case that has multiple simultaneously-live intermediate tensors. """ class Foo(torch.nn.Module): def forward(self, x, y, z): t0 = x.matmul(y) ...
TestMemoryPlanning
python
walkccc__LeetCode
solutions/1619. Mean of Array After Removing Some Elements/1619.py
{ "start": 0, "end": 143 }
class ____: def trimMean(self, arr: list[int]) -> float: arr.sort() offset = len(arr) // 20 return mean(arr[offset:-offset])
Solution
python
pytorch__pytorch
test/distributed/test_local_tensor.py
{ "start": 2308, "end": 10098 }
class ____(LocalTensorTestBase): world_size = 2 def test_local_tensor_dtype_consistency(self): """Test that LocalTensor enforces dtype consistency.""" device = torch.device("cpu") shape = (2, 3) inconsistent_tensors = { 0: torch.randn(shape, dtype=torch.float32, dev...
TestLocalTensorWorld2
python
dask__dask
dask/tests/test_delayed.py
{ "start": 3093, "end": 25834 }
class ____: a: int @pytest.mark.parametrize("cls", (ANonFrozenDataClass, AFrozenDataClass)) def test_delayed_with_dataclass(cls): literal = delayed(3) with_class = delayed({"data": cls(a=literal)}) def return_nested(obj): return obj["data"].a final = delayed(return_nested)(with_class) ...
AFrozenDataClass
python
PyCQA__pylint
tests/functional/ext/no_self_use/no_self_use.py
{ "start": 2923, "end": 3110 }
class ____: """Don't emit no-self-use for overload methods.""" @overload def a(self, var): ... @overload def a(self, var): ... def a(self, var): pass
Foo3
python
pydantic__pydantic
tests/mypy/outputs/mypy-plugin-strict_ini/plugin_fail.py
{ "start": 2183, "end": 2326 }
class ____(BaseModel, from_attributes={}): # MYPY: error: Invalid value for "Config.from_attributes" [pydantic-config] pass
KwargsBadConfig1
python
fsspec__filesystem_spec
fsspec/implementations/local.py
{ "start": 12584, "end": 16936 }
class ____(io.IOBase): def __init__( self, path, mode, autocommit=True, fs=None, compression=None, **kwargs ): logger.debug("open file: %s", path) self.path = path self.mode = mode self.fs = fs self.f = None self.autocommit = autocommit self.compre...
LocalFileOpener
python
networkx__networkx
networkx/algorithms/isomorphism/ismags.py
{ "start": 10241, "end": 11513 }
class ____: """Class to handle getitem for undirected edges. Note that ``items()`` iterates over one of the two representations of the edge (u, v) and (v, u). So this technically doesn't violate the Mapping invariant that (k,v) pairs reported by ``items()`` satisfy ``.__getitem__(k) == v``. But we ...
EdgeLookup
python
kamyu104__LeetCode-Solutions
Python/subarrays-with-k-different-integers.py
{ "start": 1080, "end": 1669 }
class ____(object): def subarraysWithKDistinct(self, A, K): """ :type A: List[int] :type K: int :rtype: int """ window1, window2 = Window(), Window() result, left1, left2 = 0, 0, 0 for i in A: window1.add(i) while window1.size()...
Solution2
python
run-llama__llama_index
llama-index-integrations/llms/llama-index-llms-openai/tests/test_openai_responses.py
{ "start": 24862, "end": 26444 }
class ____(OpenAIResponses): def __init__(self): pass def test__parse_response_output(response_output: List[ResponseOutputItem]): result = OpenAIResponsesMock()._parse_response_output(output=response_output) assert ( len( [ block for block in res...
OpenAIResponsesMock
python
aimacode__aima-python
csp.py
{ "start": 49880, "end": 55386 }
class ____(NaryCSP): def __init__(self, puzzle): variables = [] for i, line in enumerate(puzzle): # print line for j, element in enumerate(line): if element == '_': var1 = str(i) if len(var1) == 1: ...
Kakuro
python
jina-ai__jina
tests/unit/orchestrate/flow/flow-construct/test_flow_except.py
{ "start": 4189, "end": 4868 }
class ____(Executor): @requests def craft(self, *args, **kwargs): raise NotImplementedError @pytest.mark.parametrize('protocol', ['websocket', 'grpc', 'http']) def test_flow_on_error_callback(protocol): f = Flow(protocol=protocol).add(uses=DummyCrafterNotImplemented) hit = [] def f1(*args...
DummyCrafterNotImplemented
python
rq__rq
rq/worker.py
{ "start": 65525, "end": 71443 }
class ____(BaseWorker): def kill_horse(self, sig: signal.Signals = SHUTDOWN_SIGNAL): """Kill the horse but catch "No such process" error has the horse could already be dead. Args: sig (signal.Signals, optional): _description_. Defaults to SIGKILL. """ try: os...
Worker
python
apache__airflow
helm-tests/tests/helm_tests/apiserver/test_apiserver.py
{ "start": 3094, "end": 3622 }
class ____: """Tests API Server JWT secret.""" def test_should_add_annotations_to_jwt_secret(self): docs = render_chart( values={ "jwtSecretAnnotations": {"test_annotation": "test_annotation_value"}, }, show_only=["templates/secrets/jwt-secret.yaml"],...
TestAPIServerJWTSecret
python
walkccc__LeetCode
solutions/3530. Maximum Profit from Valid Topological Order in DAG/3530.py
{ "start": 0, "end": 1040 }
class ____: def maxProfit(self, n: int, edges: list[list[int]], score: list[int]) -> int: # need[i] := the bitmask representing all nodes that must be placed before # node i need = [0] * n # dp[mask] := the maximum profit achievable by placing the set of nodes # represented by `mask` dp = [-1]...
Solution
python
facebookresearch__faiss
tests/test_rabitq.py
{ "start": 51130, "end": 53715 }
class ____(unittest.TestCase): """Test construction and parameter validation for multi-bit RaBitQ.""" def test_valid_nb_bits_range(self): """Test that nb_bits 1-9 are valid.""" d = 128 for nb_bits in range(1, 10): for metric in [faiss.METRIC_L2, faiss.METRIC_INNER_PRODUCT]: ...
TestMultiBitRaBitQConstruction
python
huggingface__transformers
tests/models/mobilebert/test_modeling_mobilebert.py
{ "start": 14686, "end": 17682 }
class ____(unittest.TestCase): @slow def test_inference_no_head(self): model = MobileBertModel.from_pretrained("google/mobilebert-uncased", attn_implementation="eager").to( torch_device ) input_ids = _long_tensor([[101, 7110, 1005, 1056, 2023, 11333, 17413, 1029, 102]]) ...
MobileBertModelIntegrationTests
python
kubernetes-client__python
kubernetes/client/models/v1_status.py
{ "start": 383, "end": 10061 }
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...
V1Status
python
getsentry__sentry
src/sentry/issues/escalating/escalating_issues_alg.py
{ "start": 221, "end": 354 }
class ____(TypedDict): intervals: list[str] data: list[int] # standard values if no parameters are passed @dataclass
GroupCount
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/pyupgrade/UP040.py
{ "start": 695, "end": 3214 }
class ____: # reference to global variable x: typing.TypeAlias = list[T] # reference to class variable TCLS = typing.TypeVar["TCLS"] y: typing.TypeAlias = list[TCLS] # UP040 won't add generics in fix T = typing.TypeVar(*args) x: typing.TypeAlias = list[T] # `default` was added in Python 3.13 T = ...
Foo
python
mkdocs__mkdocs
mkdocs/contrib/search/__init__.py
{ "start": 1892, "end": 2209 }
class ____(base.Config): lang = c.Optional(LangOption()) separator = c.Type(str, default=r'[\s\-]+') min_search_length = c.Type(int, default=3) prebuild_index = c.Choice((False, True, 'node', 'python'), default=False) indexing = c.Choice(('full', 'sections', 'titles'), default='full')
_PluginConfig
python
cython__cython
Cython/Compiler/Optimize.py
{ "start": 87346, "end": 184440 }
class ____(Visitor.NodeRefCleanupMixin, Visitor.MethodDispatcherTransform): """Optimize some common methods calls and instantiation patterns for builtin types *after* the type analysis phase. Running after type analysis, this transform can only perform function replacements t...
OptimizeBuiltinCalls
python
huggingface__transformers
src/transformers/utils/auto_docstring.py
{ "start": 29657, "end": 32887 }
class ____: PreTrainedModel = r""" This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads etc.) This model is also a PyTorch [torch...
ClassDocstring
python
spyder-ide__spyder
external-deps/spyder-kernels/spyder_kernels/customize/spyderpdb.py
{ "start": 1025, "end": 1686 }
class ____: """ Notifies the frontend when debugging starts/stops """ def __init__(self, pdb_obj): self.pdb_obj = pdb_obj self._cleanup = True def __enter__(self): """ Debugging starts. """ shell = self.pdb_obj.shell if shell.pdb_session == se...
DebugWrapper
python
PrefectHQ__prefect
src/prefect/task_runners.py
{ "start": 18853, "end": 20045 }
class ____(concurrent.futures.Future[R]): """Wrapper for a Future that unpickles the result returned by cloudpickle_wrapped_call.""" def __init__(self, wrapped_future: concurrent.futures.Future[bytes]): self.wrapped_future = wrapped_future def result(self, timeout: float | None = None) -> R: ...
_UnpicklingFuture
python
sphinx-doc__sphinx
tests/roots/test-ext-viewcode-find-package/main_package/subpackage/_subpackage2/submodule.py
{ "start": 233, "end": 342 }
class ____: """this is Class3""" class_attr = 42 """this is the class attribute class_attr"""
Class3
python
django-haystack__django-haystack
test_haystack/whoosh_tests/test_whoosh_backend.py
{ "start": 28390, "end": 30094 }
class ____(WhooshTestCase): def setUp(self): super().setUp() self.old_ui = connections["whoosh"].get_unified_index() self.ui = UnifiedIndex() self.wmmi = WhooshBoostMockSearchIndex() self.ui.build(indexes=[self.wmmi]) self.sb = connections["whoosh"].get_backend() ...
WhooshBoostBackendTestCase
python
sympy__sympy
sympy/matrices/common.py
{ "start": 2030, "end": 4130 }
class ____(type): # # Override the default __instancecheck__ implementation to ensure that # e.g. isinstance(M, MatrixCommon) still works when M is one of the # matrix classes. Matrix no longer inherits from MatrixCommon so # isinstance(M, MatrixCommon) would now return False by default. # ...
_MatrixDeprecatedMeta
python
pytorch__pytorch
torch/ao/quantization/fx/quantize_handler.py
{ "start": 6075, "end": 6134 }
class ____(QuantizeHandler): pass
BinaryOpQuantizeHandler
python
openai__gym
gym/wrappers/normalize.py
{ "start": 3728, "end": 5712 }
class ____(gym.core.Wrapper): r"""This wrapper will normalize immediate rewards s.t. their exponential moving average has a fixed variance. The exponential moving average will have variance :math:`(1 - \gamma)^2`. Note: The scaling depends on past trajectories and rewards will not be scaled correc...
NormalizeReward
python
pyqtgraph__pyqtgraph
pyqtgraph/parametertree/ParameterSystem.py
{ "start": 162, "end": 4308 }
class ____(GroupParameter): """ ParameterSystem is a subclass of GroupParameter that manages a tree of sub-parameters with a set of interdependencies--changing any one parameter may affect other parameters in the system. See parametertree/SystemSolver for more information. NOTE: This ...
ParameterSystem
python
django__django
tests/forms_tests/tests/tests.py
{ "start": 732, "end": 906 }
class ____(ModelForm): multi_choice = CharField(max_length=50) class Meta: exclude = ["multi_choice"] model = ChoiceFieldModel
ChoiceFieldExclusionForm
python
FactoryBoy__factory_boy
factory/base.py
{ "start": 4127, "end": 13605 }
class ____: def __init__(self): self.factory = None self.base_factory = None self.base_declarations = {} self.parameters = {} self.parameters_dependencies = {} self.pre_declarations = builder.DeclarationSet() self.post_declarations = builder.DeclarationSet() ...
FactoryOptions
python
getsentry__sentry
src/sentry/utils/math.py
{ "start": 872, "end": 1226 }
class ____(MovingAverage): def __init__(self, weight: float): super().__init__() assert 0 < weight and weight < 1 self.weight = weight def update(self, n: int, avg: float, value: float) -> float: if n == 0: return value return value * self.weight + avg * (1 -...
ExponentialMovingAverage
python
ray-project__ray
python/ray/_private/ray_logging/__init__.py
{ "start": 7148, "end": 7791 }
class ____: # Timestamp of the earliest log message seen of this pattern. timestamp: int # The number of un-printed occurrances for this pattern. count: int # Latest instance of this log pattern. line: int # Latest metadata dict for this log pattern, not including the lines field. met...
DedupState
python
run-llama__llama_index
llama-index-integrations/readers/llama-index-readers-microsoft-sharepoint/llama_index/readers/microsoft_sharepoint/base.py
{ "start": 541, "end": 32622 }
class ____(BasePydanticReader, ResourcesReaderMixin, FileSystemReaderMixin): """ SharePoint reader. Reads folders from the SharePoint site from a folder under documents. Args: client_id (str): The Application ID for the app registered in Microsoft Azure Portal. The application mus...
SharePointReader
python
miyuchina__mistletoe
docs/__init__.py
{ "start": 968, "end": 2261 }
class ____(HtmlRenderer): def render_link(self, token): return super().render_link(self._replace_link(token)) def render_document(self, token, name="README.md"): pattern = "<html>{}<body>{}</body></html>" self.footnotes.update(token.footnotes) for filename, new_link in getattr(s...
DocRenderer
python
huggingface__transformers
src/transformers/models/ovis2/configuration_ovis2.py
{ "start": 733, "end": 4970 }
class ____(PreTrainedConfig): r""" This is the configuration class to store the configuration of a [`Ovis2VisionModel`]. It is used to instantiate a Ovis2VisionModel model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a ...
Ovis2VisionConfig
python
getsentry__sentry
src/sentry/web/frontend/auth_close.py
{ "start": 187, "end": 635 }
class ____(BaseView): """This is a view to handle when sentry log in has been opened from another window. This view loads an html page with a script that sends a message back to the window opener and closes the window""" def handle(self, request: HttpRequest) -> HttpResponse: logged_in = reques...
AuthCloseView
python
numpy__numpy
numpy/polynomial/tests/test_legendre.py
{ "start": 17114, "end": 18784 }
class ____: def test_legfromroots(self): res = leg.legfromroots([]) assert_almost_equal(trim(res), [1]) for i in range(1, 5): roots = np.cos(np.linspace(-np.pi, 0, 2 * i + 1)[1::2]) pol = leg.legfromroots(roots) res = leg.legval(roots, pol) tg...
TestMisc
python
django-guardian__django-guardian
guardian/models/models.py
{ "start": 4143, "end": 4403 }
class ____(UserObjectPermissionBase, BaseGenericObjectPermission): class Meta(UserObjectPermissionBase.Meta, BaseGenericObjectPermission.Meta): abstract = True unique_together = ["user", "permission", "object_pk"]
UserObjectPermissionAbstract
python
ipython__ipython
IPython/terminal/pt_inputhooks/gtk4.py
{ "start": 79, "end": 557 }
class ____: def __init__(self, context): self._quit = False GLib.io_add_watch( context.fileno(), GLib.PRIORITY_DEFAULT, GLib.IO_IN, self.quit ) def quit(self, *args, **kwargs): self._quit = True return False def run(self): context = GLib.MainCont...
_InputHook
python
ray-project__ray
rllib/callbacks/tests/test_callbacks_on_algorithm.py
{ "start": 1070, "end": 1356 }
class ____(RLlibCallback): def on_algorithm_init(self, *, algorithm, metrics_logger, **kwargs): self._on_init_was_called = True def on_checkpoint_loaded(self, *, algorithm, **kwargs): self._on_checkpoint_loaded_was_called = True
InitAndCheckpointRestoredCallbacks
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_quote_name03.py
{ "start": 315, "end": 1507 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("quote_name03.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file.""" workbook = Workbook(self.got_...
TestCompareXLSXFiles
python
getsentry__sentry
src/sentry/profiles/flamegraph.py
{ "start": 2330, "end": 28966 }
class ____: def __init__( self, *, request: HttpRequest, snuba_params: SnubaParams, data_source: Literal["functions", "transactions", "profiles", "spans"], query: str, fingerprint: int | None = None, ): self.request = request self.snuba_par...
FlamegraphExecutor
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/dialects/oracle/cx_oracle.py
{ "start": 22543, "end": 22612 }
class ____(_OracleNumericCommon, sqltypes.Float): pass
_OracleFloat
python
qdrant__qdrant-client
qdrant_client/http/api/indexes_api.py
{ "start": 4424, "end": 5421 }
class ____(_IndexesApi): def create_field_index( self, collection_name: str, wait: bool = None, ordering: WriteOrdering = None, create_field_index: m.CreateFieldIndex = None, ) -> m.InlineResponse2005: """ Create index for field in collection """ ...
SyncIndexesApi
python
streamlit__streamlit
lib/tests/streamlit/file_util_test.py
{ "start": 4968, "end": 6820 }
class ____(unittest.TestCase): def test_file_in_folder(self): # Test with and without trailing slash ret = file_util.file_is_in_folder_glob("/a/b/c/foo.py", "/a/b/c/") assert ret ret = file_util.file_is_in_folder_glob("/a/b/c/foo.py", "/a/b/c") assert ret def test_file_i...
FileIsInFolderTest
python
airbytehq__airbyte
airbyte-integrations/connectors/source-intercom/unit_tests/config_builder.py
{ "start": 122, "end": 689 }
class ____: def __init__(self) -> None: self._config = { "access_token": "fake_access_token", "start_date": "2010-01-18T21:18:20Z", } def start_date(self, start_date: datetime) -> "ConfigBuilder": self._config["start_date"] = start_date.strftime("%Y-%m-%dT%H:%M:%...
ConfigBuilder
python
astropy__astropy
astropy/io/ascii/ipac.py
{ "start": 525, "end": 754 }
class ____(Exception): def __str__(self): return "{}\nSee {}".format( super().__str__(), "https://irsa.ipac.caltech.edu/applications/DDGEN/Doc/DBMSrestriction.html", )
IpacFormatErrorDBMS