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
PrefectHQ__prefect
src/prefect/flows.py
{ "start": 74016, "end": 86353 }
class ____: @overload def __call__(self, __fn: Callable[P, R]) -> Flow[P, R]: ... @overload def __call__( self, __fn: None = None, *, name: Optional[str] = None, version: Optional[str] = None, flow_run_name: Optional[Union[Callable[[], str], str]] = None,...
FlowDecorator
python
dagster-io__dagster
python_modules/dagster/dagster/_core/launcher/base.py
{ "start": 483, "end": 797 }
class ____(NamedTuple): """Context available within a run launcher's launch_run call.""" dagster_run: DagsterRun workspace: Optional["BaseWorkspaceRequestContext"] @property def job_code_origin(self) -> Optional[JobPythonOrigin]: return self.dagster_run.job_code_origin
LaunchRunContext
python
pandas-dev__pandas
asv_bench/benchmarks/strftime.py
{ "start": 1669, "end": 3116 }
class ____: timeout = 1500 params = ([1000, 10000], ["D", "h"]) param_names = ["nobs", "freq"] def setup(self, nobs, freq): self.data = pd.DataFrame( { "p": pd.period_range(start="2000-01-01", periods=nobs, freq=freq), "r": [np.random.uniform()] * nob...
PeriodStrftime
python
doocs__leetcode
lcof2/剑指 Offer II 055. 二叉搜索树迭代器/Solution.py
{ "start": 192, "end": 800 }
class ____: def __init__(self, root: TreeNode): def inorder(root): if root: inorder(root.left) self.vals.append(root.val) inorder(root.right) self.cur = 0 self.vals = [] inorder(root) def next(self) -> int: res...
BSTIterator
python
crytic__slither
slither/solc_parsing/declarations/function.py
{ "start": 2148, "end": 74206 }
class ____(CallerContextExpression): # elems = [(type, name)] def __init__( self, function: Function, function_data: Dict, contract_parser: Optional["ContractSolc"], slither_parser: "SlitherCompilationUnitSolc", ) -> None: self._slither_parser: "SlitherCompi...
FunctionSolc
python
wandb__wandb
wandb/vendor/pygments/lexers/matlab.py
{ "start": 7475, "end": 26640 }
class ____(RegexLexer): """ For GNU Octave source code. .. versionadded:: 1.5 """ name = 'Octave' aliases = ['octave'] filenames = ['*.m'] mimetypes = ['text/octave'] # These lists are generated automatically. # Run the following in bash shell: # # First dump all of the...
OctaveLexer
python
allegroai__clearml
clearml/backend_api/services/v2_13/models.py
{ "start": 88554, "end": 89435 }
class ____(Request): """ Gets model information :param task: Task id :type task: str """ _service = "models" _action = "get_by_task_id" _version = "2.13" _schema = { "definitions": {}, "properties": {"task": {"description": "Task id", "type": ["string", "null"]}}, ...
GetByTaskIdRequest
python
getsentry__sentry
src/sentry/models/files/abstractfile.py
{ "start": 6659, "end": 13501 }
class ____(Model, _Parent[BlobIndexType, BlobType]): __relocation_scope__ = RelocationScope.Excluded name = models.TextField() type = models.CharField(max_length=64) timestamp = models.DateTimeField(default=timezone.now, db_index=True) headers = LegacyTextJSONField(default=dict) size = Wrapping...
AbstractFile
python
google__flatbuffers
tests/monster_test_generated.py
{ "start": 383, "end": 460 }
class ____(object): None_ = -1 Human = 0 Dwarf = 1 Elf = 2
Race
python
eventlet__eventlet
eventlet/hubs/timer.py
{ "start": 2554, "end": 3185 }
class ____(Timer): def __init__(self, *args, **kwargs): self.greenlet = greenlet.getcurrent() Timer.__init__(self, *args, **kwargs) @property def pending(self): if self.greenlet is None or self.greenlet.dead: return False return not self.called def __call__...
LocalTimer
python
pytorch__pytorch
test/test_license.py
{ "start": 534, "end": 2085 }
class ____(TestCase): @unittest.skipIf(not create_bundled, "can only be run in a source tree") def test_license_for_wheel(self): current = io.StringIO() create_bundled("third_party", current) with open(license_file) as fid: src_tree = fid.read() if not src_tree == cur...
TestLicense
python
wandb__wandb
wandb/vendor/pygments/lexers/asm.py
{ "start": 20797, "end": 21105 }
class ____(ObjdumpLexer): """ For the output of 'objdump -d -M intel'. .. versionadded:: 2.0 """ name = 'objdump-nasm' aliases = ['objdump-nasm'] filenames = ['*.objdump-intel'] mimetypes = ['text/x-nasm-objdump'] tokens = _objdump_lexer_tokens(NasmLexer)
NasmObjdumpLexer
python
scikit-learn__scikit-learn
sklearn/utils/tests/test_estimator_checks.py
{ "start": 7790, "end": 8431 }
class ____(BaseEstimator): def fit(self, X, y, sample_weight=None): # Convert data X, y = validate_data( self, X, y, accept_sparse=("csr", "csc"), multi_output=True, y_numeric=True ) # Function is only called after we verify that pandas is installed from pandas im...
NoSampleWeightPandasSeriesType
python
facebookresearch__faiss
tests/test_local_search_quantizer.py
{ "start": 19385, "end": 21457 }
class ____(unittest.TestCase): def eval_index_accuracy(self, factory_key): ds = datasets.SyntheticDataset(32, 1000, 1000, 100) index = faiss.index_factory(ds.d, factory_key) index.train(ds.get_train()) index.add(ds.get_database()) inters = [] for nprobe in 1, 2, 4,...
TestIndexIVFProductLocalSearchQuantizer
python
apache__airflow
providers/amazon/tests/unit/amazon/aws/sensors/test_bedrock.py
{ "start": 7858, "end": 10152 }
class ____: SENSOR = BedrockIngestionJobSensor def setup_method(self): self.default_op_kwargs = dict( task_id="test_bedrock_knowledge_base_active_sensor", knowledge_base_id="knowledge_base_id", data_source_id="data_source_id", ingestion_job_id="ingestion_...
TestBedrockIngestionJobSensor
python
apache__airflow
providers/google/tests/unit/google/common/links/test_storage.py
{ "start": 910, "end": 1549 }
class ____: def test_storage_link(self): assert StorageLink.name == "GCS Storage" assert StorageLink.key == "storage_conf" assert ( StorageLink.format_str == "https://console.cloud.google.com/storage/browser/{uri};tab=objects?project={project_id}" ) def t...
TestStorageLink
python
huggingface__transformers
src/transformers/models/qwen2_5_vl/configuration_qwen2_5_vl.py
{ "start": 2874, "end": 12155 }
class ____(PreTrainedConfig): r""" This is the configuration class to store the configuration of a [`Qwen2_5_VLTextModel`]. It is used to instantiate a Qwen2-VL model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a simil...
Qwen2_5_VLTextConfig
python
apache__airflow
providers/neo4j/src/airflow/providers/neo4j/operators/neo4j.py
{ "start": 1247, "end": 2344 }
class ____(BaseOperator): """ Executes sql code in a specific Neo4j database. .. seealso:: For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:Neo4jOperator` :param sql: the sql code to be executed. Can receive a str representing a s...
Neo4jOperator
python
doocs__leetcode
solution/1700-1799/1763.Longest Nice Substring/Solution.py
{ "start": 0, "end": 432 }
class ____: def longestNiceSubstring(self, s: str) -> str: n = len(s) ans = '' for i in range(n): ss = set() for j in range(i, n): ss.add(s[j]) if ( all(c.lower() in ss and c.upper() in ss for c in ss) ...
Solution
python
redis__redis-py
redis/multidb/circuit.py
{ "start": 3250, "end": 3856 }
class ____(BaseCircuitBreaker): def __init__(self, cb: pybreaker.CircuitBreaker): """ Initialize a PBCircuitBreakerAdapter instance. This adapter wraps pybreaker's CircuitBreaker implementation to make it compatible with our CircuitBreaker interface. Args: cb: A...
PBCircuitBreakerAdapter
python
zarr-developers__zarr-python
src/zarr/errors.py
{ "start": 1344, "end": 1518 }
class ____(NodeNotFoundError): """ Raised when a group isn't found at a certain path. """ _msg = "No group found in store {!r} at path {!r}"
GroupNotFoundError
python
kubernetes-client__python
kubernetes/client/models/v1_pod_template.py
{ "start": 383, "end": 6637 }
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...
V1PodTemplate
python
Textualize__textual
docs/examples/how-to/layout03.py
{ "start": 354, "end": 530 }
class ____(Placeholder): DEFAULT_CSS = """ ColumnsContainer { width: 1fr; height: 1fr; border: solid white; } """ # (1)!
ColumnsContainer
python
python-openxml__python-docx
src/docx/parts/document.py
{ "start": 803, "end": 6417 }
class ____(StoryPart): """Main document part of a WordprocessingML (WML) package, aka a .docx file. Acts as broker to other parts such as image, core properties, and style parts. It also acts as a convenient delegate when a mid-document object needs a service involving a remote ancestor. The `Parented....
DocumentPart
python
pypa__hatch
tests/backend/metadata/test_core.py
{ "start": 57432, "end": 60911 }
class ____: def test_unknown(self, isolation): metadata = ProjectMetadata( str(isolation), PluginManager(), {"project": {"name": "foo"}, "tool": {"hatch": {"metadata": {"hooks": {"foo": {}}}}}}, ) with pytest.raises(ValueError, match="Unknown metadata hoo...
TestHook
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/sql/selectable.py
{ "start": 233374, "end": 238075 }
class ____( roles.InElementRole, Generative, GroupedElement, ColumnElement[_T] ): """Represent a scalar subquery. A :class:`_sql.ScalarSelect` is created by invoking the :meth:`_sql.SelectBase.scalar_subquery` method. The object then participates in other SQL expressions as a SQL column expressi...
ScalarSelect
python
mlflow__mlflow
tests/sagemaker/mock/__init__.py
{ "start": 38645, "end": 39151 }
class ____: """ Object representing a model entry in the models list returned by SageMaker's "ListModels" API: https://docs.aws.amazon.com/sagemaker/latest/dg/API_ListModels.html. """ def __init__(self, model, arn): self.model = model self.arn = arn @property def response_o...
ModelSummary
python
walkccc__LeetCode
solutions/2545. Sort the Students by Their Kth Score/2545.py
{ "start": 0, "end": 142 }
class ____: def sortTheStudents(self, score: list[list[int]], k: int) -> list[list[int]]: return sorted(score, key=lambda x: -x[k])
Solution
python
spyder-ide__spyder
spyder/api/fonts.py
{ "start": 1150, "end": 1823 }
class ____: """Mixin to get the different Spyder font types from our config system.""" @classmethod def get_font( cls, font_type: str, font_size_delta: Optional[int] = 0 ) -> QFont: """ Get a font type as a QFont object. Parameters ---------- ...
SpyderFontsMixin
python
walkccc__LeetCode
solutions/140. Word Break II/140.py
{ "start": 0, "end": 585 }
class ____: def wordBreak(self, s: str, wordDict: list[str]) -> list[str]: wordSet = set(wordDict) @functools.lru_cache(None) def wordBreak(s: str) -> list[str]: ans = [] # 1 <= len(prefix) < len(s) for i in range(1, len(s)): prefix = s[:i] suffix = s[i:] if pre...
Solution
python
pytorch__pytorch
test/dynamo/test_misc.py
{ "start": 4631, "end": 5152 }
class ____: setup = False def __setattr__(self, key, value): assert torch.compiler.is_dynamo_compiling() or UserDefineSetAttr.setup super().__setattr__(f"pfx_{key}", value) def __getattr__(self, key, c=1): assert torch.compiler.is_dynamo_compiling() or UserDefineSetAttr.setup ...
UserDefineSetAttr
python
wandb__wandb
wandb/vendor/pygments/lexers/templates.py
{ "start": 11556, "end": 14781 }
class ____(RegexLexer): """ Generic `django <http://www.djangoproject.com/documentation/templates/>`_ and `jinja <http://wsgiarea.pocoo.org/jinja/>`_ template lexer. It just highlights django/jinja code between the preprocessor directives, other data is left untouched by the lexer. """ nam...
DjangoLexer
python
apache__airflow
airflow-core/src/airflow/ti_deps/deps/valid_state_dep.py
{ "start": 978, "end": 2517 }
class ____(BaseTIDep): """ Ensures that the task instance's state is in a given set of valid states. :param valid_states: A list of valid states that a task instance can have to meet this dependency. :return: whether or not the task instance's state is valid """ NAME = "Task Instance S...
ValidStateDep
python
ray-project__ray
python/ray/serve/tests/test_model_composition.py
{ "start": 5677, "end": 7818 }
class ____: def __init__(self, child, parent): self._child = child self._parent = parent async def __call__(self, *args): # Check that the grandparent and parent are talking to the same child. assert await self._child.remote() == await self._parent.remote() return "ok" ...
GrandParent
python
django-import-export__django-import-export
tests/core/migrations/0015_withpositiveintegerfields.py
{ "start": 92, "end": 794 }
class ____(migrations.Migration): dependencies = [ ("core", "0014_bookwithchapternumbers"), ] operations = [ migrations.CreateModel( name="WithPositiveIntegerFields", fields=[ ( "id", models.BigAutoField( ...
Migration
python
networkx__networkx
networkx/classes/reportviews.py
{ "start": 32785, "end": 33687 }
class ____(OutMultiEdgeDataView): """An EdgeDataView for inward edges of MultiDiGraph; See EdgeDataView""" __slots__ = () def __iter__(self): return ( self._report(nbr, n, k, dd) for n, nbrs in self._nodes_nbrs() for nbr, kd in nbrs.items() for k, dd...
InMultiEdgeDataView
python
kamyu104__LeetCode-Solutions
Python/minimum-array-end.py
{ "start": 51, "end": 423 }
class ____(object): def minEnd(self, n, x): """ :type n: int :type x: int :rtype: int """ n -= 1 base_n = base_x = 1 while base_n <= n: if (x&base_x) == 0: if n&base_n: x |= base_x base_n ...
Solution
python
scipy__scipy
scipy/stats/tests/test_continuous.py
{ "start": 88065, "end": 88409 }
class ____(ContinuousDistribution): _variable = _RealParameter('x', domain=_RealInterval(endpoints=(-np.inf, np.inf))) def _pdf_formula(self, x, *args, **kwargs): return (0.4 * 1/(1.1 * np.sqrt(2*np.pi)) * np.exp(-0.5*((x+0.25)/1.1)**2) + 0.6 * 1/(0.9 * np.sqrt(2*np.pi)) * np.exp(-0.5*((...
MixedDist
python
dagster-io__dagster
examples/docs_snippets/docs_snippets_tests/snippet_checks/guides/components/integrations/test_sigma_utils.py
{ "start": 267, "end": 1787 }
class ____(SigmaOrganization): async def build_organization_data( self, sigma_filter=None, fetch_column_data: bool = True, fetch_lineage_data: bool = True, ) -> SigmaOrganizationData: """Returns mock Sigma organization data.""" # Create mock workbook workb...
MockSigmaOrganization
python
doocs__leetcode
solution/0200-0299/0280.Wiggle Sort/Solution.py
{ "start": 0, "end": 378 }
class ____: def wiggleSort(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. """ for i in range(1, len(nums)): if (i % 2 == 1 and nums[i] < nums[i - 1]) or ( i % 2 == 0 and nums[i] > nums[i - 1] ): ...
Solution
python
skorch-dev__skorch
skorch/tests/test_toy.py
{ "start": 94, "end": 3326 }
class ____: @pytest.fixture def module_cls(self): from skorch.toy import MLPModule return MLPModule def test_one_hidden(self, module_cls): module = module_cls() parameters = list(module.named_parameters()) # 2 linear * (weight + bias) assert len(parameters) ...
TestMLPModule
python
PrefectHQ__prefect
tests/utilities/schema_tools/test_hydration.py
{ "start": 6651, "end": 9199 }
class ____: @pytest.mark.parametrize( "input_object, expected_output", [ # Valid Jinja template ( {"param": {"__prefect_kind": "jinja", "template": "Hello {{ name }}"}}, {"param": ValidJinja("Hello {{ name }}")}, ), # Ji...
TestHydrateWithJinjaPrefectKind
python
sympy__sympy
sympy/polys/domains/modularinteger.py
{ "start": 406, "end": 6042 }
class ____(PicklableWithSlots, DomainElement): """A class representing a modular integer. """ mod, dom, sym, _parent = None, None, None, None __slots__ = ('val',) def parent(self): return self._parent def __init__(self, val): if isinstance(val, self.__class__): self.v...
ModularInteger
python
kamyu104__LeetCode-Solutions
Python/longest-ideal-subsequence.py
{ "start": 34, "end": 357 }
class ____(object): def longestIdealString(self, s, k): """ :type s: str :type k: int :rtype: int """ dp = [0]*26 for c in s: x = ord(c)-ord('a') dp[x] = max(dp[i] for i in xrange(max(x-k, 0), min(x+k+1, 26)))+1 return max(dp)
Solution
python
ansible__ansible
test/units/executor/module_common/test_module_common.py
{ "start": 1954, "end": 2790 }
class ____: def test_slurp_nonexistent(self, mocker): mocker.patch('os.path.exists', side_effect=lambda x: False) with pytest.raises(ansible.errors.AnsibleError): amc._slurp('no_file') def test_slurp_file(self, mocker): mocker.patch('os.path.exists', side_effect=lambda x: Tr...
TestSlurp
python
walkccc__LeetCode
solutions/1848. Minimum Distance to the Target Element/1848.py
{ "start": 0, "end": 227 }
class ____: def getMinDistance(self, nums: list[int], target: int, start: int) -> int: ans = math.inf for i, num in enumerate(nums): if num == target: ans = min(ans, abs(i - start)) return ans
Solution
python
keras-team__keras
keras/src/ops/math.py
{ "start": 27382, "end": 31780 }
class ____(Operation): def __init__( self, sequence_length, sequence_stride, fft_length, length=None, window="hann", center=True, *, name=None, ): super().__init__(name=name) self.sequence_length = sequence_length se...
ISTFT
python
django__django
tests/lookup/models.py
{ "start": 1248, "end": 1373 }
class ____(models.Transform): lookup_name = "nulled" template = "NULL" @NulledTextField.register_lookup
NulledTransform
python
realpython__materials
python-double-underscore/point.py
{ "start": 0, "end": 467 }
class ____: def __init__(self, x, y): self.x = x self.y = y @property def x(self): return self._x @x.setter def x(self, value): self._x = _validate(value) @property def y(self): return self._y @y.setter def y(self, value): self._y =...
Point
python
walkccc__LeetCode
solutions/2012. Sum of Beauty in the Array/2012.py
{ "start": 0, "end": 476 }
class ____: def sumOfBeauties(self, nums: list[int]) -> int: n = len(nums) ans = 0 minOfRight = [0] * (n - 1) + [nums[-1]] for i in range(n - 2, 1, -1): minOfRight[i] = min(nums[i], minOfRight[i + 1]) maxOfLeft = nums[0] for i in range(1, n - 1): if maxOfLeft < nums[i] < minOfRi...
Solution
python
PyCQA__pylint
tests/functional/a/arguments_renamed.py
{ "start": 1422, "end": 1637 }
class ____(Parent): def test(self, var): # [arguments-renamed] return var + 1 def kwargs_test(self, *, var1, kw2): #[arguments-differ] print(f"keyword parameters are {var1} and {kw2}.")
Child2
python
pypa__warehouse
tests/unit/manage/test_forms.py
{ "start": 14980, "end": 16323 }
class ____: def test_validate(self): fake_webauthn = object() user_id = (pretend.stub(),) user_service = pretend.stub( get_webauthn_by_label=pretend.call_recorder(lambda *a: fake_webauthn) ) form = forms.DeleteWebAuthnForm( formdata=MultiDict({"label":...
TestDeleteWebAuthnForm
python
spack__spack
lib/spack/spack/detection/test.py
{ "start": 719, "end": 950 }
class ____(NamedTuple): """Data structure to model assertions on detection tests""" #: Spec to be detected spec: str #: Attributes expected in the external spec extra_attributes: Dict[str, str]
ExpectedTestResult
python
coleifer__peewee
tests/manytomany.py
{ "start": 1344, "end": 1447 }
class ____(TestModel): name = TextField(unique=True) LogoColorDeferred = DeferredThroughModel()
Color
python
ray-project__ray
python/ray/train/v2/_internal/execution/checkpoint/checkpoint_manager.py
{ "start": 1208, "end": 2346 }
class ____(BaseModel): # Increment version if the schema changes version: int = 0 checkpoint_results: List[_TrainingResultState] latest_checkpoint_result: Optional[_TrainingResultState] def _get_training_result_from_state( state: _TrainingResultState, storage_context: StorageContext, ) -> _Tra...
_CheckpointManagerState
python
huggingface__transformers
src/transformers/models/instructblip/modeling_instructblip.py
{ "start": 45987, "end": 62469 }
class ____(InstructBlipPreTrainedModel, GenerationMixin): config: InstructBlipConfig main_input_name = "pixel_values" _can_compile_fullgraph = True _keep_in_fp32_modules = ["query_tokens"] # TODO @ArthurZucker I don't know why this is required for FP8 def __init__(self, config: InstructBlipConfig...
InstructBlipForConditionalGeneration
python
pypa__warehouse
tests/unit/accounts/test_views.py
{ "start": 143913, "end": 146844 }
class ____: @pytest.mark.parametrize("next_route", [None, "/manage/accounts", "/projects/"]) def test_reauth(self, monkeypatch, pyramid_request, pyramid_services, next_route): user_service = pretend.stub(get_password_timestamp=lambda uid: 0) response = pretend.stub() monkeypatch.setattr...
TestReAuthentication
python
django-haystack__django-haystack
haystack/inputs.py
{ "start": 933, "end": 1191 }
class ____(BaseInput): """ An input type for sanitizing user/untrusted input. """ input_type_name = "clean" def prepare(self, query_obj): query_string = super().prepare(query_obj) return query_obj.clean(query_string)
Clean
python
facebook__pyre-check
source/interprocedural_analyses/taint/test/integration/model_shaping.py
{ "start": 380, "end": 3606 }
class ____: __dict__: Dict[str, Any] = {} def _is_dataclass_instance(obj) -> bool: ... def fields(obj): ... def asdict(obj: RecordSchema, *, dict_factory: Any = dict) -> Dict[str, Any]: """Return the fields of a RecordSchema instance as a new dictionary mapping field names to field values. ...
MutableRecord
python
tensorflow__tensorflow
tensorflow/compiler/tests/xla_device_gpu_test.py
{ "start": 1056, "end": 1796 }
class ____(test.TestCase): def __init__(self, method_name="runTest"): super(XlaDeviceGpuTest, self).__init__(method_name) context.context().enable_xla_devices() def testCopiesToAndFromGpuWork(self): """Tests that copies between GPU and XLA devices work.""" if not config.list_physical_devices("GPU"...
XlaDeviceGpuTest
python
pytorch__pytorch
test/test_transformers.py
{ "start": 221571, "end": 229655 }
class ____(NNTestCase): def run_test( self, device, make_q, make_kv, attn_bias=None, forw_tolerances: Optional[Tolerances] = None, grad_tolerances: Optional[Tolerances] = None, backend=None, causal_variant=None, ): if backend is no...
TestAttnBias
python
tensorflow__tensorflow
tensorflow/python/saved_model/nested_structure_coder.py
{ "start": 5369, "end": 5986 }
class ____: """Codec for dicts.""" def can_encode(self, pyobj): return isinstance(pyobj, collections_abc.Mapping) def do_encode(self, dict_value, encode_fn): encoded_dict = struct_pb2.StructuredValue() encoded_dict.dict_value.CopyFrom(struct_pb2.DictValue()) for key, value in dict_value.items():...
_DictCodec
python
kamyu104__LeetCode-Solutions
Python/divide-array-into-equal-pairs.py
{ "start": 63, "end": 276 }
class ____(object): def divideArray(self, nums): """ :type nums: List[int] :rtype: bool """ return all(cnt%2 == 0 for cnt in collections.Counter(nums).itervalues())
Solution
python
spyder-ide__spyder
spyder/utils/installers.py
{ "start": 460, "end": 977 }
class ____(object): """ Base class for installer error; do not use directly. Exit Spyder with code 1. """ logger = logging.getLogger('Installer') logger.setLevel(logging.DEBUG) def __init__(self, msg): if not running_installer_test(): # Don't do anything retur...
SpyderInstallerError
python
dagster-io__dagster
python_modules/libraries/dagster-airbyte/dagster_airbyte/managed/types.py
{ "start": 7634, "end": 7902 }
class ____(Enum): """Represents the sync mode for a given Airbyte stream.""" SAME_AS_SOURCE = "source" DESTINATION_DEFAULT = "destination" @deprecated(breaking_version="2.0", additional_warn_text=MANAGED_ELEMENTS_DEPRECATION_MSG)
AirbyteDestinationNamespace
python
sqlalchemy__sqlalchemy
test/orm/inheritance/test_relationship.py
{ "start": 5001, "end": 11952 }
class ____(fixtures.MappedTest): run_setup_mappers = "once" @classmethod def define_tables(cls, metadata): Table( "people", metadata, Column( "person_id", Integer, primary_key=True, test_needs_autoin...
SelfReferentialJ2JTest
python
gawel__pyquery
tests/test_pyquery.py
{ "start": 651, "end": 927 }
class ____(TestCase): def test_unicode(self): xml = pq("<html><p>é</p></html>") self.assertEqual(type(xml.html()), str) self.assertEqual(str(xml), '<html><p>é</p></html>') self.assertEqual(str(xml('p:contains("é")')), '<p>é</p>')
TestUnicode
python
getsentry__sentry
src/sentry/organizations/services/organization_actions/model.py
{ "start": 200, "end": 331 }
class ____: organization: Organization org_member: OrganizationMember team: Team | None
OrganizationAndMemberCreationResult
python
cherrypy__cherrypy
cherrypy/tutorial/tut04_complex_site.py
{ "start": 186, "end": 620 }
class ____: """Home page app.""" @cherrypy.expose def index(self): """Produce HTTP response body of home page app index URI.""" return """ <p>Hi, this is the home page! Check out the other fun stuff on this site:</p> <ul> <li><a href="/jo...
HomePage
python
MongoEngine__mongoengine
mongoengine/connection.py
{ "start": 930, "end": 17882 }
class ____(Exception): """Error raised when the database connection can't be established or when a connection with a requested alias can't be retrieved. """ pass def _check_db_name(name): """Check if a database name is valid. This functionality is copied from pymongo Database class constructo...
ConnectionFailure
python
getsentry__sentry
src/sentry/analytics/events/issue_deleted.py
{ "start": 70, "end": 312 }
class ____(analytics.Event): group_id: int delete_type: str organization_id: int project_id: int user_id: int | None = None default_user_id: int | str | None = None analytics.register(IssueDeletedEvent)
IssueDeletedEvent
python
pytest-dev__pytest-django
pytest_django/live_server_helper.py
{ "start": 61, "end": 2873 }
class ____: """The liveserver fixture This is the object that the ``live_server`` fixture returns. The ``live_server`` fixture handles creation and stopping. """ def __init__(self, addr: str, *, start: bool = True) -> None: from django.db import connections from django.test.testcas...
LiveServer
python
crytic__slither
slither/vyper_parsing/ast/types.py
{ "start": 1988, "end": 2060 }
class ____(ASTNode): value: ASTNode attr: str @dataclass
Attribute
python
nedbat__coveragepy
coverage/misc.py
{ "start": 6292, "end": 11291 }
class ____: """A sentinel object to use for unusual default-value needs. Construct with a string that will be used as the repr, for display in help and Sphinx output. """ def __init__(self, display_as: str) -> None: self.display_as = display_as def __repr__(self) -> str: retu...
DefaultValue
python
run-llama__llama_index
llama-index-core/llama_index/core/node_parser/file/simple_file.py
{ "start": 765, "end": 3489 }
class ____(NodeParser): """ Simple file node parser. Splits a document loaded from a file into Nodes using logic based on the file type automatically detects the NodeParser to use based on file type Args: include_metadata (bool): whether to include metadata in nodes include_prev_ne...
SimpleFileNodeParser
python
dagster-io__dagster
python_modules/dagster/dagster/_utils/test/mysql_instance.py
{ "start": 8283, "end": 8575 }
class ____(Exception): def __init__(self, message, subprocess_error): super().__init__(check.opt_str_param(message, "message")) self.subprocess_error = check.inst_param( subprocess_error, "subprocess_error", subprocess.CalledProcessError )
MySQLDockerError
python
Pylons__pyramid
tests/test_csrf.py
{ "start": 6518, "end": 7138 }
class ____(unittest.TestCase): def setUp(self): self.config = testing.setUp() def _callFUT(self, *args, **kwargs): from pyramid.csrf import get_csrf_token return get_csrf_token(*args, **kwargs) def test_no_override_csrf_utility_registered(self): request = testing.DummyRequ...
Test_get_csrf_token
python
spack__spack
lib/spack/spack/traverse.py
{ "start": 3095, "end": 3683 }
class ____: """A visitor that traverses all edges once.""" def __init__(self, visitor, key=id, visited=None): self.visitor = visitor self.visited = set() if visited is None else visited self.key = key def accept(self, item): return self.visitor.accept(item) def neighbo...
CoverEdgesVisitor
python
doocs__leetcode
solution/2100-2199/2182.Construct String With Repeat Limit/Solution.py
{ "start": 0, "end": 696 }
class ____: def repeatLimitedString(self, s: str, repeatLimit: int) -> str: cnt = [0] * 26 for c in s: cnt[ord(c) - ord("a")] += 1 ans = [] j = 24 for i in range(25, -1, -1): j = min(i - 1, j) while 1: x = min(repeatLimit, c...
Solution
python
run-llama__llama_index
llama-index-packs/llama-index-packs-mixture-of-agents/llama_index/packs/mixture_of_agents/base.py
{ "start": 730, "end": 782 }
class ____(Event): result: str
GenerateResultEvent
python
openai__openai-python
src/openai/types/beta/code_interpreter_tool_param.py
{ "start": 224, "end": 389 }
class ____(TypedDict, total=False): type: Required[Literal["code_interpreter"]] """The type of tool being defined: `code_interpreter`"""
CodeInterpreterToolParam
python
sqlalchemy__sqlalchemy
test/perf/compiled_extensions/collections_.py
{ "start": 3269, "end": 9674 }
class ____(Case): @staticmethod def set_fn(): return set @staticmethod def python(): from sqlalchemy.util import _collections_cy py_coll = load_uncompiled_module(_collections_cy) assert not py_coll._is_compiled() return py_coll.IdentitySet @staticmethod ...
IdentitySet
python
gevent__gevent
src/gevent/tests/test__event.py
{ "start": 11099, "end": 11172 }
class ____(TestEvent_SetThenClear): N = 1000
TestEvent_SetThenClear1000
python
graphql-python__graphene
graphene/tests/issues/test_356.py
{ "start": 129, "end": 180 }
class ____(graphene.ObjectType): pass
SomeTypeOne
python
pytorch__pytorch
test/test_tensor_creation_ops.py
{ "start": 154551, "end": 177317 }
class ____(TestCase): exact_dtype = True # TODO: add torch.complex64, torch.complex128 @dtypes(torch.float, torch.double) def test_normal(self, device, dtype): def helper(self, device, dtype, ptype, t_transform, std_transform): q = torch.empty(100, 100, dtype=dtype, device=device) ...
TestRandomTensorCreation
python
kamyu104__LeetCode-Solutions
Python/length-of-longest-subarray-with-at-most-k-frequency.py
{ "start": 93, "end": 569 }
class ____(object): def maxSubarrayLength(self, nums, k): """ :type nums: List[int] :type k: int :rtype: int """ cnt = collections.Counter() result = left = 0 for right in xrange(len(nums)): cnt[nums[right]] += 1 while not (cnt[...
Solution
python
milvus-io__pymilvus
pymilvus/client/search_iterator.py
{ "start": 751, "end": 7627 }
class ____: # for compatibility, track the number of total results left _left_res_cnt = None def __init__( self, connection: Connections, collection_name: str, data: Union[List, utils.SparseMatrixInputType], batch_size: int = 1000, limit: Optional[int] = UNLI...
SearchIteratorV2
python
doocs__leetcode
solution/1400-1499/1443.Minimum Time to Collect All Apples in a Tree/Solution.py
{ "start": 0, "end": 563 }
class ____: def minTime(self, n: int, edges: List[List[int]], hasApple: List[bool]) -> int: def dfs(u, cost): if vis[u]: return 0 vis[u] = True nxt_cost = 0 for v in g[u]: nxt_cost += dfs(v, 2) if not hasApple[u] and...
Solution
python
getsentry__sentry
src/sentry/issues/producer.py
{ "start": 831, "end": 4517 }
class ____(ValueEqualityEnum): """ Defines the type of payload that is being sent to Kafka. Messages without PayloadTypes default to OCCURRENCE. When adding new types, existing tests must pass without modifying the payload_type or the payload for backwards compatibility. """ OCCURRENCE = "occu...
PayloadType
python
faif__python-patterns
patterns/behavioral/specification.py
{ "start": 536, "end": 1015 }
class ____(Specification): @abstractmethod def is_satisfied_by(self, candidate): pass def and_specification(self, candidate: "Specification") -> "AndSpecification": return AndSpecification(self, candidate) def or_specification(self, candidate: "Specification") -> "OrSpecification": ...
CompositeSpecification
python
facelessuser__pymdown-extensions
pymdownx/magiclink.py
{ "start": 31849, "end": 32469 }
class ____(InlineProcessor): """Return a link Element given an auto link `<http://example/com>`.""" def handleMatch(self, m, data): """Return link optionally without protocol.""" el = etree.Element("a") el.set('href', self.unescape(m.group(1))) el.text = md_util.AtomicString(m....
MagiclinkAutoPattern
python
huggingface__transformers
src/transformers/models/qwen3_omni_moe/modeling_qwen3_omni_moe.py
{ "start": 44364, "end": 45320 }
class ____(nn.Module): def __init__(self, config: Qwen3OmniMoeVisionEncoderConfig, use_postshuffle_norm=False) -> None: super().__init__() self.hidden_size = config.hidden_size * (config.spatial_merge_size**2) self.use_postshuffle_norm = use_postshuffle_norm self.ln_q = nn.LayerNorm(...
Qwen3OmniMoeVisionPatchMerger
python
keras-team__keras
guides/custom_train_step_in_jax.py
{ "start": 5500, "end": 8945 }
class ____(keras.Model): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.loss_tracker = keras.metrics.Mean(name="loss") self.mae_metric = keras.metrics.MeanAbsoluteError(name="mae") self.loss_fn = keras.losses.MeanSquaredError() def compute_loss_and_u...
CustomModel
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/math_ops/basic_gpu_test.py
{ "start": 6289, "end": 7944 }
class ____(test.TestCase): def _GetGradientArgs(self, xs, ys): return self.evaluate(broadcast_gradient_args(xs, ys)) def testBroadcast(self): r0, r1 = self._GetGradientArgs([2, 3, 5], [1]) self.assertAllEqual(r0, []) self.assertAllEqual(r1, [0, 1, 2]) _GRAD_TOL = {dtypes.float32: 1e-3} def _...
BroadcastSimpleTest
python
huggingface__transformers
src/transformers/models/mobilenet_v2/configuration_mobilenet_v2.py
{ "start": 788, "end": 6068 }
class ____(PreTrainedConfig): r""" This is the configuration class to store the configuration of a [`MobileNetV2Model`]. It is used to instantiate a MobileNetV2 model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a simil...
MobileNetV2Config
python
keon__algorithms
tests/test_graph.py
{ "start": 5560, "end": 6520 }
class ____(unittest.TestCase): def test_all_pairs_shortest_path(self): graph = [[0, 0.1, 0.101, 0.142, 0.277], [0.465, 0, 0.191, 0.192, 0.587], [0.245, 0.554, 0, 0.333, 0.931], [1.032, 0.668, 0.656, 0, 0.151], [0.867, 0.119, 0.352, 0.398, 0...
TestAll_Pairs_Shortest_Path
python
django__django
tests/model_formsets/models.py
{ "start": 5777, "end": 5939 }
class ____(models.Model): uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) name = models.CharField(max_length=255)
UUIDPKParent
python
scrapy__scrapy
tests/test_loader.py
{ "start": 15805, "end": 19497 }
class ____: response = HtmlResponse( url="", encoding="utf-8", body=b""" <html> <body> <header> <div id="id">marta</div> <p>paragraph</p> </header> <footer class="footer"> <a href="http://www.scrapy.org">homepage</a> <img src="/images/logo.png" wid...
TestSubselectorLoader
python
django__django
django/contrib/gis/geos/prototypes/coordseq.py
{ "start": 1731, "end": 3124 }
class ____(GEOSFuncFactory): restype = CS_PTR @staticmethod def errcheck(result, func, cargs): if not result: raise GEOSException( "Error encountered checking Coordinate Sequence returned from GEOS " 'C function "%s".' % func.__name__ ) ...
CsOutput
python
PyCQA__pydocstyle
src/tests/test_decorators.py
{ "start": 5499, "end": 7535 }
class ____: """Unit test for Method class.""" def makeMethod(self, name='someMethodName'): """Return a simple method instance.""" children = [] dunder_all = ['ClassName'] source = textwrap.dedent("""\ class ClassName: def %s(self): """ % (name...
TestMethod