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
pytorch__pytorch
torch/ao/quantization/fake_quantize.py
{ "start": 4019, "end": 12593 }
class ____(FakeQuantizeBase): r"""Simulate the quantize and dequantize operations in training time. The output of this module is given by:: x_out = ( clamp(round(x / scale + zero_point), quant_min, quant_max) - zero_point ) * scale * :attr:`is_dynamic` indicates whether the fa...
FakeQuantize
python
airbytehq__airbyte
airbyte-integrations/connectors/source-azure-table/source_azure_table/source.py
{ "start": 715, "end": 5803 }
class ____(AbstractSource): """This source helps to sync data from one azure data table a time""" def check_connection(self, logger: logging.Logger, config: Mapping[str, Any]) -> Tuple[bool, Optional[Any]]: pass def _as_airbyte_record(self, stream_name: str, data: Mapping[str, Any]): retur...
SourceAzureTable
python
airbytehq__airbyte
airbyte-ci/connectors/metadata_service/lib/metadata_service/models/generated/ConnectorMetadataDefinitionV0.py
{ "start": 4403, "end": 5190 }
class ____(BaseModel): class Config: extra = Extra.forbid enableProgressiveRollout: Optional[bool] = Field( False, description="Whether to enable progressive rollout for the connector." ) initialPercentage: Optional[conint(ge=0, le=100)] = Field( 0, description="The perc...
RolloutConfiguration
python
scipy__scipy
scipy/signal/_ltisys.py
{ "start": 33269, "end": 35446 }
class ____(ZerosPolesGain, lti): r""" Continuous-time Linear Time Invariant system in zeros, poles, gain form. Represents the system as the continuous time transfer function :math:`H(s)=k \prod_i (s - z[i]) / \prod_j (s - p[j])`, where :math:`k` is the `gain`, :math:`z` are the `zeros` and :math:`p...
ZerosPolesGainContinuous
python
doocs__leetcode
solution/2100-2199/2155.All Divisions With the Highest Score of a Binary Array/Solution.py
{ "start": 0, "end": 396 }
class ____: def maxScoreIndices(self, nums: List[int]) -> List[int]: l0, r1 = 0, sum(nums) mx = r1 ans = [0] for i, x in enumerate(nums, 1): l0 += x ^ 1 r1 -= x t = l0 + r1 if mx == t: ans.append(i) elif mx <...
Solution
python
cython__cython
tests/run/test_asyncgen.py
{ "start": 4250, "end": 5823 }
class ____(unittest.TestCase): @contextlib.contextmanager def assertRaisesRegex(self, exc_type, regex): # the error messages usually don't match, so we just ignore them try: yield except exc_type: self.assertTrue(True) else: self.assertTrue(Fa...
AsyncGenSyntaxTest
python
dagster-io__dagster
python_modules/libraries/dagster-managed-elements/dagster_managed_elements/types.py
{ "start": 1294, "end": 1728 }
class ____( NamedTuple("_ModifiedDiffData", [("key", str), ("old_value", Any), ("new_value", Any)]) ): def __new__(cls, key: str, old_value: Any, new_value: Any): return super().__new__( cls, key=check.str_param(key, "key"), old_value=old_value, new_value=new_value ) def __str__...
ModifiedDiffData
python
numpy__numpy
numpy/distutils/ccompiler_opt.py
{ "start": 29727, "end": 34489 }
class ____: """An abstract class handles caching functionality, provides two levels of caching, in-memory by share instances attributes among each other and by store attributes into files. **Note**: any attributes that start with ``_`` or ``conf_`` will be ignored. Parameters ---------...
_Cache
python
ansible__ansible
lib/ansible/_internal/_templating/_errors.py
{ "start": 709, "end": 1302 }
class ____(AnsibleTemplatePluginError, KeyError): """ The specified template plugin (lookup/filter/test) was not found. This exception extends KeyError since Jinja filter/test resolution requires a KeyError to detect missing plugins. Jinja compilation fails if a non-KeyError is raised for a missing filt...
AnsibleTemplatePluginNotFoundError
python
ApeWorX__ape
src/ape/types/events.py
{ "start": 11437, "end": 11993 }
class ____(list): """ Container for ContractLogs which is adding capability of filtering logs """ def filter(self, event: "ContractEvent", **kwargs) -> list[ContractLog]: return [ x for x in self if x.event_name == event.name and x.contract_addres...
ContractLogContainer
python
mlflow__mlflow
mlflow/genai/scorers/builtin_scorers.py
{ "start": 56865, "end": 58284 }
class ____(BuiltInScorer): """ Abstract base class for built-in session-level scorers. Session-level scorers evaluate entire conversation sessions rather than individual traces. """ required_columns: set[str] = {"trace"} _judge: InstructionsJudge | None = pydantic.PrivateAttr(default=None) ...
BuiltInSessionLevelScorer
python
google__pytype
pytype/pretty_printer_test.py
{ "start": 210, "end": 724 }
class ____(test_base.UnitTest): def setUp(self): super().setUp() options = config.Options.create(python_version=self.python_version) self._ctx = test_utils.make_context(options) def test_constant_printer(self): pp = pretty_printer.PrettyPrinter(self._ctx) pyval = (1, 2, pytd.AnythingType(), 4)...
PrettyPrinterTest
python
numpy__numpy
numpy/linalg/tests/test_linalg.py
{ "start": 13289, "end": 13670 }
class ____(LinalgTestCase): @pytest.mark.slow def test_generalized_nonsq_cases(self): self.check_cases(require={'generalized', 'nonsquare'}, exclude={'size-0'}) @pytest.mark.slow def test_generalized_empty_nonsq_cases(self): self.check_cases(require={'generaliz...
LinalgGeneralizedNonsquareTestCase
python
huggingface__transformers
tests/models/mgp_str/test_processing_mgp_str.py
{ "start": 1125, "end": 4113 }
class ____(ProcessorTesterMixin, unittest.TestCase): processor_class = MgpstrProcessor @classmethod def _setup_tokenizer(cls): tokenizer_class = cls._get_component_class_from_processor("tokenizer") vocab = ['[GO]', '[s]', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd',...
MgpstrProcessorTest
python
kamyu104__LeetCode-Solutions
Python/add-strings.py
{ "start": 29, "end": 1185 }
class ____(object): def addStrings(self, num1, num2): """ :type num1: str :type num2: str :rtype: str """ result = [] i, j, carry = len(num1) - 1, len(num2) - 1, 0 while i >= 0 or j >= 0 or carry: if i >= 0: carry += ord(nu...
Solution
python
django__django
django/contrib/postgres/search.py
{ "start": 5843, "end": 6078 }
class ____(SearchVectorCombinable, CombinedExpression): def __init__(self, lhs, connector, rhs, config, output_field=None): self.config = config super().__init__(lhs, connector, rhs, output_field)
CombinedSearchVector
python
prompt-toolkit__python-prompt-toolkit
src/prompt_toolkit/widgets/toolbars.py
{ "start": 11207, "end": 12178 }
class ____: def __init__(self, show_position: bool = False) -> None: def get_formatted_text() -> StyleAndTextTuples: buff = get_app().current_buffer if buff.validation_error: row, column = buff.document.translate_index_to_position( buff.validation...
ValidationToolbar
python
python-openxml__python-docx
tests/image/test_tiff.py
{ "start": 2052, "end": 6178 }
class ____: def it_can_parse_the_properties_from_a_tiff_stream( self, stream_, _make_stream_reader_, _IfdEntries_, ifd0_offset_, stream_rdr_, _TiffParser__init_, ifd_entries_, ): tiff_parser = _TiffParser.parse(stream_) _make_strea...
Describe_TiffParser
python
pytorch__pytorch
test/distributed/checkpoint/test_state_dict_stager.py
{ "start": 6919, "end": 7015 }
class ____: tensor: torch.Tensor value: int = 42 @dataclasses.dataclass
NestedTensorStruct
python
walkccc__LeetCode
solutions/2099. Find Subsequence of Length K With the Largest Sum/2099.py
{ "start": 0, "end": 371 }
class ____: def maxSubsequence(self, nums: list[int], k: int) -> list[int]: ans = [] threshold = sorted(nums)[-k] larger = sum(num > threshold for num in nums) equal = k - larger for num in nums: if num > threshold: ans.append(num) elif num == threshold and equal: ans....
Solution
python
marshmallow-code__marshmallow
tests/base.py
{ "start": 6017, "end": 6113 }
class ____(UserSchema): class Meta: exclude = ("created", "updated")
UserExcludeSchema
python
python-poetry__poetry
tests/helpers.py
{ "start": 6285, "end": 11000 }
class ____(Repository): def find_packages(self, dependency: Dependency) -> list[Package]: packages = super().find_packages(dependency) if len(packages) == 0: raise PackageNotFoundError(f"Package [{dependency.name}] not found.") return packages def find_links_for_package(sel...
TestRepository
python
mwaskom__seaborn
tests/_core/test_properties.py
{ "start": 19366, "end": 19570 }
class ____(IntervalBase): prop = EdgeWidth def test_rcparam_default(self): with mpl.rc_context({"patch.linewidth": 2}): assert self.prop().default_range == (1, 4)
TestEdgeWidth
python
huggingface__transformers
src/transformers/models/kosmos2/modeling_kosmos2.py
{ "start": 12132, "end": 15400 }
class ____(nn.Module): """Multi-headed attention from 'Attention Is All You Need' paper""" def __init__(self, config): super().__init__() self.config = config self.embed_dim = config.hidden_size self.num_heads = config.num_attention_heads self.head_dim = self.embed_dim /...
Kosmos2VisionAttention
python
astropy__astropy
astropy/cosmology/_src/tests/flrw/test_w0cdm.py
{ "start": 5029, "end": 7776 }
class ____(FlatFLRWMixinTest, TestwCDM): """Test :class:`astropy.cosmology.FlatwCDM`.""" def setup_class(self): """Setup for testing.""" super().setup_class(self) self.cls = FlatwCDM self.cls_kwargs.update(w0=-0.5) def test_repr(self, cosmo_cls, cosmo): """Test meth...
TestFlatwCDM
python
pytorch__pytorch
test/onnx/exporter/test_api.py
{ "start": 808, "end": 1210 }
class ____(torch.nn.Module): def forward( self, x: torch.Tensor, ys: list[torch.Tensor], zs: dict[str, torch.Tensor], c: torch.Tensor, ): y = ys[0] + ys[1] + zs["a"] + zs["b"] w = 5 if x.shape[0] < 3 and c.shape[0] != 4: return x + w, x...
NestedModelForDynamicShapes
python
huggingface__transformers
src/transformers/convert_slow_tokenizer.py
{ "start": 52613, "end": 55486 }
class ____(SpmConverter): handle_byte_fallback = True def __init__(self, vocab_file=None, **kwargs): requires_backends(self, "protobuf") Converter.__init__(self, vocab_file) model_pb2 = import_protobuf() m = model_pb2.ModelProto() with open(vocab_file, "rb") as f: ...
HeliumConverter
python
crytic__slither
slither/detectors/statements/array_length_assignment.py
{ "start": 3142, "end": 5711 }
class ____(AbstractDetector): """ Array length assignment """ ARGUMENT = "controlled-array-length" HELP = "Tainted array length assignment" IMPACT = DetectorClassification.HIGH CONFIDENCE = DetectorClassification.MEDIUM WIKI = "https://github.com/crytic/slither/wiki/Detector-Documentat...
ArrayLengthAssignment
python
chroma-core__chroma
chromadb/api/types.py
{ "start": 59127, "end": 59225 }
class ____: enabled: bool config: FloatInvertedIndexConfig @dataclass
FloatInvertedIndexType
python
rq__rq
tests/fixtures.py
{ "start": 9073, "end": 9140 }
class ____(Job): """A custom job class just to test it"""
CustomJob
python
ray-project__ray
rllib/connectors/action/pipeline.py
{ "start": 483, "end": 2086 }
class ____(ConnectorPipeline, ActionConnector): def __init__(self, ctx: ConnectorContext, connectors: List[Connector]): super().__init__(ctx, connectors) self.timers = defaultdict(_Timer) def __call__(self, ac_data: ActionConnectorDataType) -> ActionConnectorDataType: for c in self.conn...
ActionConnectorPipeline
python
doocs__leetcode
solution/1300-1399/1337.The K Weakest Rows in a Matrix/Solution.py
{ "start": 0, "end": 277 }
class ____: def kWeakestRows(self, mat: List[List[int]], k: int) -> List[int]: m, n = len(mat), len(mat[0]) ans = [n - bisect_right(row[::-1], 0) for row in mat] idx = list(range(m)) idx.sort(key=lambda i: ans[i]) return idx[:k]
Solution
python
walkccc__LeetCode
solutions/1562. Find Latest Group of Size M/1562.py
{ "start": 0, "end": 592 }
class ____: def findLatestStep(self, arr: list[int], m: int) -> int: if len(arr) == m: return len(arr) ans = -1 step = 0 # sizes[i] := the size of the group starting from i or ending in i # (1-indexed) sizes = [0] * (len(arr) + 2) for i in arr: step += 1 # In the previo...
Solution
python
getsentry__sentry
src/sentry/workflow_engine/typings/notification_action.py
{ "start": 21144, "end": 21330 }
class ____(DataBlob): """ DiscordDataBlob is a specific type that represents the data blob for a Discord notification action. """ tags: str = "" @dataclass
DiscordDataBlob
python
pypa__pip
src/pip/_internal/req/constructors.py
{ "start": 7674, "end": 18581 }
class ____: requirement: Requirement | None link: Link | None markers: Marker | None extras: set[str] def parse_req_from_editable(editable_req: str) -> RequirementParts: name, url, extras_override = parse_editable(editable_req) if name is not None: try: req: Requirement | ...
RequirementParts
python
chroma-core__chroma
chromadb/db/__init__.py
{ "start": 278, "end": 3040 }
class ____(Component): @abstractmethod def create_collection( self, name: str, metadata: Optional[Metadata] = None, get_or_create: bool = False, ) -> Sequence: # type: ignore pass @abstractmethod def get_collection(self, name: str) -> Sequence: # type: igno...
DB
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/pep8_naming/ignore_names/N805.py
{ "start": 30, "end": 835 }
class ____: def badAllowed(this): pass def stillBad(this): pass if False: def badAllowed(this): pass def stillBad(this): pass @pydantic.validator def badAllowed(cls, my_field: str) -> str: pass @pydantic.validator def stil...
Class
python
redis__redis-py
redis/asyncio/multidb/config.py
{ "start": 3194, "end": 8732 }
class ____: """ Configuration class for managing multiple database connections in a resilient and fail-safe manner. Attributes: databases_config: A list of database configurations. client_class: The client class used to manage database connections. command_retry: Retry strategy for ...
MultiDbConfig
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/protocol53.py
{ "start": 275, "end": 359 }
class ____(Protocol): def m[T: Proto_CoGeneric](self: T) -> T: ...
Proto_CoGeneric
python
PrefectHQ__prefect
src/prefect/server/schemas/core.py
{ "start": 17580, "end": 18659 }
class ____(ORMBaseModel): deployment_id: Optional[UUID] = Field( default=None, description="The deployment id associated with this schedule.", ) schedule: schedules.SCHEDULE_TYPES = Field( default=..., description="The schedule for the deployment." ) active: bool = Field( ...
DeploymentSchedule
python
automl__auto-sklearn
test/test_pipeline/components/data_preprocessing/test_one_hot_encoding.py
{ "start": 593, "end": 3571 }
class ____(unittest.TestCase): def setUp(self): self.X_train = create_X() def test_data_type_consistency(self): X = np.random.randint(3, 6, (3, 4)) Y = OneHotEncoder().fit_transform(X) self.assertFalse(sparse.issparse(Y)) X = sparse.csc_matrix( ([3, 6, 4, 5]...
OneHotEncoderTest
python
pytorch__pytorch
test/dynamo/test_subclasses.py
{ "start": 123170, "end": 125374 }
class ____(torch.nn.Module): def forward( self, primals_1: "Sym(s51)", # PlainAOTInput(idx=0) primals_2: "Sym(s71)", # PlainAOTInput(idx=1) primals_3: "Sym(s55)", # PlainAOTInput(idx=2) primals_4: "f64[s64, s55]", # SubclassGetAttrAOTInput(base=PlainAOTInput(idx=3), attr=...
GraphModule
python
python__mypy
mypy/nodes.py
{ "start": 58567, "end": 58872 }
class ____(Statement): __slots__ = ("expr",) __match_args__ = ("expr",) expr: Lvalue def __init__(self, expr: Lvalue) -> None: super().__init__() self.expr = expr def accept(self, visitor: StatementVisitor[T]) -> T: return visitor.visit_del_stmt(self)
DelStmt
python
doocs__leetcode
solution/2400-2499/2423.Remove Letter To Equalize Frequency/Solution.py
{ "start": 0, "end": 279 }
class ____: def equalFrequency(self, word: str) -> bool: cnt = Counter(word) for c in cnt.keys(): cnt[c] -= 1 if len(set(v for v in cnt.values() if v)) == 1: return True cnt[c] += 1 return False
Solution
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/connectors/pyodbc.py
{ "start": 839, "end": 8625 }
class ____(Connector): driver = "pyodbc" # this is no longer False for pyodbc in general supports_sane_rowcount_returning = True supports_sane_multi_rowcount = False supports_native_decimal = True default_paramstyle = "named" fast_executemany = False # for non-DSN connections, this *...
PyODBCConnector
python
keon__algorithms
tests/test_maths.py
{ "start": 13448, "end": 13926 }
class ____(unittest.TestCase): """[summary] Test for the file diffie_hellman_key_exchange.py Arguments: unittest {[type]} -- [description] """ def test_find_order_simple(self): self.assertFalse(diffie_hellman_key_exchange(3, 6)) self.assertTrue(diffie_hellman_key_exchange(3...
TestDiffieHellmanKeyExchange
python
weaviate__weaviate-python-client
weaviate/collections/classes/internal.py
{ "start": 4192, "end": 4373 }
class ____: """The generative data returned relevant to a grouped prompt generative query.""" metadata: Optional[GenerativeMetadata] text: Optional[str]
GenerativeGrouped
python
apache__airflow
helm-tests/tests/helm_tests/apiserver/test_apiserver.py
{ "start": 900, "end": 3094 }
class ____: """Tests API Server deployment.""" def test_airflow_2(self): """ API Server only supports Airflow 3.0.0 and later. """ docs = render_chart( values={"airflowVersion": "2.10.5"}, show_only=["templates/api-server/api-server-deployment.yaml"], ...
TestAPIServerDeployment
python
dagster-io__dagster
python_modules/libraries/dagster-sigma/dagster_sigma/translator.py
{ "start": 1608, "end": 2069 }
class ____: """Represents a Sigma workbook, a collection of visualizations and queries for data exploration and analysis. https://help.sigmacomputing.com/docs/workbooks """ properties: dict[str, Any] lineage: list[dict[str, Any]] datasets: AbstractSet[str] direct_table_deps: AbstractSe...
SigmaWorkbook
python
matplotlib__matplotlib
lib/matplotlib/_mathtext.py
{ "start": 38252, "end": 38416 }
class ____(Box): """A box with only height (zero width).""" def __init__(self, height: float, depth: float): super().__init__(0., height, depth)
Vbox
python
huggingface__transformers
tests/models/diffllama/test_modeling_diffllama.py
{ "start": 22086, "end": 32165 }
class ____(unittest.TestCase): def tearDown(self): gc.collect() backend_empty_cache(torch_device) def setUp(self): model_name = "kajuma/DiffLlama-0.3B-handcut" self.model_dtype = torch.float32 self.tokenizer = AutoTokenizer.from_pretrained(model_name) self.model ...
Mask4DTestHard
python
psf__black
tests/data/cases/class_methods_new_line.py
{ "start": 1379, "end": 1534 }
class ____: """Test class""" cls_var = 100 class Inner: pass def __init__(self): pass
ClassWithInitAndVarsAndDocstringWithInner
python
keras-team__keras
keras/src/ops/nn.py
{ "start": 80522, "end": 85687 }
class ____(Operation): def __init__( self, is_causal=False, flash_attention=None, attn_logits_soft_cap=None, *, name=None, ): super().__init__(name=name) self.is_causal = is_causal self.flash_attention = flash_attention self.attn_lo...
DotProductAttention
python
django__django
tests/shortcuts/tests.py
{ "start": 251, "end": 1850 }
class ____(SimpleTestCase): def test_render(self): response = self.client.get("/render/") self.assertEqual(response.status_code, 200) self.assertEqual(response.content, b"FOO.BAR../render/\n") self.assertEqual(response.headers["Content-Type"], "text/html; charset=utf-8") self...
RenderTests
python
langchain-ai__langchain
libs/langchain/tests/mock_servers/robot/server.py
{ "start": 1779, "end": 5886 }
class ____(BaseModel): """A secret pass phrase.""" public: list[PublicCues] = Field(alias="public") pw: str @app.post( "/walk", description="Direct the robot to walk in a certain direction" " with the prescribed speed an cautiousness.", ) async def walk(walk_input: WalkInput) -> dict[str, Any...
SecretPassPhrase
python
numpy__numpy
numpy/_typing/_array_like.py
{ "start": 1192, "end": 4188 }
class ____(Protocol): """A protocol class representing `~class.__array_function__`.""" def __array_function__( self, func: Callable[..., Any], types: Collection[type[Any]], args: tuple[Any, ...], kwargs: dict[str, Any], ) -> object: ... # TODO: Wait until mypy suppo...
_SupportsArrayFunc
python
mlflow__mlflow
mlflow/entities/dataset_record.py
{ "start": 616, "end": 7104 }
class ____(_MlflowObject): """Represents a single record in an evaluation dataset. A DatasetRecord contains the input data, expected outputs (ground truth), and metadata for a single evaluation example. Records are immutable once created and are uniquely identified by their dataset_record_id. """ ...
DatasetRecord
python
ansible__ansible
lib/ansible/module_utils/facts/packages.py
{ "start": 767, "end": 2284 }
class ____(metaclass=ABCMeta): @abstractmethod def is_available(self, handle_exceptions): # This method is supposed to return True/False if the package manager is currently installed/usable # It can also 'prep' the required systems in the process of detecting availability # If handle_ex...
PkgMgr
python
PyCQA__pylint
tests/functional/a/alternative/alternative_union_syntax.py
{ "start": 1793, "end": 1872 }
class ____(type): def __or__(cls, other): return True
ForwardMetaclass
python
great-expectations__great_expectations
great_expectations/data_context/data_context/file_data_context.py
{ "start": 1205, "end": 9462 }
class ____(SerializableDataContext): """Subclass of AbstractDataContext that contains functionality necessary to work in a filesystem-backed environment.""" # noqa: E501 # FIXME CoP def __init__( self, project_config: Optional[DataContextConfig] = None, context_root_dir: Optional[PathS...
FileDataContext
python
tensorflow__tensorflow
tensorflow/python/feature_column/feature_column_v2.py
{ "start": 114905, "end": 116926 }
class ____(autotrackable.AutoTrackable): """Class that creates a `SharedEmbeddingColumn`.""" def __init__(self, dimension, initializer, ckpt_to_load_from, tensor_name_in_ckpt, num_buckets, trainable, name='shar...
SharedEmbeddingColumnCreator
python
mahmoud__boltons
tests/test_funcutils.py
{ "start": 655, "end": 2270 }
class ____(Greeter): pass def test_partials(): g = SubGreeter('hello') assert g.greet() == 'Hello.' assert g.native_greet() == 'Hello;' assert g.partial_greet() == 'Hello!' assert g.cached_partial_greet() == 'Hello...' assert CachedInstancePartial(g.greet, excitement='s')() == 'Hellos' ...
SubGreeter
python
google__jax
jax/_src/pallas/mosaic/pipeline.py
{ "start": 13990, "end": 44219 }
class ____(BufferedRefBase): """A helper class to automate VMEM double buffering in pallas pipelines. Attributes: spec: pallas blockspec. dtype: dtype for buffers. buffer_type: enum indicating whether this is an input, output, or in/out accumulator buffered reference. window_ref: a multiple-b...
BufferedRef
python
Textualize__textual
tests/css/test_initial.py
{ "start": 111, "end": 204 }
class ____(Widget): DEFAULT_CSS = """ Base { color: magenta; } """
Base
python
huggingface__transformers
tests/pipelines/test_pipelines_zero_shot_audio_classification.py
{ "start": 832, "end": 3420 }
class ____(unittest.TestCase): # Deactivating auto tests since we don't have a good MODEL_FOR_XX mapping, # and only CLAP would be there for now. # model_mapping = {CLAPConfig: CLAPModel} @require_torch def test_small_model_pt(self, dtype="float32"): audio_classifier = pipeline( ...
ZeroShotAudioClassificationPipelineTests
python
wandb__wandb
wandb/automations/_filters/run_states.py
{ "start": 2136, "end": 3012 }
class ____(GQLBase): """Descriptor type, returned on accessing `RunEvent.state`. Necessary in order to handle constructing the custom structure for run state filters. """ def __get__(self, obj: Any, objtype: type) -> StateOperand: return self def eq(self, state: str | ReportedRunState, /)...
StateOperand
python
django__django
django/contrib/gis/geos/prototypes/threadsafe.py
{ "start": 598, "end": 687 }
class ____(threading.local): handle = None thread_context = GEOSContext()
GEOSContext
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/typedDictReadOnly2.py
{ "start": 4022, "end": 4133 }
class ____(TypedDict): x: float y: ReadOnly[float] # This should generate an error for x but not y.
TD_A2
python
getsentry__sentry
src/sentry/preprod/api/endpoints/project_preprod_artifact_update.py
{ "start": 7796, "end": 13777 }
class ____(PreprodArtifactEndpoint): owner = ApiOwner.EMERGE_TOOLS publish_status = { "PUT": ApiPublishStatus.PRIVATE, } authentication_classes = (LaunchpadRpcSignatureAuthentication,) permission_classes = (LaunchpadRpcPermission,) def put( self, request: Request, ...
ProjectPreprodArtifactUpdateEndpoint
python
getsentry__sentry
src/sentry/integrations/msteams/client.py
{ "start": 3683, "end": 5767 }
class ____(MsTeamsClientABC, IntegrationProxyClient): integration_name = IntegrationProviderSlug.MSTEAMS.value def __init__(self, integration: Integration | RpcIntegration): self.integration = integration self.metadata = self.integration.metadata self.base_url = self.metadata["service_u...
MsTeamsClient
python
ray-project__ray
python/ray/train/_internal/state/schema.py
{ "start": 285, "end": 822 }
class ____(str, Enum): """Enumeration for the status of a train run.""" # (Deprecated) Replaced by RUNNING. # The train run has started STARTED = "STARTED" # The train run is running RUNNING = "RUNNING" # The train run was terminated as expected FINISHED = "FINISHED" # The train run...
RunStatusEnum
python
pennersr__django-allauth
allauth/socialaccount/providers/instagram/views.py
{ "start": 181, "end": 1042 }
class ____(OAuth2Adapter): provider_id = "instagram" access_token_url = "https://api.instagram.com/oauth/access_token" # nosec authorize_url = "https://api.instagram.com/oauth/authorize" profile_url = "https://graph.instagram.com/me" def complete_login(self, request, app, token, **kwargs): ...
InstagramOAuth2Adapter
python
django__django
django/utils/archive.py
{ "start": 1305, "end": 1407 }
class ____(Exception): """ Base exception class for all archive errors. """
ArchiveException
python
donnemartin__interactive-coding-challenges
math_probability/add_digits/test_add_digits.py
{ "start": 18, "end": 726 }
class ____(unittest.TestCase): def test_add_digits(self, func): self.assertRaises(TypeError, func, None) self.assertRaises(ValueError, func, -1) self.assertEqual(func(0), 0) self.assertEqual(func(9), 9) self.assertEqual(func(138), 3) self.assertEqual(func(65536), 7) ...
TestAddDigits
python
django-mptt__django-mptt
tests/myapp/tests.py
{ "start": 71427, "end": 74839 }
class ____(TreeTestCase): """ Tests that the queryset function `get_cached_trees` results in a minimum number of database queries. """ fixtures = ["genres.json"] def test_genre_iter(self): """ Test a query with two root nodes. """ with self.assertNumQueries(1): ...
CacheChildrenTestCase
python
etianen__django-reversion
tests/test_app/tests/base.py
{ "start": 2800, "end": 3050 }
class ____(TestModelMixin): def setUp(self): super().setUp() reversion.register(TestModelParent, follow=("testmodel_ptr",)) @override_settings(PASSWORD_HASHERS=["django.contrib.auth.hashers.MD5PasswordHasher"])
TestModelParentMixin
python
numpy__numpy
numpy/f2py/tests/test_crackfortran.py
{ "start": 16097, "end": 16413 }
class ____(util.F2PyTest): sources = [util.getpath("tests", "src", "crackfortran", "gh27697.f90")] options = ['--lower'] def test_no_lower_fail(self): with pytest.raises(ValueError, match='aborting directly') as exc: self.module.utils.my_abort('aborting directly')
TestLowerF2PYDirective
python
run-llama__llama_index
llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/flat/base.py
{ "start": 286, "end": 1300 }
class ____(BaseReader): """ Flat reader. Extract raw text from a file and save the file type in the metadata """ def __init__( self, *args: Any, **kwargs: Any, ) -> None: """Init params.""" super().__init__(*args, **kwargs) def _get_fs( self...
FlatReader
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/pydoclint/DOC201_numpy.py
{ "start": 1001, "end": 4009 }
class ____(metaclass=abc.abcmeta): # DOC201 @abc.abstractmethod def f(self): """Lorem ipsum.""" return True # OK - implicit None early return def foo(obj: object) -> None: """A very helpful docstring. Parameters ---------- obj : object An object. """ if obj...
A
python
sympy__sympy
sympy/codegen/cnodes.py
{ "start": 3333, "end": 3409 }
class ____(struct): """ Represents a union in C """ __slots__ = ()
union
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/pylint/invalid_return_type_bool.py
{ "start": 39, "end": 122 }
class ____: def __bool__(self): return 3.05 # [invalid-bool-return]
Float
python
optuna__optuna
optuna/storages/_rdb/alembic/versions/v2.4.0.a.py
{ "start": 1042, "end": 1439 }
class ____(BaseModel): __tablename__ = "study_directions" __table_args__: Any = (UniqueConstraint("study_id", "objective"),) study_direction_id = Column(Integer, primary_key=True) direction = Column(Enum(StudyDirection), nullable=False) study_id = Column(Integer, ForeignKey("studies.study_id"), null...
StudyDirectionModel
python
getsentry__sentry-python
tests/integrations/unleash/testutils.py
{ "start": 1089, "end": 1334 }
class ____: def __init__(self, *a, **kw): self.features = { "hello": True, "world": False, } def is_enabled(self, feature, *a, **kw): return self.features.get(feature, False)
MockUnleashClient
python
pypa__pipenv
pipenv/patched/pip/_internal/req/req_install.py
{ "start": 2905, "end": 36238 }
class ____: """ Represents something that may be installed later on, may have information about where to fetch the relevant requirement and also contains logic for installing the said requirement. """ def __init__( self, req: Optional[Requirement], comes_from: Optional[U...
InstallRequirement
python
neetcode-gh__leetcode
python/0662-maximum-width-of-binary-tree.py
{ "start": 192, "end": 774 }
class ____: def widthOfBinaryTree(self, root: Optional[TreeNode]) -> int: if root is None: return 0 q = [(root, 0)] width = 0 while q: leftIndex = q[0][1] rightIndex = q[-1][1] width = max(width, rightIndex - leftIndex + 1) ...
Solution
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/flake8_bugbear/B024.py
{ "start": 1264, "end": 1338 }
class ____(abc.ABC): # error def method(self): foo()
abc_Base_1
python
scipy__scipy
scipy/optimize/_nonlin.py
{ "start": 9887, "end": 11565 }
class ____: """ Termination condition for an iteration. It is terminated if - |F| < f_rtol*|F_0|, AND - |F| < f_tol AND - |dx| < x_rtol*|x|, AND - |dx| < x_tol """ def __init__(self, f_tol=None, f_rtol=None, x_tol=None, x_rtol=None, iter=None, norm=maxnorm): ...
TerminationCondition
python
ray-project__ray
python/ray/client_builder.py
{ "start": 2693, "end": 11138 }
class ____: """ Builder for a Ray Client connection. This class can be subclassed by custom builder classes to modify connection behavior to include additional features or altered semantics. One example is the ``_LocalClientBuilder``. """ def __init__(self, address: Optional[str]) -> None: ...
ClientBuilder
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 201503, "end": 204433 }
class ____(sgqlc.types.Input): """Autogenerated input type of CreateSponsorsTier""" __schema__ = github_schema __field_names__ = ( "sponsorable_id", "sponsorable_login", "amount", "is_recurring", "repository_id", "repository_owner_login", "repository_...
CreateSponsorsTierInput
python
run-llama__llama_index
llama-index-integrations/indices/llama-index-indices-managed-vectara/llama_index/indices/managed/vectara/retriever.py
{ "start": 979, "end": 1168 }
class ____(str, Enum): NONE = "none" MMR = "mmr" SLINGSHOT = "multilingual_reranker_v1" SLINGSHOT_ALT_NAME = "slingshot" UDF = "userfn" CHAIN = "chain"
VectaraReranker
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/orm/events.py
{ "start": 59961, "end": 93428 }
class ____(event.Events[Session]): """Define events specific to :class:`.Session` lifecycle. e.g.:: from sqlalchemy import event from sqlalchemy.orm import sessionmaker def my_before_commit(session): print("before commit!") Session = sessionmaker() even...
SessionEvents
python
pytorch__pytorch
torch/_inductor/codegen/mps.py
{ "start": 14829, "end": 40276 }
class ____(SIMDKernel): """Implement Metal codegen based on the SIMDKernel abstraction""" overrides = MetalOverrides # type: ignore[assignment] suffix = ";" newvar_prefix = "auto " max_threadgroup_size = 1024 simd_group_size = 32 pexpr = PythonPrinter().doprint cexpr = CppPrinter().dop...
MetalKernel
python
django-crispy-forms__django-crispy-forms
crispy_forms/templatetags/crispy_forms_tags.py
{ "start": 1693, "end": 7940 }
class ____(template.Node): """ Basic Node object that we can rely on for Node objects in normal template tags. I created this because most of the tags we'll be using will need both the form object and the helper string. This handles both the form object and parses out the helper string into attribut...
BasicNode
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/operators/vertex_ai/custom_job.py
{ "start": 95059, "end": 99263 }
class ____(GoogleCloudBaseOperator): """ Lists CustomTrainingJob, CustomPythonTrainingJob, or CustomContainerTrainingJob in a Location. :param project_id: Required. The ID of the Google Cloud project that the service belongs to. :param region: Required. The ID of the Google Cloud region that the servic...
ListCustomTrainingJobOperator
python
Lightning-AI__lightning
src/lightning/fabric/plugins/environments/mpi.py
{ "start": 1031, "end": 4369 }
class ____(ClusterEnvironment): """An environment for running on clusters with processes created through MPI. Requires the installation of the `mpi4py` package. See also: https://github.com/mpi4py/mpi4py """ def __init__(self) -> None: if not _MPI4PY_AVAILABLE: raise ModuleNotFoun...
MPIEnvironment
python
kamyu104__LeetCode-Solutions
Python/words-within-two-edits-of-dictionary.py
{ "start": 1559, "end": 1870 }
class ____(object): def twoEditWords(self, queries, dictionary): """ :type queries: List[str] :type dictionary: List[str] :rtype: List[str] """ return [q for q in queries if any(sum(c1 != c2 for c1, c2 in itertools.izip(q, d)) <= 2 for d in dictionary)]
Solution2
python
doocs__leetcode
solution/0900-0999/0916.Word Subsets/Solution.py
{ "start": 0, "end": 418 }
class ____: def wordSubsets(self, words1: List[str], words2: List[str]) -> List[str]: cnt = Counter() for b in words2: t = Counter(b) for c, v in t.items(): cnt[c] = max(cnt[c], v) ans = [] for a in words1: t = Counter(a) ...
Solution
python
ray-project__ray
release/ray_release/test.py
{ "start": 2152, "end": 4240 }
class ____: status: str commit: str branch: str url: str timestamp: int pull_request: str rayci_step_id: str duration_ms: Optional[float] = None @classmethod def from_result(cls, result: Result): return cls( status=result.status, commit=os.environ...
TestResult
python
getsentry__sentry
src/sentry/sentry_apps/api/serializers/sentry_app_component.py
{ "start": 906, "end": 1851 }
class ____(Serializer): def serialize(self, obj, attrs, user, **kwargs): event_action: SentryAppEventDataInterface | None = kwargs.get("event_action") if not event_action: raise AssertionError("Requires event_action keyword argument of type EventAction") install = kwargs.get("in...
SentryAppAlertRuleActionSerializer
python
encode__django-rest-framework
tests/test_model_serializer.py
{ "start": 45906, "end": 48393 }
class ____(TestCase): def test_nonPK_foreignkey_model_serializer(self): class TestParentModel(models.Model): title = models.CharField(max_length=64) class TestChildModel(models.Model): parent = models.ForeignKey(TestParentModel, related_name='children', on_delete=models.CASC...
Issue3674Test