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
getsentry__sentry
src/sentry/consumers/__init__.py
{ "start": 26317, "end": 26744 }
class ____(ProcessingStrategyFactory): def __init__(self, healthcheck_file_path: str, inner: ProcessingStrategyFactory): self.healthcheck_file_path = healthcheck_file_path self.inner = inner def create_with_partitions(self, commit, partitions): rv = self.inner.create_with_partitions(com...
HealthcheckStrategyFactoryWrapper
python
getsentry__sentry
src/sentry/testutils/cases.py
{ "start": 27626, "end": 27825 }
class ____(BaseTestCase, BaseAPITransactionTestCase, APITestCaseMixin): # We need Django to flush all databases. databases: set[str] | str = "__all__" method = "get"
APITransactionTestCase
python
getsentry__sentry
src/sentry/conduit/endpoints/organization_conduit_demo.py
{ "start": 780, "end": 895 }
class ____(serializers.Serializer): conduit = ConduitCredentialsSerializer()
ConduitCredentialsResponseSerializer
python
catalyst-team__catalyst
examples/recsys/multivae.py
{ "start": 1159, "end": 3418 }
class ____(nn.Module): def __init__(self, p_dims, q_dims=None, dropout=0.5): super().__init__() self.p_dims = p_dims if q_dims: assert ( q_dims[0] == p_dims[-1] ), "In and Out dimensions must equal to each other" assert ( q_...
MultiVAE
python
cython__cython
Cython/Compiler/Nodes.py
{ "start": 393817, "end": 395741 }
class ____(StatNode): # cimport statement # # module_name string Qualified name of module being imported # as_name string or None Name specified in "as" clause, if any # is_absolute bool True for absolute imports, False otherwise child_attrs = [] is_abs...
CImportStatNode
python
spyder-ide__spyder
spyder/plugins/completion/api.py
{ "start": 17401, "end": 17579 }
class ____: """Language Server Protocol event types.""" DOCUMENT = 'textDocument' WORKSPACE = 'workspace' WINDOW = 'window' CODE_LENS = 'codeLens'
LSPEventTypes
python
celery__celery
t/unit/app/test_beat.py
{ "start": 657, "end": 892 }
class ____: started = False stopped = False def __init__(self, *args, **kwargs): pass def start(self, **kwargs): self.started = True def stop(self, **kwargs): self.stopped = True
MockService
python
getlogbook__logbook
src/logbook/handlers.py
{ "start": 53285, "end": 60145 }
class ____(Handler, StringFormatterHandlerMixin): """A handler class which sends formatted logging records to a syslog server. By default it will send to it via unix socket. """ default_format_string = SYSLOG_FORMAT_STRING # priorities LOG_EMERG = 0 # system is unusable LOG_ALERT = 1 # ...
SyslogHandler
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/inconsistentConstructor1.py
{ "start": 104, "end": 165 }
class ____: def __init__(self, a: int) -> None: ...
Parent1
python
pytorch__pytorch
torch/_inductor/template_heuristics/triton.py
{ "start": 63838, "end": 64723 }
class ____(MMTemplateConfigMixin): """ Small mixin to ensure that the workspace arg is correct for TMA and TMA specific filtering can happen. """ def get_extra_kwargs( self, kernel_inputs: KernelInputs, op_name: str, ) -> dict[str, Any]: kwargs = super().get_extr...
TMAWorkspaceMixin
python
celery__celery
t/smoke/workers/latest.py
{ "start": 198, "end": 1761 }
class ____(CeleryWorkerContainer): """Defines the configurations for a Celery worker container. This worker will install the latest version of Celery from PyPI. """ @property def client(self) -> Any: return self @classmethod def log_level(cls) -> str: return "INFO" @c...
CeleryLatestWorkerContainer
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_table34.py
{ "start": 315, "end": 1528 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("table34.xlsx") self.ignore_files = [ "xl/calcChain.xml", "[Content_Types].xml", "xl/_rels/workbook.xml.rels...
TestCompareXLSXFiles
python
tensorflow__tensorflow
tensorflow/python/ops/gradients_test.py
{ "start": 28589, "end": 32313 }
class ____(test_util.TensorFlowTestCase): @test_util.run_v1_only("b/120545219") def testHessian1D(self): # Manually compute the Hessian explicitly for a low-dimensional problem # and check that `hessian` matches. Specifically, the Hessian of # f(x) = x^T A x is H = A + A^T. m = 4 rng = np.rando...
HessianTest
python
TheAlgorithms__Python
data_structures/linked_list/middle_element_of_linked_list.py
{ "start": 144, "end": 1543 }
class ____: def __init__(self): self.head = None def push(self, new_data: int) -> int: new_node = Node(new_data) new_node.next = self.head self.head = new_node return self.head.data def middle_element(self) -> int | None: """ >>> link = LinkedList() ...
LinkedList
python
openai__openai-python
src/openai/types/vector_stores/file_batch_list_files_params.py
{ "start": 224, "end": 1451 }
class ____(TypedDict, total=False): vector_store_id: Required[str] after: str """A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include ...
FileBatchListFilesParams
python
fluentpython__example-code-2e
15-more-types/cafeteria/contravariant.py
{ "start": 102, "end": 164 }
class ____(Refuse): """Biodegradable refuse."""
Biodegradable
python
pypa__setuptools
pkg_resources/tests/test_resources.py
{ "start": 554, "end": 1069 }
class ____(pkg_resources.EmptyProvider): """Mock object to return metadata as if from an on-disk distribution""" def __init__(self, *pairs) -> None: self.metadata = dict(pairs) def has_metadata(self, name) -> bool: return name in self.metadata def get_metadata(self, name): ret...
Metadata
python
astropy__astropy
astropy/modeling/projections.py
{ "start": 18609, "end": 19766 }
class ____(Pix2SkyProjection, Cylindrical): r""" Cylindrical perspective - pixel to sky. Corresponds to the ``CYP`` projection in FITS WCS. .. math:: \phi &= \frac{x}{\lambda} \\ \theta &= \arg(1, \eta) + \sin{-1}\left(\frac{\eta \mu}{\sqrt{\eta^2 + 1}}\right) where: .. math:...
Pix2Sky_CylindricalPerspective
python
anthropics__anthropic-sdk-python
src/anthropic/types/citations_web_search_result_location.py
{ "start": 236, "end": 429 }
class ____(BaseModel): cited_text: str encrypted_index: str title: Optional[str] = None type: Literal["web_search_result_location"] url: str
CitationsWebSearchResultLocation
python
run-llama__llama_index
llama-index-integrations/vector_stores/llama-index-vector-stores-postgres/llama_index/vector_stores/postgres/base.py
{ "start": 6171, "end": 50044 }
class ____(BasePydanticVectorStore): """ Postgres Vector Store. Examples: `pip install llama-index-vector-stores-postgres` ```python from llama_index.vector_stores.postgres import PGVectorStore # Create PGVectorStore instance vector_store = PGVectorStore.from_param...
PGVectorStore
python
pytorch__pytorch
tools/linter/adapters/_linter/messages.py
{ "start": 85, "end": 224 }
class ____(str, Enum): ERROR = "error" WARNING = "warning" ADVICE = "advice" DISABLED = "disabled" @dc.dataclass
LintSeverity
python
redis__redis-py
tests/test_asyncio/test_credentials.py
{ "start": 4571, "end": 9308 }
class ____: @skip_if_redis_enterprise() async def test_only_pass_without_creds_provider( self, r_required_pass_teardown, create_redis ): # test for default user (`username` is supposed to be optional) password = "password" r = r_required_pass_teardown(password) await ...
TestCredentialsProvider
python
django__django
tests/inspectdb/models.py
{ "start": 1864, "end": 3053 }
class ____(models.Model): id = models.AutoField(primary_key=True) big_int_field = models.BigIntegerField() bool_field = models.BooleanField(default=False) null_bool_field = models.BooleanField(null=True) char_field = models.CharField(max_length=10) null_char_field = models.CharField(max_length=1...
ColumnTypes
python
fsspec__filesystem_spec
fsspec/implementations/http_sync.py
{ "start": 818, "end": 871 }
class ____(urllib.error.HTTPError): ...
JsHttpException
python
huggingface__transformers
src/transformers/models/sam2_video/modeling_sam2_video.py
{ "start": 28554, "end": 29659 }
class ____(PreTrainedModel): config_class = Sam2VideoConfig base_model_prefix = "sam2_video" main_input_name = "pixel_values" input_modalities = "video" _supports_sdpa = True _supports_flash_attn_2 = True _supports_attention_backend = True @torch.no_grad() def _init_weights(self, mo...
Sam2VideoPreTrainedModel
python
huggingface__transformers
src/transformers/models/unispeech/modeling_unispeech.py
{ "start": 4129, "end": 5927 }
class ____(nn.Module): def __init__(self, config): super().__init__() self.conv = nn.Conv1d( config.hidden_size, config.hidden_size, kernel_size=config.num_conv_pos_embeddings, padding=config.num_conv_pos_embeddings // 2, groups=config.num_...
UniSpeechPositionalConvEmbedding
python
apache__airflow
providers/standard/src/airflow/providers/standard/operators/python.py
{ "start": 41707, "end": 51481 }
class ____(_BasePythonVirtualenvOperator): """ Run a function in a virtualenv that is not re-created. Reused as is without the overhead of creating the virtual environment (with certain caveats). The function must be defined using def, and not be part of a class. All imports must happen inside the...
ExternalPythonOperator
python
google__jax
tests/batching_test.py
{ "start": 1458, "end": 49078 }
class ____(jtu.JaxTestCase): def testConstantFunction(self): ans = vmap(lambda x: 3)(np.ones(4)) expected = 3 * np.ones(4) self.assertAllClose(ans, expected, check_dtypes=False) @jax.default_matmul_precision("float32") def testNestedBatchingMatMat(self): matvec = vmap(jnp.vdot, in_axes=(0, None)...
BatchingTest
python
google__jax
jax/_src/tree_util.py
{ "start": 14229, "end": 15830 }
class ____: pass @export def tree_reduce(function: Callable[[T, Any], T], tree: Any, initializer: T | Unspecified = Unspecified(), is_leaf: Callable[[Any], bool] | None = None) -> T: """Alias of :func:`jax.tree.reduce`.""" if isinstance(initializer, Unspecified): ...
Unspecified
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_object_position16.py
{ "start": 315, "end": 933 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("object_position16.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file with image(s).""" workbook =...
TestCompareXLSXFiles
python
walkccc__LeetCode
solutions/352. Data Stream as Disjoint Intervals/352.py
{ "start": 42, "end": 1499 }
class ____: def __init__(self): self.intervals = SortedDict() # {start: (start, end)} def addNum(self, val: int) -> None: if val in self.intervals: return lo = self._lowerKey(val) hi = self._higherKey(val) # {lo, map[lo][1]} + val + {hi, map[hi][1]} = {lo, map[hi][1]} if lo >= 0 an...
SummaryRanges
python
google__pytype
pytype/overlays/fiddle_overlay.py
{ "start": 9789, "end": 9976 }
class ____(Buildable): """An instantiation of a fiddle.Config with a particular template.""" def __init__(self, *args, **kwargs): super().__init__("Config", *args, **kwargs)
Config
python
pytorch__pytorch
torch/_inductor/codegen/cutedsl/cutedsl_template.py
{ "start": 4933, "end": 7069 }
class ____(ChoiceCaller): """Caller for CuteDSL templates that integrates with the autotuning system.""" def __init__( self, name: str, input_nodes: list[Buffer], layout: Layout, make_kernel_render: Any, bmreq: CuteDSLBenchmarkRequest, template: "CuteDSLT...
CuteDSLTemplateCaller
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/metaclass3.py
{ "start": 405, "end": 446 }
class ____(metaclass=Meta3): pass
Base4
python
pytorch__pytorch
test/inductor/test_control_deps.py
{ "start": 419, "end": 2583 }
class ____(InductorTestCase): @config.patch(reorder_for_locality=False) @requires_gpu() def test_control_deps_prevents_fusion(self): def fn(a, b): c = a + 1 d = b @ b e = c * 2 return d, e # Custom pass to add control dependency from d -> c ...
TestControlDeps
python
tensorflow__tensorflow
tensorflow/python/debug/lib/debug_events_writer_test.py
{ "start": 28784, "end": 38569 }
class ____(test_util.TensorFlowTestCase, parameterized.TestCase): def jsonRoundTripCheck(self, obj): self.assertEqual( json_lib.dumps(json_lib.loads(json_lib.dumps(obj)), sort_keys=True), json_lib.dumps(obj, sort_keys=True)) def testExecutionDigestWithNoOutputToJson(self): execution_digest...
DataObjectsTest
python
airbytehq__airbyte
airbyte-integrations/connectors/source-amazon-ads/unit_tests/integrations/ad_responses/records/fields/dict_template_path.py
{ "start": 151, "end": 426 }
class ____(Path): def update(self, template: Dict[str, Any], value: Dict[str, Any]) -> None: template.clear() template.update(value) def write(self, template: Dict[str, Any], value: Dict[str, Any]) -> None: template.update(value)
DictTemplatePath
python
pypa__warehouse
warehouse/packaging/models.py
{ "start": 35655, "end": 35833 }
class ____(db.ModelBase): __tablename__ = "file_registry" id: Mapped[int] = mapped_column(primary_key=True) filename: Mapped[str] = mapped_column(unique=True)
Filename
python
joke2k__faker
tests/providers/test_job.py
{ "start": 3211, "end": 3400 }
class ____: """Test hy_AM job provider""" def test_job(self, faker, num_samples): for _ in range(num_samples): assert faker.job() in HyAmJobProvider.jobs
TestHyAm
python
cython__cython
Cython/Compiler/MatchCaseNodes.py
{ "start": 4309, "end": 5709 }
class ____(Node): """ pattern PatternNode body StatListNode guard ExprNode or None """ child_attrs = ["pattern", "body", "guard"] def is_irrefutable(self): if isinstance(self.pattern, ErrorNode): return True # value doesn't really matter return se...
MatchCaseNode
python
kamyu104__LeetCode-Solutions
Python/minimum-operations-to-make-the-array-alternating.py
{ "start": 62, "end": 742 }
class ____(object): def minimumOperations(self, nums): """ :type nums: List[int] :rtype: int """ even_top = collections.Counter(nums[i] for i in xrange(0, len(nums), 2)).most_common(2) # Time: O(nlogk) odd_top = collections.Counter(nums[i] for i in xrange(1, len(nums...
Solution
python
pytorch__pytorch
torch/profiler/_pattern_matcher.py
{ "start": 19294, "end": 25016 }
class ____(Pattern): def __init__(self, prof: profile, should_benchmark: bool = False) -> None: super().__init__(prof, should_benchmark) self.name = "Matrix Multiplication Dimension Not Aligned Pattern" self.description = "Detected matmul with dimension not aligned. Please use matmul with al...
MatMulDimInFP16Pattern
python
coleifer__peewee
tests/prefetch_tests.py
{ "start": 21411, "end": 21508 }
class ____(TestModel): name = TextField() a = ForeignKeyField(A) x = ForeignKeyField(X)
B
python
wandb__wandb
wandb/integration/dspy/dspy.py
{ "start": 1481, "end": 15544 }
class ____(dspy.utils.BaseCallback): """W&B callback for tracking DSPy evaluation and optimization. This callback logs evaluation scores, per-step predictions (optional), and a table capturing the DSPy program signature over time. It can also save the best program as a W&B Artifact for reproducibility....
WandbDSPyCallback
python
pytorch__pytorch
torch/_dynamo/variables/higher_order_ops.py
{ "start": 82326, "end": 92046 }
class ____(TorchHigherOrderOperatorVariable): supports_input_mutation = False supports_aliasing = False @raise_hard_error_if_graph_break( reason="associative_scan must be captured completely with torch.compile." ) def _call_function( self, tx: "InstructionTranslator", ...
AssociativeScanHigherOrderVariable
python
neetcode-gh__leetcode
python/0121-best-time-to-buy-and-sell-stock.py
{ "start": 0, "end": 272 }
class ____: def maxProfit(self, prices: List[int]) -> int: res = 0 lowest = prices[0] for price in prices: if price < lowest: lowest = price res = max(res, price - lowest) return res
Solution
python
google__flatbuffers
python/flatbuffers/flexbuffers.py
{ "start": 27553, "end": 44454 }
class ____: """Helper class to encode structural data into flexbuffers format.""" def __init__( self, share_strings=False, share_keys=True, force_min_bit_width=BitWidth.W8, ): self._share_strings = share_strings self._share_keys = share_keys self._force_min_bit_width = force_m...
Builder
python
google__flatbuffers
python/flatbuffers/number_types.py
{ "start": 2637, "end": 2680 }
class ____(Uint32Flags): pass
UOffsetTFlags
python
falconry__falcon
tests/test_after_hooks.py
{ "start": 4354, "end": 4541 }
class ____: @falcon.after(fluffiness_in_the_head, 'fluffy') async def on_get(self, req, resp, field1, field2): self.fields = (field1, field2)
ClassResourceWithURIFieldsAsync
python
airbytehq__airbyte
airbyte-integrations/bases/connector-acceptance-test/connector_acceptance_test/utils/backward_compatibility.py
{ "start": 11894, "end": 14985 }
class ____(BaseDiffChecker): """A class to perform backward compatibility checks on a discoverd catalog diff""" context = BackwardIncompatibilityContext.DISCOVER def compute_diffs(self): self.streams_json_schemas_diff = DeepDiff( {stream_name: airbyte_stream.dict().pop("json_schema") f...
CatalogDiffChecker
python
numpy__numpy
numpy/f2py/tests/test_common.py
{ "start": 74, "end": 459 }
class ____(util.F2PyTest): sources = [util.getpath("tests", "src", "common", "block.f")] def test_common_block(self): self.module.initcb() assert self.module.block.long_bn == np.array(1.0, dtype=np.float64) assert self.module.block.string_bn == np.array("2", dtype="|S1") assert ...
TestCommonBlock
python
allegroai__clearml
clearml/backend_api/services/v2_23/datasets.py
{ "start": 21552, "end": 29512 }
class ____(NonStrictDataModel): """ :param id: Frame id. Must be unique within the dataset's version. If already exists, will cause existing frame to be updated :type id: str :param context_id: Context ID. Used for the default frames sorting. If not set then it is filled from the uri of ...
Frame
python
apache__airflow
providers/google/tests/unit/google/cloud/transfers/test_bigquery_to_mysql.py
{ "start": 1694, "end": 6413 }
class ____: @mock.patch("airflow.providers.google.cloud.transfers.bigquery_to_sql.BigQueryHook") def test_execute_good_request_to_bq(self, mock_hook): destination_table = "table" operator = BigQueryToMySqlOperator( task_id=TASK_ID, dataset_table=f"{TEST_DATASET}.{TEST_TAB...
TestBigQueryToMySqlOperator
python
huggingface__transformers
src/transformers/models/markuplm/modeling_markuplm.py
{ "start": 30422, "end": 34640 }
class ____(MarkupLMPreTrainedModel): # Copied from transformers.models.bert.modeling_bert.BertForTokenClassification.__init__ with bert->markuplm, Bert->MarkupLM def __init__(self, config): super().__init__(config) self.num_labels = config.num_labels self.markuplm = MarkupLMModel(config...
MarkupLMForTokenClassification
python
huggingface__transformers
src/transformers/models/rt_detr/modeling_rt_detr_resnet.py
{ "start": 12508, "end": 15247 }
class ____(RTDetrResNetPreTrainedModel, BackboneMixin): has_attentions = False def __init__(self, config): super().__init__(config) super()._init_backbone(config) self.num_features = [config.embedding_size] + config.hidden_sizes self.embedder = RTDetrResNetEmbeddings(config) ...
RTDetrResNetBackbone
python
plotly__plotly.py
plotly/graph_objs/sankey/_legendgrouptitle.py
{ "start": 233, "end": 2932 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "sankey" _path_str = "sankey.legendgrouptitle" _valid_props = {"font", "text"} @property def font(self): """ Sets this legend group's title font. The 'font' property is an instance of Font that may be specified...
Legendgrouptitle
python
tensorflow__tensorflow
tensorflow/python/feature_column/feature_column_v2_test.py
{ "start": 142635, "end": 158831 }
class ____(test.TestCase): def test_defaults_string(self): column = fc.categorical_column_with_vocabulary_list( key='aaa', vocabulary_list=('omar', 'stringer', 'marlo')) self.assertEqual('aaa', column.name) self.assertEqual('aaa', column.key) self.assertEqual(3, column.num_buckets) self.a...
VocabularyListCategoricalColumnTest
python
pydantic__pydantic
pydantic-core/python/pydantic_core/core_schema.py
{ "start": 64058, "end": 66051 }
class ____(TypedDict, total=False): type: Required[Literal['generator']] items_schema: CoreSchema min_length: int max_length: int ref: str metadata: dict[str, Any] serialization: IncExSeqOrElseSerSchema def generator_schema( items_schema: CoreSchema | None = None, *, min_length...
GeneratorSchema
python
getsentry__sentry
src/sentry/integrations/messaging/linkage.py
{ "start": 4037, "end": 10490 }
class ____(LinkageView, ABC): @property @abstractmethod def external_id_parameter(self) -> str: raise NotImplementedError # TODO: Replace thw two template properties below with base templates for all # integrations to use. Add service-specific parts to the context as needed. @pro...
IdentityLinkageView
python
huggingface__transformers
tests/models/umt5/test_modeling_umt5.py
{ "start": 18937, "end": 20988 }
class ____(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (UMT5EncoderModel, UMT5ForTokenClassification) if is_torch_available() else () test_resize_embeddings = False pipeline_model_mapping = ( { "token-classification": UMT5ForTokenClassification, ...
UMT5EncoderOnlyModelTest
python
django__django
tests/async/models.py
{ "start": 300, "end": 389 }
class ____(models.Model): simples = models.ManyToManyField("SimpleModel")
ManyToManyModel
python
pypa__pip
src/pip/_vendor/pygments/lexer.py
{ "start": 12100, "end": 12247 }
class ____(str): # pylint: disable=invalid-name """ Indicates that a state should include rules from another state. """ pass
include
python
pandas-dev__pandas
asv_bench/benchmarks/reshape.py
{ "start": 5195, "end": 6948 }
class ____: def setup(self): N = 100000 fac1 = np.array(["A", "B", "C"], dtype="O") fac2 = np.array(["one", "two"], dtype="O") ind1 = np.random.randint(0, 3, size=N) ind2 = np.random.randint(0, 2, size=N) self.df = DataFrame( { "key1": fac1...
PivotTable
python
ray-project__ray
python/ray/autoscaler/_private/gcp/node.py
{ "start": 517, "end": 3477 }
class ____ from ``GCPNode``. Those classes are essentially dicts with some extra methods. The instances of those classes will be created from API responses. The ``GCPNodeType`` enum is a lightweight way to classify nodes. Currently, Compute and TPU resources & nodes are supported. In order to add support for new res...
inheriting
python
getsentry__sentry-python
sentry_sdk/integrations/rust_tracing.py
{ "start": 1392, "end": 4050 }
class ____(Enum): Ignore = auto() Exc = auto() Breadcrumb = auto() Event = auto() def tracing_level_to_sentry_level(level): # type: (str) -> sentry_sdk._types.LogLevelStr level = RustTracingLevel(level) if level in (RustTracingLevel.Trace, RustTracingLevel.Debug): return "debug" ...
EventTypeMapping
python
lepture__authlib
authlib/oidc/core/claims.py
{ "start": 6849, "end": 6953 }
class ____(IDToken): RESPONSE_TYPES = ("code",) REGISTERED_CLAIMS = _REGISTERED_CLAIMS
CodeIDToken
python
sqlalchemy__sqlalchemy
test/sql/test_operators.py
{ "start": 155494, "end": 157239 }
class ____(fixtures.TestBase): def _assert_types(self, expr): eq_(expr[0]._type_affinity, Integer) eq_(expr[1]._type_affinity, String) eq_(expr[2]._type_affinity, LargeBinary()._type_affinity) def test_type_coercion_on_eq(self): a, b, c = ( column("a", Integer), ...
TupleTypingTest
python
sympy__sympy
sympy/polys/polyoptions.py
{ "start": 18337, "end": 18545 }
class ____(BooleanOption, Flag, metaclass=OptionType): """``formal`` flag to polynomial manipulation functions. """ option = 'formal' @classmethod def default(cls): return False
Formal
python
sanic-org__sanic
sanic/http/http3.py
{ "start": 2549, "end": 8428 }
class ____(Receiver, Stream): """HTTP/3 receiver implementation.""" stage: Stage request: Request def __init__(self, *args, **kwargs) -> None: super().__init__(*args, **kwargs) self.request_body = None self.stage = Stage.IDLE self.headers_sent = False self.respo...
HTTPReceiver
python
dask__dask
dask/dataframe/dask_expr/_expr.py
{ "start": 92425, "end": 93095 }
class ____(Elemwise): _parameters = ["frame"] def __str__(self): return f"{self._operator_repr} {self.frame}" def _simplify_up(self, parent, dependents): if isinstance(parent, Projection): if isinstance(self.frame, Expr): return plain_column_projection(self, par...
Unaryop
python
apache__airflow
providers/teradata/tests/unit/teradata/hooks/test_tpt.py
{ "start": 954, "end": 9965 }
class ____: @patch("airflow.providers.teradata.hooks.tpt.SSHHook") @patch("airflow.models.Connection") def test_init_with_ssh(self, mock_conn, mock_ssh_hook): hook = TptHook(ssh_conn_id="ssh_default") assert hook.ssh_conn_id == "ssh_default" assert hook.ssh_hook is not None @pat...
TestTptHook
python
walkccc__LeetCode
solutions/1780. Check if Number is a Sum of Powers of Three/1780.py
{ "start": 0, "end": 161 }
class ____: def checkPowersOfThree(self, n: int) -> bool: while n > 1: n, r = divmod(n, 3) if r == 2: return False return True
Solution
python
plotly__plotly.py
plotly/graph_objs/scattercarpet/_unselected.py
{ "start": 233, "end": 3432 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "scattercarpet" _path_str = "scattercarpet.unselected" _valid_props = {"marker", "textfont"} @property def marker(self): """ The 'marker' property is an instance of Marker that may be specified as: - An instan...
Unselected
python
numba__llvmlite
versioneer.py
{ "start": 34312, "end": 35895 }
class ____(_build): def run(self): versions = get_versions(verbose=True) _build.run(self) # now locate _version.py in the new build/ directory and replace it # with an updated value if versionfile_build: target_versionfile = os.path.join(self.build_lib, ...
cmd_build
python
ethereum__web3.py
web3/contract/contract.py
{ "start": 1909, "end": 6859 }
class ____(BaseContractEvent): # mypy types w3: "Web3" @combomethod def get_logs( self, argument_filters: dict[str, Any] | None = None, from_block: BlockIdentifier | None = None, to_block: BlockIdentifier | None = None, block_hash: HexBytes | None = None, ) -...
ContractEvent
python
airbytehq__airbyte
airbyte-integrations/connectors/source-rki-covid/source_rki_covid/source.py
{ "start": 12646, "end": 14704 }
class ____(IncrementalRkiCovidStream): """Docs: https://api.corona-zahlen.org/germany/germany/history/frozen-incidence/:days""" primary_key = None def __init__(self, config, **kwargs): super().__init__(**kwargs) self.start_date = config.get("start_date") @property def source_defin...
GermanHistoryFrozenIncidence
python
tensorflow__tensorflow
tensorflow/compiler/mlir/quantization/stablehlo/python/integration_test/quantize_model_test.py
{ "start": 36945, "end": 41468 }
class ____(quantize_model_test_base.QuantizedModelTest): """Test cases regarding the use of CalibrationOptions proto. Run all tests cases in both the graph mode (default in TF1) and the eager mode (default in TF2) to ensure support for when TF2 is disabled. """ @parameterized.parameters( { '...
CalibrationOptionsTest
python
huggingface__transformers
src/transformers/models/hunyuan_v1_dense/modular_hunyuan_v1_dense.py
{ "start": 1543, "end": 2004 }
class ____(LlamaMLP): def __init__(self, config: HunYuanDenseV1Config, layer_idx=None, is_shared_mlp=False): super().__init__(config) self.layer_idx = layer_idx self.gate_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False) self.up_proj = nn.Linear(self.hidden_size,...
HunYuanDenseV1MLP
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/engine/interfaces.py
{ "start": 108531, "end": 113680 }
class ____: """Encapsulate information about an error condition in progress. This object exists solely to be passed to the :meth:`_events.DialectEvents.handle_error` event, supporting an interface that can be extended without backwards-incompatibility. """ __slots__ = () dialect: Di...
ExceptionContext
python
MorvanZhou__Reinforcement-learning-with-tensorflow
contents/5_Deep_Q_Network/DQN_modified.py
{ "start": 434, "end": 6566 }
class ____: def __init__( self, n_actions, n_features, learning_rate=0.01, reward_decay=0.9, e_greedy=0.9, replace_target_iter=300, memory_size=500, batch_size=32, e_greedy_increment=None, ...
DeepQNetwork
python
huggingface__transformers
src/transformers/models/parakeet/modeling_parakeet.py
{ "start": 11138, "end": 16119 }
class ____(nn.Module): """Multi-head attention with relative positional encoding. See section 3.3 of https://huggingface.co/papers/1901.02860.""" def __init__(self, config: ParakeetEncoderConfig, layer_idx: int): super().__init__() self.config = config self.layer_idx = layer_idx ...
ParakeetEncoderAttention
python
gabrielfalcao__HTTPretty
httpretty/core.py
{ "start": 13979, "end": 14323 }
class ____(object): def __init__(self, fakesocket): self.fakesocket = fakesocket def __getitem__(self, *args, **kw): raise AssertionError('socket {} is not connected'.format(self.fakesocket.truesock)) def fake_socketpair(*args, **kw): with restored_libs(): return old_socketpair(*a...
FakeAddressTuple
python
getsentry__sentry
src/sentry/models/release.py
{ "start": 2042, "end": 2155 }
class ____(TypedDict, total=False): author: CommitAuthor message: str date_added: str
_CommitDataKwargs
python
cython__cython
tests/run/ext_auto_richcmp.py
{ "start": 71, "end": 307 }
class ____(object): x = cython.declare(cython.int) def __init__(self, x): self.x = x def __repr__(self): return "<%d>" % self.x @cython.cfunc @cython.locals(x=X) def x_of(x): return x.x @cython.cclass
X
python
google__pytype
pytype/tests/test_builtins2.py
{ "start": 211, "end": 20575 }
class ____(test_base.BaseTest): """Tests for builtin methods and classes.""" def test_div_mod_with_unknown(self): ty = self.Infer(""" def f(x, y): divmod(x, __any_object__) return divmod(3, y) """) self.assertTypesMatchPytd( ty, """ from typing import Any, Tu...
BuiltinTests2
python
realpython__materials
python-property/users.py
{ "start": 27, "end": 444 }
class ____: def __init__(self, name, password): self.name = name self.password = password @property def password(self): raise AttributeError("Password is write-only") @password.setter def password(self, plaintext): salt = os.urandom(32) self._hashed_password...
User
python
getsentry__sentry
src/sentry/api/serializers/models/team.py
{ "start": 4264, "end": 4471 }
class ____(TypedDict, total=False): externalTeams: list[ExternalActorResponse] organization: OrganizationSerializerResponse projects: list[ProjectSerializerResponse]
_TeamSerializerResponseOptional
python
great-expectations__great_expectations
contrib/great_expectations_semantic_types_expectations/great_expectations_semantic_types_expectations/expectations/expect_column_values_to_be_valid_mbti.py
{ "start": 1567, "end": 3750 }
class ____(ColumnMapExpectation): """Expect column values to conform to the valid Myers-Briggs Type Indicator (MBTI).""" # These examples will be shown in the public gallery. # They will also be executed as unit tests for your Expectation. examples = [ { "data": { "w...
ExpectColumnValuesToBeValidMbti
python
Lightning-AI__lightning
src/lightning/pytorch/trainer/connectors/callback_connector.py
{ "start": 1690, "end": 11886 }
class ____: def __init__(self, trainer: "pl.Trainer"): self.trainer = trainer def on_trainer_init( self, callbacks: Optional[Union[list[Callback], Callback]], enable_checkpointing: bool, enable_progress_bar: bool, default_root_dir: Optional[str], enable_m...
_CallbackConnector
python
google__jax
jax/_src/interpreters/ad.py
{ "start": 66249, "end": 66957 }
class ____(Exception): def __init__(self): # TODO(mattjj): track source provenance on AD tracers, improve error msg = ("Detected differentiation of a custom_vjp function with respect to " "a closed-over value. That isn't supported because the custom VJP " "rule only specifies how to diff...
CustomVJPException
python
getsentry__sentry
tests/sentry/notifications/api/endpoints/test_user_notification_email.py
{ "start": 208, "end": 632 }
class ____(APITestCase): endpoint = "sentry-api-0-user-notifications-email" def setUp(self) -> None: self.organization2 = self.create_organization(name="Another Org", owner=self.user) self.project2 = self.create_project( organization=self.organization, teams=[self.team], name="Anoth...
UserNotificationEmailTestBase
python
kamyu104__LeetCode-Solutions
Python/check-if-the-number-is-fascinating.py
{ "start": 51, "end": 518 }
class ____(object): def isFascinating(self, n): """ :type n: int :rtype: bool """ lookup = [0] def check(x): while x: x, d = divmod(x, 10) if d == 0 or lookup[0]&(1<<d): return False looku...
Solution
python
pytorch__pytorch
test/dynamo/test_autograd_function.py
{ "start": 4922, "end": 5231 }
class ____(torch.autograd.Function): @staticmethod def forward(ctx, x): with torch.no_grad(): ctx.save_for_backward(x) ctx.mark_non_differentiable(x) return x @staticmethod def backward(ctx, grad_output): return grad_output
ContextSaveAndMark
python
huggingface__transformers
src/transformers/models/bert_generation/modeling_bert_generation.py
{ "start": 26468, "end": 30836 }
class ____(BertGenerationPreTrainedModel, GenerationMixin): _tied_weights_keys = { "lm_head.decoder.weight": "bert.embeddings.word_embeddings.weight", "lm_head.decoder.bias": "lm_head.bias", } def __init__(self, config): super().__init__(config) if not config.is_decoder: ...
BertGenerationDecoder
python
facebookresearch__faiss
tests/test_search_params.py
{ "start": 18219, "end": 19570 }
class ____(unittest.TestCase): """ to test the sorted id bounds, there are a few cases to consider """ def do_test_sorted(self, imin, imax, n=100): selr = faiss.IDSelectorRange(imin, imax, True) sp = faiss.swig_ptr for seed in range(10): rs = np.random.RandomState(seed) ...
TestSortedIDSelectorRange
python
apache__airflow
airflow-ctl/src/airflowctl/api/datamodels/generated.py
{ "start": 13597, "end": 14547 }
class ____(BaseModel): """ Event Log Response. """ event_log_id: Annotated[int, Field(title="Event Log Id")] when: Annotated[datetime, Field(title="When")] dag_id: Annotated[str | None, Field(title="Dag Id")] = None task_id: Annotated[str | None, Field(title="Task Id")] = None run_id: A...
EventLogResponse
python
apache__airflow
providers/microsoft/azure/tests/unit/microsoft/azure/operators/test_adx.py
{ "start": 2000, "end": 2058 }
class ____: primary_results = [MOCK_RESULT]
MockResponse
python
spack__spack
lib/spack/spack/llnl/util/filesystem.py
{ "start": 95079, "end": 110618 }
class ____: """Uses hybrid iterative deepening to locate the first matching file. Up to depth ``bfs_depth`` it uses iterative deepening, which mimics breadth-first with the same memory footprint as depth-first search, after which it switches to ordinary depth-first search using ``os.walk``.""" ...
FindFirstFile
python
great-expectations__great_expectations
contrib/great_expectations_semantic_types_expectations/great_expectations_semantic_types_expectations/expectations/expect_column_values_to_be_valid_mime.py
{ "start": 1619, "end": 4091 }
class ____(ColumnMapExpectation): """Expect column values to be valid MIME types.""" # These examples will be shown in the public gallery. # They will also be executed as unit tests for your Expectation. examples = [ { "data": { "well_formed_mime": [ ...
ExpectColumnValuesToBeValidMIME
python
bokeh__bokeh
src/bokeh/protocol/message.py
{ "start": 3111, "end": 3229 }
class ____(TypedDict): msgid: ID msgtype: str reqid: NotRequired[ID] num_buffers: NotRequired[int]
Header