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
weaviate__weaviate-python-client
weaviate/validator.py
{ "start": 293, "end": 2327 }
class ____(str, BaseEnum): NUMPY = "numpy" PANDAS = "pandas" POLARS = "polars" TF = "tensorflow" def _validate_input(inputs: Union[List[_ValidateArgument], _ValidateArgument]) -> None: """Validate the values of the input arguments in comparison to the expected types defined in _ValidateArgument. ...
_ExtraTypes
python
astropy__astropy
astropy/__init__.py
{ "start": 2827, "end": 3589 }
class ____(ScienceState): """ Base class for the real version-setters below. """ _value = "test" _versions = dict(test="test") @classmethod def validate(cls, value): if value not in cls._versions: raise ValueError(f"Must be one of {list(cls._versions.keys())}") ...
base_constants_version
python
airbytehq__airbyte
airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/migrate_to_manifest_only/declarative_component_schema.py
{ "start": 42449, "end": 43571 }
class ____(BaseModel): type: Literal["CursorPagination"] cursor_value: str = Field( ..., description="Value of the cursor defining the next page to fetch.", examples=[ "{{ headers.link.next.cursor }}", "{{ last_record['key'] }}", "{{ response['nextPage...
CursorPagination
python
nryoung__algorithms
tests/test_math.py
{ "start": 357, "end": 813 }
class ____(unittest.TestCase): def test_cdf(self): # Calculate cumulative distribution function for x=1 a = cdf(1) self.assertAlmostEqual(a, 0.841344746068543) # Calculate cumulative distribution function x=0 a = cdf(0) self.assertAlmostEqual(a, 0.5) # Calc...
TestApproxCdf
python
numpy__numpy
numpy/f2py/tests/test_return_integer.py
{ "start": 79, "end": 1113 }
class ____(util.F2PyTest): def check_function(self, t, tname): assert t(123) == 123 assert t(123.6) == 123 assert t("123") == 123 assert t(-123) == -123 assert t([123]) == 123 assert t((123, )) == 123 assert t(array(123)) == 123 assert t(array(123, "b"...
TestReturnInteger
python
huggingface__transformers
tests/quantization/gptq/test_gptq.py
{ "start": 13023, "end": 13133 }
class ____(GPTQTestCUDA): device_map = "auto" @require_accelerate @require_torch_multi_gpu
GPTQTestDeviceMap
python
sympy__sympy
sympy/physics/secondquant.py
{ "start": 33627, "end": 36821 }
class ____(FermionState, FockStateBra): """ See Also ======== FockStateFermionKet Examples ======== >>> from sympy.physics.secondquant import FBra >>> FBra([1, 2]) FockStateFermionBra((1, 2)) """ def _dagger_(self): return FockStateFermionKet(*self.args) BBra = Fo...
FockStateFermionBra
python
huggingface__transformers
src/transformers/models/dab_detr/modeling_dab_detr.py
{ "start": 3796, "end": 4906 }
class ____(Seq2SeqModelOutput): r""" last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`): Sequence of hidden-states at the output of the last layer of the decoder of the model. intermediate_hidden_states (`torch.FloatTensor` of shape `(config.decoder_layers,...
DabDetrModelOutput
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 231677, "end": 231984 }
class ____(sgqlc.types.Type): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("cursor", "node") cursor = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name="cursor") node = sgqlc.types.Field("Commit", graphql_name="node")
CommitEdge
python
run-llama__llama_index
llama-index-integrations/embeddings/llama-index-embeddings-isaacus/tests/test_isaacus_embeddings.py
{ "start": 1166, "end": 12629 }
class ____: """Test IsaacusEmbedding class.""" def test_class_name(self, isaacus_embedding: IsaacusEmbedding) -> None: """Test class name.""" assert IsaacusEmbedding.class_name() == "IsaacusEmbedding" assert isaacus_embedding.class_name() == "IsaacusEmbedding" def test_init_with_pa...
TestIsaacusEmbedding
python
django__django
tests/model_inheritance/models.py
{ "start": 539, "end": 811 }
class ____(models.Model): name = models.CharField(max_length=50) age = models.PositiveIntegerField() class Meta: abstract = True ordering = ["name"] def __str__(self): return "%s %s" % (self.__class__.__name__, self.name)
CommonInfo
python
facebook__pyre-check
scripts/compare_pysa_models_to_json.py
{ "start": 1239, "end": 13327 }
class ____(TypedDict): parameters: Dict[str, TaintModel] return_model: TaintModel def make_default_taint_model() -> TaintModel: return { "sources": set(), "sinks": set(), "tito": set(), } def make_default_target_model() -> TargetModel: return { "parameters": defau...
TargetModel
python
facebook__pyre-check
tools/generate_taint_models/tests/get_request_specific_data_test.py
{ "start": 384, "end": 1367 }
class ____(unittest.TestCase): def test_compute_models(self) -> None: source = "TaintSource[RequestSpecificData]" self.assertEqual( [ *map( str, RequestSpecificDataGenerator( django_urls=MagicMock() ...
GetRequestSpecificDataTest
python
ionelmc__pytest-benchmark
tests/test_storage.py
{ "start": 1718, "end": 21262 }
class ____(BenchmarkSession): def __init__(self, name_format): self.histogram = True self.verbose = False self.quiet = False self.benchmarks = [] self.performance_regressions = [] self.sort = 'min' self.compare = '0001' logger = logging.getLogger(__nam...
MockSession
python
ray-project__ray
rllib/models/tf/tf_action_dist.py
{ "start": 687, "end": 1714 }
class ____(ActionDistribution): """TF-specific extensions for building action distributions.""" @override(ActionDistribution) def __init__(self, inputs: List[TensorType], model: ModelV2): super().__init__(inputs, model) self.sample_op = self._build_sample_op() self.sampled_action_lo...
TFActionDistribution
python
getsentry__sentry
src/sentry/workflow_engine/typings/notification_action.py
{ "start": 11647, "end": 12493 }
class ____(BaseActionTranslator): @property def action_type(self) -> ActionType: return ActionType.PAGERDUTY field_mappings = { "priority": FieldMapping( source_field="severity", default_value=str(PAGERDUTY_DEFAULT_SEVERITY) ) } @property def required_fields...
PagerDutyActionTranslator
python
pydantic__pydantic
pydantic-core/tests/test_errors.py
{ "start": 37697, "end": 49841 }
class ____: def __str__(self): return 'custom str' def test_error_json_unknown(): s = SchemaValidator(core_schema.str_schema()) with pytest.raises(ValidationError) as exc_info: s.validate_python(Foobar()) # insert_assert(exc_info.value.errors(include_url=False)) assert exc_info.va...
CustomStr
python
PrefectHQ__prefect
src/integrations/prefect-kubernetes/prefect_kubernetes/jobs.py
{ "start": 17830, "end": 20353 }
class ____(JobBlock): """A block representing a Kubernetes job configuration.""" v1_job: Dict[str, Any] = Field( default=..., title="Job Manifest", description=( "The Kubernetes job manifest to run. This dictionary can be produced " "using `yaml.safe_load`." ...
KubernetesJob
python
weaviate__weaviate-python-client
weaviate/collections/aggregations/near_image/sync.py
{ "start": 195, "end": 258 }
class ____(_NearImageExecutor[ConnectionSync]): pass
_NearImage
python
realpython__materials
inheritance-and-composition/inheritance/employees.py
{ "start": 425, "end": 618 }
class ____(Employee, SecretaryRole, SalaryPolicy): def __init__(self, id, name, weekly_salary): SalaryPolicy.__init__(self, weekly_salary) super().__init__(id, name)
Secretary
python
getsentry__sentry
src/sentry/integrations/slack/message_builder/issues.py
{ "start": 17091, "end": 29760 }
class ____(BlockSlackMessageBuilder): """Build an issue alert notification for Slack""" def __init__( self, group: Group, event: Event | GroupEvent | None = None, tags: set[str] | None = None, identity: RpcIdentity | None = None, actions: Sequence[MessageAction |...
SlackIssuesMessageBuilder
python
spack__spack
lib/spack/spack/vendor/ruamel/yaml/main.py
{ "start": 32398, "end": 58756 }
class ____: def __init__(self, yaml, transform=None): # type: (Any, Any) -> None # used to be: (Any, Optional[Callable]) -> None self._yaml = yaml self._output_inited = False self._output_path = None self._output = self._yaml._output self._transform = transform ...
YAMLContextManager
python
run-llama__llama_index
llama-index-integrations/vector_stores/llama-index-vector-stores-azureaisearch/llama_index/vector_stores/azureaisearch/base.py
{ "start": 64267, "end": 64623 }
class ____(AzureQueryResultSearchBase): def _create_search_query(self) -> str: if self._query.query_str is None: raise ValueError("Query missing query string") search_query = self._query.query_str logger.info(f"Hybrid search with search text: {search_query}") return sea...
AzureQueryResultSearchSparse
python
tensorflow__tensorflow
tensorflow/python/data/ops/zip_op.py
{ "start": 1046, "end": 2353 }
class ____(dataset_ops.DatasetV2): """A `Dataset` that zips its inputs together.""" def __init__(self, datasets, name=None): """See `Dataset.zip()` for details.""" for ds in nest.flatten(datasets): if not isinstance(ds, data_types.DatasetV2): if isinstance(ds, list): raise TypeError...
_ZipDataset
python
django-guardian__django-guardian
guardian/exceptions.py
{ "start": 571, "end": 718 }
class ____(GuardianError): """Raised when content type for the provided permissions and/or class do not match.""" pass
MixedContentTypeError
python
allegroai__clearml
clearml/backend_api/services/v2_13/workers.py
{ "start": 83491, "end": 83744 }
class ____(Response): """ Response of workers.status_report endpoint. """ _service = "workers" _action = "status_report" _version = "2.13" _schema = {"definitions": {}, "properties": {}, "type": "object"}
StatusReportResponse
python
spyder-ide__spyder
spyder/plugins/editor/widgets/editorstack/editorstack.py
{ "start": 2469, "end": 3041 }
class ____: CopyAbsolutePath = "copy_absolute_path_action" CopyRelativePath = "copy_relative_path_action" CloseAllRight = "close_all_rigth_action" CloseAllLeft = "close_all_left_action" CloseAllButThis = "close_all_but_this_action" SortTabs = "sort_tabs_action" ShowInExternalFileExplorer = "...
EditorStackActions
python
huggingface__transformers
src/transformers/models/vipllava/modular_vipllava.py
{ "start": 2348, "end": 7197 }
class ____(LlavaModel): def get_image_features( self, pixel_values: torch.FloatTensor, vision_feature_layers: Optional[Union[int, list[int]]] = None ): """ Obtains image last hidden states from the vision tower and apply multimodal projection. Args: pixel_values (`to...
VipLlavaModel
python
getsentry__sentry
tests/sentry/receivers/test_featureadoption.py
{ "start": 821, "end": 23317 }
class ____(TestCase, SnubaTestCase): def setUp(self) -> None: super().setUp() self.now = timezone.now() self.owner = self.create_user() self.organization = self.create_organization(owner=self.owner) self.team = self.create_team(organization=self.organization) self.pro...
FeatureAdoptionTest
python
pydantic__pydantic
pydantic/v1/fields.py
{ "start": 48882, "end": 50366 }
class ____(Representation): __slots__ = ('default', 'default_factory') def __init__(self, default: Any = Undefined, *, default_factory: Optional[NoArgAnyCallable] = None) -> None: self.default = default self.default_factory = default_factory def get_default(self) -> Any: return sma...
ModelPrivateAttr
python
ansible__ansible
test/units/parsing/vault/test_vault.py
{ "start": 16615, "end": 17654 }
class ____(unittest.TestCase): def test_bytes_not_encrypted(self): b_data = b"foobar" self.assertFalse(vault.is_encrypted(b_data)) def test_bytes_encrypted(self): b_data = b"$ANSIBLE_VAULT;9.9;TEST\n%s" % hexlify(b"ansible") self.assertTrue(vault.is_encrypted(b_data)) def t...
TestVaultIsEncrypted
python
getsentry__sentry
src/sentry/integrations/models/integration_feature.py
{ "start": 4402, "end": 4673 }
class ____(Enum): SENTRY_APP = 0 DOC_INTEGRATION = 1 INTEGRATION_MODELS_BY_TYPE: dict[int, type[SentryApp] | type[DocIntegration]] = { IntegrationTypes.SENTRY_APP.value: SentryApp, IntegrationTypes.DOC_INTEGRATION.value: DocIntegration, }
IntegrationTypes
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/linalg/linalg_ops_test.py
{ "start": 16156, "end": 17230 }
class ____(object): dtype = np.float32 use_static_shape = True def test_non_batch(self): x_ = np.array([[1, 2], [3, 4]], dtype=self.dtype) x = array_ops.placeholder_with_default( x_, shape=x_.shape if self.use_static_shape else None) y = linalg.lu_matrix_inverse(*linalg.lu(x), validate_args=...
_LUMatrixInverse
python
pypa__setuptools
setuptools/_vendor/backports/tarfile/__init__.py
{ "start": 24261, "end": 24427 }
class ____(FilterError): def __init__(self, tarinfo): self.tarinfo = tarinfo super().__init__(f'{tarinfo.name!r} is a special file')
SpecialFileError
python
kamyu104__LeetCode-Solutions
Python/tree-diameter.py
{ "start": 1774, "end": 2892 }
class ____(object): def treeDiameter(self, edges): """ :type edges: List[List[int]] :rtype: int """ def bfs(): result = 0 dp = [0]*len(adj) degree = map(len, adj) q = [u for u in xrange(len(degree)) if degree[u] == 1] ...
Solution3
python
pyqtgraph__pyqtgraph
pyqtgraph/dockarea/Container.py
{ "start": 6717, "end": 6967 }
class ____(QtWidgets.QStackedWidget): def __init__(self, *, container): super().__init__() self.container = container def childEvent(self, ev): super().childEvent(ev) self.container.childEvent_(ev)
StackedWidget
python
PyCQA__bandit
bandit/core/manager.py
{ "start": 767, "end": 17283 }
class ____: scope = [] def __init__( self, config, agg_type, debug=False, verbose=False, quiet=False, profile=None, ignore_nosec=False, ): """Get logger, config, AST handler, and result store ready :param config: config option...
BanditManager
python
dagster-io__dagster
python_modules/dagster/dagster/components/lib/shim_components/job.py
{ "start": 237, "end": 565 }
class ____(ShimScaffolder): def get_text(self, request: ScaffoldRequest) -> str: return textwrap.dedent( f"""\ import dagster as dg @dg.job def {request.target_path.stem}(): pass """ ) scaffold_with(JobScaffolder)(job)
JobScaffolder
python
django__django
django/db/models/expressions.py
{ "start": 51093, "end": 52303 }
class ____(SQLiteNumericMixin, Expression): """ An expression that can wrap another expression so that it can provide extra context to the inner expression, such as the output_field. """ def __init__(self, expression, output_field): super().__init__(output_field=output_field) self.e...
ExpressionWrapper
python
getsentry__responses
responses/tests/test_responses.py
{ "start": 23873, "end": 27451 }
class ____: class CustomAdapter(requests.adapters.HTTPAdapter): """Classic custom adapter.""" def send(self, *a, **k): return super().send(*a, **k) class PositionalArgsAdapter(requests.adapters.HTTPAdapter): """Custom adapter that sends only positional args. See htt...
TestAdapters
python
prompt-toolkit__python-prompt-toolkit
src/prompt_toolkit/widgets/toolbars.py
{ "start": 1907, "end": 5954 }
class ____: """ Toolbar for a system prompt. :param prompt: Prompt to be displayed to the user. """ def __init__( self, prompt: AnyFormattedText = "Shell command: ", enable_global_bindings: FilterOrBool = True, ) -> None: self.prompt = prompt self.enable...
SystemToolbar
python
walkccc__LeetCode
solutions/1380. Lucky Numbers in a Matrix/1380.py
{ "start": 0, "end": 246 }
class ____: def luckyNumbers(self, matrix: list[list[int]]) -> list[int]: for row in matrix: minIndex = row.index(min(row)) if row[minIndex] == max(list(zip(*matrix))[minIndex]): return [row[minIndex]] return []
Solution
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/array_ops/spacetobatch_op_test.py
{ "start": 15138, "end": 20265 }
class ____(test.TestCase): def _testStaticShape(self, input_shape, block_shape, paddings, error): block_shape = np.array(block_shape) paddings = np.array(paddings) # Try with sizes known at graph construction time. with self.assertRaises(error): _ = array_ops.space_to_batch_nd( np.ze...
SpaceToBatchNDErrorHandlingTest
python
anthropics__anthropic-sdk-python
src/anthropic/types/server_tool_use_block.py
{ "start": 218, "end": 368 }
class ____(BaseModel): id: str input: Dict[str, object] name: Literal["web_search"] type: Literal["server_tool_use"]
ServerToolUseBlock
python
pytorch__pytorch
test/dynamo/cpython/3_13/test_ordered_dict.py
{ "start": 708, "end": 2332 }
class ____(importlib.abc.MetaPathFinder): def find_spec(self, fullname, path, target=None): # Check if the import is the problematic one if fullname in redirect_imports: try: # Attempt to import the standalone module name = fullname.removeprefix("test.") ...
RedirectImportFinder
python
apache__airflow
airflow-ctl/tests/airflow_ctl/ctl/commands/test_pool_command.py
{ "start": 4341, "end": 7520 }
class ____: """Test cases for pool export command.""" def test_export_json_to_file(self, mock_client, tmp_path, capsys): """Test successful pool export to file with json output.""" export_file = tmp_path / "export.json" # Create a proper pool object with dictionary attributes instead of...
TestPoolExportCommand
python
google__jax
tests/transfer_guard_test.py
{ "start": 3545, "end": 8642 }
class ____(jtu.JaxTestCase): def setUp(self): super().setUp() # Nearly all test methods use the deprecated device argument to JIT. self.enter_context(jtu.ignore_warning(category=DeprecationWarning, message="backend and device argument")) @contextlib.contextmana...
TransferGuardTest
python
getsentry__sentry
tests/sentry/deletions/test_sentry_installation_tokens.py
{ "start": 369, "end": 1295 }
class ____(TestCase): def setUp(self) -> None: self.user = self.create_user() self.org = self.create_organization(owner=self.user) self.create_project(organization=self.org) self.sentry_app = self.create_internal_integration(name="nulldb", organization=self.org) self.sentry...
TestSentryInstallationTokenDeletionTask
python
sympy__sympy
sympy/functions/special/hyper.py
{ "start": 29967, "end": 30711 }
class ____(HyperRep): """ Return a representative for hyper([a, a - 1/2], [2*a], z). """ @classmethod def _expr_small(cls, a, x): return 2**(2*a - 1)*(1 + sqrt(1 - x))**(1 - 2*a) @classmethod def _expr_small_minus(cls, a, x): return 2**(2*a - 1)*(1 + sqrt(1 + x))**(1 - 2*a) @c...
HyperRep_power2
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 1248470, "end": 1248721 }
class ____(sgqlc.types.Type, Node, AuditEntry, OrganizationAuditEntryData): """Audit log entry for a org.config.disable_collaborators_only event.""" __schema__ = github_schema __field_names__ = ()
OrgConfigDisableCollaboratorsOnlyAuditEntry
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/orm/base.py
{ "start": 7015, "end": 7157 }
class ____(Enum): """Symbols indicating the type of extension that a :class:`.InspectionAttr` is part of."""
InspectionAttrExtensionType
python
django__django
django/db/backends/oracle/introspection.py
{ "start": 494, "end": 15939 }
class ____(BaseDatabaseIntrospection): cache_bust_counter = 1 # Maps type objects to Django Field types. data_types_reverse = { oracledb.DB_TYPE_DATE: "DateField", oracledb.DB_TYPE_BINARY_DOUBLE: "FloatField", oracledb.DB_TYPE_BLOB: "BinaryField", oracledb.DB_TYPE_CHAR: "Cha...
DatabaseIntrospection
python
numba__numba
numba/cuda/tests/cudadrv/test_cuda_devicerecord.py
{ "start": 3808, "end": 5766 }
class ____(CUDATestCase): ''' Test operation of device arrays on structured arrays. ''' def _createSampleArrays(self): self.sample1d = cuda.device_array(3, dtype=recordtype) self.samplerec1darr = cuda.device_array(1, dtype=recordwitharray)[0] self.samplerecmat = cuda.device_arra...
TestRecordDtypeWithStructArrays
python
sanic-org__sanic
sanic/headers.py
{ "start": 5508, "end": 7979 }
class ____: """A matching result of a MIME string against a header. This class is a representation of a matching result of a MIME string against a header. It encapsulates the MIME string, the header, and provides methods for matching against other MIME strings. Args: mime (str): The MIME s...
Matched
python
ansible__ansible
test/units/plugins/cache/test_cache.py
{ "start": 3305, "end": 4620 }
class ____(TestCachePluginAdjudicator): cache_prefix = '' def setUp(self): self.cache_dir = tempfile.mkdtemp(prefix='ansible-plugins-cache-') self.cache = self.get_cache(self.cache_prefix) self.cache['cache_key'] = {'key1': 'value1', 'key2': 'value2'} self.cache['cache_key_2'] =...
TestJsonFileCache
python
airbytehq__airbyte
airbyte-integrations/connectors/source-webflow/source_webflow/source.py
{ "start": 1429, "end": 2425 }
class ____(HttpStream, ABC): """ This class represents a stream output by the connector. This is an abstract base class meant to contain all the common functionality at the API level e.g: the API base URL, pagination strategy, parsing responses etc.. Each stream should extend this class (or another...
WebflowStream
python
dagster-io__dagster
python_modules/dagster/dagster/_core/definitions/metadata/metadata_value.py
{ "start": 25062, "end": 25406 }
class ____(MetadataValue[float]): """Container class for metadata value that's a unix timestamp. Args: value (float): Seconds since the unix epoch. """ value: PublicAttr[float] # type: ignore @whitelist_for_serdes(storage_name="DagsterPipelineRunMetadataEntryData") @public @record(kw_only=F...
TimestampMetadataValue
python
ray-project__ray
rllib/examples/envs/classes/mock_env.py
{ "start": 171, "end": 842 }
class ____(gym.Env): """Mock environment for testing purposes. Observation=0, reward=1.0, episode-len is configurable. Actions are ignored. """ def __init__(self, episode_length, config=None): self.episode_length = episode_length self.config = config self.i = 0 self...
MockEnv
python
django__django
tests/queries/tests.py
{ "start": 173450, "end": 174560 }
class ____(TestCase): def test_values_no_promotion_for_existing(self): qs = Node.objects.filter(parent__parent__isnull=False) self.assertIn(" INNER JOIN ", str(qs.query)) qs = qs.values("parent__parent__id") self.assertIn(" INNER JOIN ", str(qs.query)) # Make sure there is a ...
ValuesJoinPromotionTests
python
tqdm__tqdm
tests/tests_synchronisation.py
{ "start": 783, "end": 2208 }
class ____(Event): """patched `threading.Event` where `wait()` uses `Time.fake_sleep()`""" def wait(self, timeout=None): """uses Time.fake_sleep""" if timeout is not None: Time.fake_sleep(timeout) return self.is_set() def patch_sleep(func): """Temporarily makes TMonitor...
FakeEvent
python
pytorch__pytorch
torch/_higher_order_ops/utils.py
{ "start": 41064, "end": 47079 }
class ____: def __init__(self, op: HigherOrderOperator, schema: HopSchema): assert isinstance(op, HigherOrderOperator), op self._op = op # Using "_" to be consistent with how we access _schema of OpOverload self._schema = schema def __call__(self, *args, **kwargs): retur...
HopInstance
python
python-visualization__folium
folium/plugins/overlapping_marker_spiderfier.py
{ "start": 195, "end": 3543 }
class ____(JSCSSMixin, MacroElement): """ A plugin that handles overlapping markers on a map by spreading them out in a spiral or circle pattern when clicked. This plugin is useful when you have multiple markers in close proximity that would otherwise be difficult to interact with. When a user clicks o...
OverlappingMarkerSpiderfier
python
getsentry__sentry
src/sentry/ingest/billing_metrics_consumer.py
{ "start": 732, "end": 1053 }
class ____(ProcessingStrategyFactory[KafkaPayload]): def create_with_partitions( self, commit: Commit, partitions: Mapping[Partition, int], ) -> ProcessingStrategy[KafkaPayload]: return BillingTxCountMetricConsumerStrategy(CommitOffsets(commit))
BillingMetricsConsumerStrategyFactory
python
getsentry__sentry
src/sentry/organizations/services/organization/impl.py
{ "start": 32976, "end": 33519 }
class ____(OrganizationSignalService): def schedule_signal( self, signal: Signal, organization_id: int, args: Mapping[str, int | str | None] ) -> None: _signal = RpcOrganizationSignal.from_signal(signal) transaction.on_commit( lambda: DatabaseBackedOrganizationService().send_...
OnCommitBackedOrganizationSignalService
python
apache__airflow
providers/amazon/tests/unit/amazon/aws/executors/batch/test_utils.py
{ "start": 2244, "end": 2706 }
class ____: """Tests for the BatchJobInfo dataclass.""" def test_batch_job_info_creation(self): """Test BatchJobInfo object creation.""" cmd = ["airflow", "tasks", "run"] queue = "default_queue" config = {"key": "value"} job_info = BatchJobInfo(cmd=cmd, queue=queue, con...
TestBatchJobInfo
python
scipy__scipy
benchmarks/benchmarks/cluster.py
{ "start": 3529, "end": 4269 }
class ____(XPBenchmark): if is_xslow(): shape = [(10, 10), (32, 32), (100, 100), (320, 320), (1000, 1000), (3200, 3200), (10_000, 10_000)] else: shape = [(10, 10), (100, 100)] param_names = (*XPBenchmark.param_names, "shape") params = (*XPBenchmark.params, shape) d...
Whiten
python
numpy__numpy
numpy/distutils/tests/test_exec_command.py
{ "start": 370, "end": 843 }
class ____: """Context manager to redirect stdout for exec_command test.""" def __init__(self, stdout=None): self._stdout = stdout or sys.stdout def __enter__(self): self.old_stdout = sys.stdout sys.stdout = self._stdout def __exit__(self, exc_type, exc_value, traceback): ...
redirect_stdout
python
Netflix__metaflow
metaflow/cmd/develop/stub_generator.py
{ "start": 1818, "end": 7908 }
class ____: def __init__(self, start: int, end: int): self._start = start self._end = end def start(self): return self._start def end(self): return self._end def type_var_to_str(t: TypeVar) -> str: bound_name = None if t.__bound__ is not None: if isinstanc...
StartEnd
python
tornadoweb__tornado
tornado/test/web_test.py
{ "start": 116980, "end": 118970 }
class ____(WebTestCase): def get_handlers(self): class EtagHandler(RequestHandler): def get(self, computed_etag): self.write(computed_etag) def compute_etag(self): return self._write_buffer[0] return [("/etag/(.*)", EtagHandler)] def tes...
CacheTest
python
doocs__leetcode
solution/2300-2399/2321.Maximum Score Of Spliced Array/Solution.py
{ "start": 0, "end": 491 }
class ____: def maximumsSplicedArray(self, nums1: List[int], nums2: List[int]) -> int: def f(nums1, nums2): d = [a - b for a, b in zip(nums1, nums2)] t = mx = d[0] for v in d[1:]: if t > 0: t += v else: ...
Solution
python
kamyu104__LeetCode-Solutions
Python/maximum-number-of-groups-entering-a-competition.py
{ "start": 36, "end": 308 }
class ____(object): def maximumGroups(self, grades): """ :type grades: List[int] :rtype: int """ # (1+x)*x/2 <= len(grades) # => x <= ((1+8*len(grades))**0.5-1)/2.0 return int(((1+8*len(grades))**0.5-1)/2.0)
Solution
python
tensorflow__tensorflow
tensorflow/core/function/trace_type/trace_type_test.py
{ "start": 14820, "end": 15940 }
class ____(test.TestCase): def testTensorSpecs(self): self.assertEqual( trace_type.from_value( tensor_spec.TensorSpec(shape=None), trace_type.InternalTracingContext(is_legacy_signature=True)), tensor_spec.TensorSpec(shape=None)) def testListofTensorSpecs(self): self...
SignatureToTraceTypeTest
python
dagster-io__dagster
python_modules/libraries/dagster-airbyte/dagster_airbyte/managed/generated/sources.py
{ "start": 23190, "end": 23703 }
class ____(GeneratedAirbyteSource): @public def __init__(self, name: str, jwt: str): """Airbyte Source for Zoom Singer. Documentation can be found at https://docs.airbyte.com/integrations/sources/zoom Args: name (str): The name of the destination. jwt (str): Zoo...
ZoomSingerSource
python
python-excel__xlwt
xlwt/antlr.py
{ "start": 62956, "end": 63263 }
class ____(object): def __init__(self): self.guessing = 0 ###xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx### ### TreeParser ### ###xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx###
TreeParserSharedInputState
python
pytorch__pytorch
torch/distributed/checkpoint/filesystem.py
{ "start": 6704, "end": 15562 }
class ____: """ This is experimental, and will likely move elsewhere in the future. It lives here to minimize changes while we are still learning and gathering feedback. """ def __init__( self, extensions: Optional[Sequence[StreamTransformExtension]] = None ) -> None: """ ...
_StorageWriterTransforms
python
falconry__falcon
tests/test_uri_templates.py
{ "start": 923, "end": 1152 }
class ____: def __init__(self): self.id = None self.name = None self.called = False def on_get(self, req, resp, id): self.id = id self.called = True self.req = req
IDResource
python
django__django
tests/forms_tests/tests/tests.py
{ "start": 906, "end": 1031 }
class ____(ModelForm): class Meta: model = ChoiceModel fields = ["name", "choice"]
EmptyCharLabelChoiceForm
python
django__django
tests/auth_tests/test_views.py
{ "start": 68590, "end": 70335 }
class ____(TestCase): def test_admin_password_change(self): u = UUIDUser.objects.create_superuser( username="uuid", email="foo@bar.com", password="test" ) self.assertTrue(self.client.login(username="uuid", password="test")) user_change_url = reverse( "custom_...
UUIDUserTests
python
kamyu104__LeetCode-Solutions
Python/valid-boomerang.py
{ "start": 29, "end": 334 }
class ____(object): def isBoomerang(self, points): """ :type points: List[List[int]] :rtype: bool """ return (points[0][0] - points[1][0]) * (points[0][1] - points[2][1]) - \ (points[0][0] - points[2][0]) * (points[0][1] - points[1][1]) != 0
Solution
python
plotly__plotly.py
plotly/graph_objs/layout/yaxis/_rangebreak.py
{ "start": 235, "end": 11958 }
class ____(_BaseLayoutHierarchyType): _parent_path_str = "layout.yaxis" _path_str = "layout.yaxis.rangebreak" _valid_props = { "bounds", "dvalue", "enabled", "name", "pattern", "templateitemname", "values", } @property def bounds(self): ...
Rangebreak
python
wandb__wandb
wandb/vendor/graphql-core-1.1/wandb_graphql/language/ast.py
{ "start": 24236, "end": 25455 }
class ____(Node): __slots__ = ('loc', 'name', 'arguments', 'type', 'directives',) _fields = ('name', 'arguments', 'type',) def __init__(self, name, arguments, type, loc=None, directives=None): self.loc = loc self.name = name self.arguments = arguments self.type = type ...
FieldDefinition
python
tiangolo__fastapi
scripts/deploy_docs_status.py
{ "start": 172, "end": 391 }
class ____(BaseSettings): github_repository: str github_token: SecretStr deploy_url: str | None = None commit_sha: str run_id: int state: Literal["pending", "success", "error"] = "pending"
Settings
python
huggingface__transformers
src/transformers/models/glpn/modeling_glpn.py
{ "start": 10393, "end": 12179 }
class ____(nn.Module): """This corresponds to the Block class in the original implementation.""" def __init__(self, config, hidden_size, num_attention_heads, drop_path, sequence_reduction_ratio, mlp_ratio): super().__init__() self.layer_norm_1 = nn.LayerNorm(hidden_size) self.attention ...
GLPNLayer
python
PrefectHQ__prefect
src/integrations/prefect-databricks/prefect_databricks/models/jobs.py
{ "start": 78823, "end": 79654 }
class ____(BaseModel): """ See source code for the fields' description. """ model_config = ConfigDict(extra="allow", frozen=True) is_library_for_all_clusters: Optional[bool] = Field( None, description=( "Whether the library was set to be installed on all clusters via th...
LibraryFullStatus
python
tensorflow__tensorflow
tensorflow/python/util/nest_test.py
{ "start": 81496, "end": 82336 }
class ____(test.Benchmark): def run_and_report(self, s1, s2, name): burn_iter, test_iter = 100, 30000 for _ in range(burn_iter): nest.assert_same_structure(s1, s2) t0 = time.time() for _ in range(test_iter): nest.assert_same_structure(s1, s2) t1 = time.time() self.report_benchm...
NestBenchmark
python
conda__conda
conda/models/match_spec.py
{ "start": 33116, "end": 34009 }
class ____(metaclass=ABCMeta): def __init__(self, value): self._raw_value = value @abstractmethod def match(self, other): raise NotImplementedError() def matches(self, value): return self.match(value) @property def raw_value(self): return self._raw_value @...
MatchInterface
python
rushter__MLAlgorithms
mla/neuralnet/layers/convnet.py
{ "start": 4412, "end": 7845 }
class ____(Layer): """Flattens multidimensional input into 2D matrix.""" def forward_pass(self, X): self.last_input_shape = X.shape return X.reshape((X.shape[0], -1)) def backward_pass(self, delta): return delta.reshape(self.last_input_shape) def shape(self, x_shape): ...
Flatten
python
tiangolo__fastapi
tests/test_webhooks_security.py
{ "start": 271, "end": 4667 }
class ____(BaseModel): username: str monthly_fee: float start_date: datetime @app.webhooks.post("new-subscription") def new_subscription( body: Subscription, token: Annotated[str, Security(bearer_scheme)] ): """ When a new user subscribes to your service we'll send you a POST request with this...
Subscription
python
wandb__wandb
wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/win32stat.py
{ "start": 1305, "end": 3828 }
class ____(ctypes.Structure): _fields_ = [('dwFileAttributes', ctypes.wintypes.DWORD), ('ftCreationTime', FILETIME), ('ftLastAccessTime', FILETIME), ('ftLastWriteTime', FILETIME), ('dwVolumeSerialNumber', ctypes.wintypes.DWORD), ('nFile...
BY_HANDLE_FILE_INFORMATION
python
django__django
tests/sitemaps_tests/urls/http.py
{ "start": 2000, "end": 2094 }
class ____(SimpleSitemap): lastmod = datetime(2013, 4, 20, 5, 0, 0)
FixedNewerLastmodSitemap
python
dask__dask
dask/dataframe/dask_expr/_cumulative.py
{ "start": 1185, "end": 1644 }
class ____(Blockwise): _parameters = ["frame", "axis", "skipna", "operation"] _defaults = {"skipna": True, "axis": None} _projection_passthrough = True @functools.cached_property def _meta(self): return self.frame._meta @functools.cached_property def operation(self): return...
CumulativeBlockwise
python
django-import-export__django-import-export
import_export/management/commands/export.py
{ "start": 187, "end": 2136 }
class ____(BaseCommand): help = "Export data from a specified resource or model in a chosen format." def add_arguments(self, parser): default_format_names = get_default_format_names() parser.add_argument( "format", help=f"""Specify the export format. Can be one of the de...
Command
python
Netflix__metaflow
test/cmd/develop/test_stub_generator.py
{ "start": 370, "end": 468 }
class ____(typing.Generic[T, U]): """Complex generic test class""" pass
ComplexGenericClass
python
facelessuser__soupsieve
tests/test_level4/test_past.py
{ "start": 49, "end": 785 }
class ____(util.TestCase): """Test past selectors.""" MARKUP = """ <body> <div id="div"> <p id="0">Some text <span id="1" class="foo:bar:foobar"> in a paragraph</span>. <a id="2" class="bar" href="http://google.com">Link</a> <a id="3">Placeholder text.</a> </p> </div> </body> ...
TestPast
python
apache__airflow
providers/google/tests/unit/google/cloud/operators/test_datafusion.py
{ "start": 3357, "end": 4152 }
class ____: @mock.patch(RESOURCE_PATH_TO_DICT_STR) @mock.patch(HOOK_STR) def test_execute_check_hook_call_should_execute_successfully(self, mock_hook, mock_resource_path_to_dict): mock_resource_path_to_dict.return_value = {"projects": PROJECT_ID} op = CloudDataFusionRestartInstanceOperator( ...
TestCloudDataFusionRestartInstanceOperator
python
PyCQA__pylint
pylint/extensions/for_any_all.py
{ "start": 645, "end": 5849 }
class ____(BaseChecker): name = "consider-using-any-or-all" msgs = { "C0501": ( "`for` loop could be `%s`", "consider-using-any-or-all", "A for loop that checks for a condition and return a bool can be replaced with any or all.", ) } @only_required_fo...
ConsiderUsingAnyOrAllChecker
python
getsentry__sentry
src/sentry/sentry_apps/api/serializers/sentry_app_webhook_request.py
{ "start": 663, "end": 753 }
class ____(TypedDict): organization: RpcOrganizationMapping | None
_BufferedRequestAttrs
python
protocolbuffers__protobuf
python/google/protobuf/internal/well_known_types.py
{ "start": 21306, "end": 23338 }
class ____(object): """Class for ListValue message type.""" __slots__ = () def __len__(self): return len(self.values) def append(self, value): _SetStructValue(self.values.add(), value) def extend(self, elem_seq): for value in elem_seq: self.append(value) def __getitem__(self, index): ...
ListValue
python
facelessuser__pymdown-extensions
tests/test_extensions/test_superfences.py
{ "start": 35630, "end": 36445 }
class ____(util.MdCase): """Test custom validator and format.""" extension = ['pymdownx.superfences'] extension_configs = { 'pymdownx.superfences': { 'custom_fences': [ { 'name': 'test', 'class': 'test', 'format...
TestSuperFencesCustomException
python
mlflow__mlflow
mlflow/server/fastapi_security.py
{ "start": 3438, "end": 6433 }
class ____: """Middleware to actively block cross-origin state-changing requests.""" def __init__(self, app: ASGIApp, allowed_origins: list[str]): self.app = app self.allowed_origins = allowed_origins async def __call__(self, scope, receive, send): if scope["type"] != "http": ...
CORSBlockingMiddleware