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
scikit-learn__scikit-learn
sklearn/utils/tests/test_estimator_checks.py
{ "start": 3682, "end": 3848 }
class ____(ClassifierMixin, BaseEstimator): def fit(self, X, y): return self def predict(self, X): return np.ones(X.shape[0])
BaseBadClassifier
python
dagster-io__dagster
python_modules/libraries/dagster-dg-cli/dagster_dg_cli/api_layer/api/sensor.py
{ "start": 428, "end": 1705 }
class ____: """API for sensor operations.""" client: IGraphQLClient def list_sensors( self, repository_location_name: Optional[str] = None, repository_name: Optional[str] = None, ) -> "DgApiSensorList": """List all sensors, optionally filtered by repository location and...
DgApiSensorApi
python
getsentry__sentry
tests/tools/mypy_helpers/test_plugin.py
{ "start": 6856, "end": 8479 }
class ____(Service): X = "hello world" def f(self) -> int: return 5 backend = LazyServiceWrapper(MyService, "some.path", {}) # should proxy attributes properly assert_type(backend.X, str) assert_type(backend.f(), int) # should represent self types properly assert_type(backend._backend, str) assert_ty...
MyService
python
pytorch__pytorch
torch/_dynamo/variables/user_defined.py
{ "start": 73064, "end": 77305 }
class ____(UserDefinedObjectVariable): class HashWrapper: """This class is hashed if a dataclass is used as a key in a dict. It's necessary to avoid side effects from calling the __init__ of the dataclass class when hashing""" def __init__(self, c, fields): self.cls = c ...
FrozenDataClassVariable
python
huggingface__transformers
src/transformers/models/ernie4_5_moe/modular_ernie4_5_moe.py
{ "start": 10915, "end": 14176 }
class ____(Ernie4_5_MoePreTrainedModel): def __init__(self, config: Ernie4_5_MoeConfig): super().__init__(config) self.padding_idx = config.pad_token_id self.vocab_size = config.vocab_size self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx) ...
Ernie4_5_MoeModel
python
pallets__werkzeug
src/werkzeug/exceptions.py
{ "start": 13819, "end": 14206 }
class ____(HTTPException): """*410* `Gone` Raise if a resource existed previously and went away without new location. """ code = 410 description = ( "The requested URL is no longer available on this server and" " there is no forwarding address. If you followed a link from a" ...
Gone
python
pyparsing__pyparsing
pyparsing/diagram/__init__.py
{ "start": 2389, "end": 2983 }
class ____(railroad.Group): """ Custom railroad item to compose a: - :class:`railroad.Group` containing a - :class:`railroad.OneOrMore` containing a - :class:`railroad.Choice` of the elements in the :class:`railroad.Each` with the group label indicating that all must be match...
EachItem
python
bokeh__bokeh
src/bokeh/document/events.py
{ "start": 12691, "end": 15785 }
class ____(DocumentPatchedEvent): ''' A concrete event representing efficiently replacing *all* existing data for a :class:`~bokeh.models.sources.ColumnDataSource` ''' kind = "ColumnDataChanged" def __init__(self, document: Document, model: Model, attr: str, data: DataDict | None = None, ...
ColumnDataChangedEvent
python
airbytehq__airbyte
airbyte-integrations/connectors/destination-astra/destination_astra/indexer.py
{ "start": 785, "end": 3968 }
class ____(Indexer): config: AstraIndexingModel def __init__(self, config: AstraIndexingModel, embedding_dimensions: int): super().__init__(config) self.client = AstraClient( config.astra_db_endpoint, config.astra_db_app_token, config.astra_db_keyspace, embedding_dimensions, "cosin...
AstraIndexer
python
airbytehq__airbyte
airbyte-integrations/connectors/source-shopify/source_shopify/streams/base_streams.py
{ "start": 1260, "end": 5137 }
class ____(HttpStream, ABC): # define default logger logger = logging.getLogger("airbyte") # Latest Stable Release api_version = "2025-01" # Page size limit = 250 primary_key = "id" order_field = "updated_at" filter_field = "updated_at_min" def __init__(self, config: Dict) -> ...
ShopifyStream
python
Lightning-AI__lightning
tests/tests_pytorch/models/test_hparams.py
{ "start": 9512, "end": 9654 }
class ____(BoringModel): def __init__(self, batch_size=64): super().__init__() self.save_hyperparameters()
CustomBoringModel
python
apache__airflow
airflow-core/src/airflow/api_fastapi/core_api/datamodels/config.py
{ "start": 885, "end": 1191 }
class ____(StrictBaseModel): """Config option.""" key: str value: str | tuple[str, str] @property def text_format(self): if isinstance(self.value, tuple): return f"{self.key} = {self.value[0]} {self.value[1]}" return f"{self.key} = {self.value}"
ConfigOption
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/orm/context.py
{ "start": 117847, "end": 118181 }
class ____(_ORMColumnEntity): translate_raw_column = False def setup_compile_state(self, compile_state): pass def row_processor(self, context, result): def getter(row): return context.load_options._identity_token return getter, self._label_name, self._extra_entities
_IdentityTokenEntity
python
pytorch__pytorch
test/test_jit_disabled.py
{ "start": 1434, "end": 1818 }
class ____(torch.jit.ScriptModule): def __init__(self, x): super().__init__() self.x = torch.jit.Attribute(x, torch.Tensor) def forward(self, input): return input s = Foo(torch.ones(2, 3)) print(s.x) """ self.compare_enabled_disabled(_program_string) def test_script_module...
Foo
python
scipy__scipy
benchmarks/benchmarks/stats_sampling.py
{ "start": 2526, "end": 3123 }
class ____: def __init__(self): self.mode = 0 def pdf(self, x): return 0.2 * (0.05 + 0.45 * (1 + np.sin(2*np.pi*x))) def dpdf(self, x): return 0.2 * 0.45 * (2*np.pi) * np.cos(2*np.pi*x) def cdf(self, x): return x/10. + 0.5 + 0.09/(2*np.pi) * (np.cos(10*np.pi) - ...
contdist5
python
doocs__leetcode
solution/3400-3499/3445.Maximum Difference Between Even and Odd Frequency II/Solution.py
{ "start": 0, "end": 832 }
class ____: def maxDifference(self, S: str, k: int) -> int: s = list(map(int, S)) ans = -inf for a in range(5): for b in range(5): if a == b: continue curA = curB = 0 preA = preB = 0 t = [[inf, in...
Solution
python
ansible__ansible
test/integration/targets/old_style_vars_plugins/roles/a/vars_plugins/auto_role_vars.py
{ "start": 86, "end": 256 }
class ____(BaseVarsPlugin): # Implicitly # REQUIRES_ENABLED = False def get_vars(self, loader, path, entities): return {'auto_role_var': True}
VarsModule
python
django__django
tests/signing/tests.py
{ "start": 7892, "end": 8695 }
class ____(SimpleTestCase): def test_timestamp_signer(self): value = "hello" with freeze_time(123456789): signer = signing.TimestampSigner(key="predictable-key") ts = signer.sign(value) self.assertNotEqual(ts, signing.Signer(key="predictable-key").sign(value)) ...
TestTimestampSigner
python
pypa__warehouse
warehouse/admin/flags.py
{ "start": 177, "end": 814 }
class ____(enum.Enum): DISABLE_ORGANIZATIONS = "disable-organizations" DISABLE_PEP740 = "disable-pep740" DISALLOW_DELETION = "disallow-deletion" DISALLOW_NEW_PROJECT_REGISTRATION = "disallow-new-project-registration" DISALLOW_NEW_UPLOAD = "disallow-new-upload" DISALLOW_NEW_USER_REGISTRATION = "d...
AdminFlagValue
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/typedDictClosed3.py
{ "start": 1562, "end": 1625 }
class ____(ParentClosed4): b: NotRequired[int]
ChildClosed4_4
python
sqlalchemy__sqlalchemy
test/orm/test_subquery_relations.py
{ "start": 108005, "end": 111027 }
class ____(fixtures.DeclarativeMappedTest): @classmethod def setup_classes(cls): Base = cls.DeclarativeBasic class A(Base): __tablename__ = "a" id = Column(Integer, primary_key=True) b_id = Column(ForeignKey("b.id")) a2_id = Column(ForeignKey("a2...
TestExistingRowPopulation
python
pydantic__pydantic
tests/mypy/outputs/mypy-plugin_ini/plugin_strict_fields.py
{ "start": 1340, "end": 1605 }
class ____(ModelStrictMode): model_config = {'strict': False} # expected error: b ModelOverrideStrictMode(a='1', b='2', c='3') # MYPY: error: Argument "b" to "ModelOverrideStrictMode" has incompatible type "str"; expected "int" [arg-type]
ModelOverrideStrictMode
python
pytorch__pytorch
torch/nn/modules/pooling.py
{ "start": 51461, "end": 52019 }
class ____(Module): __constants__ = ["output_size", "return_indices"] return_indices: bool def __init__( self, output_size: _size_any_opt_t, return_indices: bool = False ) -> None: super().__init__() self.output_size = output_size self.return_indices = return_indices ...
_AdaptiveMaxPoolNd
python
google__jax
tests/api_test.py
{ "start": 237401, "end": 241733 }
class ____(jtu.JaxTestCase): def test_scalar_literals(self): jaxpr = api.make_jaxpr(lambda x: x + 2)(42) self.assertLen(jaxpr.jaxpr.constvars, 0) def test_abstract_inputs(self): jaxpr = api.make_jaxpr(lambda x: x + 2.)( types.SimpleNamespace(shape=(), dtype=np.dtype(np.float32))) self.asse...
JaxprTest
python
realpython__materials
python-dict-attribute/class_inheritance.py
{ "start": 76, "end": 264 }
class ____(Parent): def __init__(self): super().__init__() self.child_attr = "child" parent = Parent() print(parent.__dict__) child = Child() print(child.__dict__)
Child
python
pypa__pip
src/pip/_vendor/msgpack/fallback.py
{ "start": 20192, "end": 32390 }
class ____: """ MessagePack Packer Usage:: packer = Packer() astream.write(packer.pack(a)) astream.write(packer.pack(b)) Packer's constructor has some keyword arguments: :param default: When specified, it should be callable. Convert user type to builtin ty...
Packer
python
ray-project__ray
release/train_tests/benchmark/recsys/recsys_factory.py
{ "start": 1794, "end": 2151 }
class ____(BaseModel): embedding_dim: int = 128 num_embeddings_per_feature: List[int] = CRITEO_NUM_EMBEDDINGS_PER_FEATURE over_arch_layer_sizes: List[int] = [1024, 1024, 512, 256, 1] dense_arch_layer_sizes: List[int] = [512, 256, 128] interaction_type: str = "dcn" dcn_num_layers: int = 3 dcn...
TorchRecConfig
python
huggingface__transformers
src/transformers/models/t5/modeling_t5.py
{ "start": 5230, "end": 5899 }
class ____(nn.Module): def __init__(self, config: T5Config): super().__init__() if config.is_gated_act: self.DenseReluDense = T5DenseGatedActDense(config) else: self.DenseReluDense = T5DenseActDense(config) self.layer_norm = T5LayerNorm(config.d_model, eps=co...
T5LayerFF
python
anthropics__anthropic-sdk-python
src/anthropic/_resource.py
{ "start": 637, "end": 1080 }
class ____: _client: AsyncAPIClient def __init__(self, client: AsyncAPIClient) -> None: self._client = client self._get = client.get self._post = client.post self._patch = client.patch self._put = client.put self._delete = client.delete self._get_api_list...
AsyncAPIResource
python
networkx__networkx
networkx/algorithms/centrality/tests/test_subgraph.py
{ "start": 275, "end": 3729 }
class ____: def test_subgraph_centrality(self): answer = {0: 1.5430806348152433, 1: 1.5430806348152433} result = subgraph_centrality(nx.path_graph(2)) for k, v in result.items(): assert answer[k] == pytest.approx(v, abs=1e-7) answer1 = { "1": 1.64459560541356...
TestSubgraph
python
pytorch__pytorch
torch/testing/_internal/distributed/rpc/examples/reinforcement_learning_rpc_test.py
{ "start": 1225, "end": 1921 }
class ____(nn.Module): r""" Borrowing the ``Policy`` class from the Reinforcement Learning example. Copying the code to make these two examples independent. See https://github.com/pytorch/examples/tree/master/reinforcement_learning """ def __init__(self) -> None: super().__init__() ...
Policy
python
openai__openai-python
src/openai/resources/fine_tuning/alpha/graders.py
{ "start": 9484, "end": 9801 }
class ____: def __init__(self, graders: Graders) -> None: self._graders = graders self.run = _legacy_response.to_raw_response_wrapper( graders.run, ) self.validate = _legacy_response.to_raw_response_wrapper( graders.validate, )
GradersWithRawResponse
python
tensorflow__tensorflow
tensorflow/python/saved_model/save_test.py
{ "start": 59548, "end": 59866 }
class ____(test.TestCase): def test_toggle_flag(self): self.assertTrue(flags.config().saved_model_fingerprinting.value()) flags.config().saved_model_fingerprinting.reset(False) self.assertFalse(flags.config().saved_model_fingerprinting.value()) if __name__ == "__main__": test.main()
FingerprintingTests
python
psf__black
tests/data/cases/preview_long_strings__regression.py
{ "start": 34216, "end": 34820 }
class ____: class B: def foo(): if not hasattr(module, name): raise ValueError( "Could not find object %s in %s.\n" "Please note that you cannot serialize things like inner " "classes. Please move the object into the mai...
A
python
tensorflow__tensorflow
tensorflow/python/distribute/ps_values_test.py
{ "start": 2678, "end": 4294 }
class ____(test.TestCase, parameterized.TestCase): def testAssignOutOfScope(self, distribution): with distribution.scope(): aggregating = variables_lib.Variable(1.) self.assertIsInstance(aggregating, ps_values.AggregatingVariable) self.evaluate(aggregating.assign(3.)) self.assertEqual(self.eval...
AggregatingVariableTest
python
ray-project__ray
python/ray/util/state/api.py
{ "start": 2820, "end": 54583 }
class ____(SubmissionClient): """State API Client issues REST GET requests to the server for resource states.""" def __init__( self, address: Optional[str] = None, cookies: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, Any]] = None, ): """Initialize a ...
StateApiClient
python
tensorflow__tensorflow
tensorflow/core/function/capture/capture_container.py
{ "start": 1807, "end": 12184 }
class ____(object): """A container for all capture usages within FuncGraph.""" def __init__(self): self._by_ref_internal = py_collections.OrderedDict() self._by_ref_external = py_collections.OrderedDict() self._by_ref_tracetype = py_collections.OrderedDict() self._by_val_internal = MutationAwareDic...
FunctionCaptures
python
GoogleCloudPlatform__python-docs-samples
appengine/standard/ndb/overview/main.py
{ "start": 1298, "end": 2893 }
class ____(webapp2.RequestHandler): def get(self): self.response.out.write("<html><body>") guestbook_name = self.request.get("guestbook_name") ancestor_key = ndb.Key("Book", guestbook_name or "*notitle*") greetings = Greeting.query_book(ancestor_key).fetch(20) # [END gae_ndb_...
MainPage
python
kamyu104__LeetCode-Solutions
Python/restore-the-array.py
{ "start": 36, "end": 681 }
class ____(object): def numberOfArrays(self, s, k): """ :type s: str :type k: int :rtype: int """ MOD = 10**9 + 7 klen = len(str(k)) dp = [0]*(klen+1) dp[len(s)%len(dp)] = 1 for i in reversed(xrange(len(s))): dp[i%len(dp)] =...
Solution
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 618582, "end": 618936 }
class ____(sgqlc.types.Type): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("direction", "field") direction = sgqlc.types.Field( sgqlc.types.non_null(OrderDirection), graphql_name="direction" ) field = sgqlc.types.Field(sgqlc.types.non_nul...
SortBy
python
huggingface__transformers
src/transformers/models/sam3/modeling_sam3.py
{ "start": 60374, "end": 66052 }
class ____(nn.Module): """DETR decoder layer with self-attention, text cross-attention, and vision cross-attention.""" def __init__(self, config: Sam3DETRDecoderConfig): super().__init__() self.config = config self.self_attn = Sam3Attention(config) self.self_attn_dropout = nn.Dr...
Sam3DetrDecoderLayer
python
google__pytype
pytype/abstract/class_mixin.py
{ "start": 6012, "end": 28991 }
class ____(metaclass=mixin.MixinMeta): # pylint: disable=undefined-variable """Mix-in to mark all class-like values.""" overloads: Sequence[str] = ( "_get_class", "call", "compute_mro", "get_own_new", "get_special_attribute", "update_official_name", ) def __new__(cls, *unu...
Class
python
Netflix__metaflow
metaflow/datastore/content_addressed_store.py
{ "start": 183, "end": 9205 }
class ____(object): """ This class is not meant to be overridden and is meant to be common across different datastores. """ save_blobs_result = namedtuple("save_blobs_result", "uri key") def __init__(self, prefix, storage_impl): """ Initialize a ContentAddressedStore A...
ContentAddressedStore
python
doocs__leetcode
solution/2600-2699/2615.Sum of Distances/Solution.py
{ "start": 0, "end": 552 }
class ____: def distance(self, nums: List[int]) -> List[int]: d = defaultdict(list) for i, x in enumerate(nums): d[x].append(i) ans = [0] * len(nums) for idx in d.values(): left, right = 0, sum(idx) - len(idx) * idx[0] for i in range(len(idx)): ...
Solution
python
great-expectations__great_expectations
contrib/great_expectations_zipcode_expectations/great_expectations_zipcode_expectations/expectations/expect_column_values_to_be_valid_south_carolina_zip.py
{ "start": 1798, "end": 4187 }
class ____(ColumnMapExpectation): """Expect values in this column to be valid South Carolina zipcodes. See https://pypi.org/project/zipcodes/ for more information. """ # These examples will be shown in the public gallery. # They will also be executed as unit tests for your Expectation. example...
ExpectColumnValuesToBeValidSouthCarolinaZip
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/flake8_unused_arguments/ARG.py
{ "start": 3336, "end": 3952 }
class ____: def __new__(cls, x): print("Hello, world!") def __init__(self, x) -> None: print("Hello, world!") def __str__(self) -> str: return "Hello, world!" def __exit__(self, exc_type, exc_value, traceback) -> None: print("Hello, world!") def __init_subclass__(...
C
python
scikit-learn__scikit-learn
sklearn/svm/_classes.py
{ "start": 58252, "end": 66296 }
class ____(OutlierMixin, BaseLibSVM): """Unsupervised Outlier Detection. Estimate the support of a high-dimensional distribution. The implementation is based on libsvm. Read more in the :ref:`User Guide <outlier_detection>`. Parameters ---------- kernel : {'linear', 'poly', 'rbf', 'sigmo...
OneClassSVM
python
jmcnamara__XlsxWriter
examples/inheritance1.py
{ "start": 985, "end": 1706 }
class ____(Workbook): """ Subclass of the XlsxWriter Workbook class to override the default Worksheet class with our custom class. """ def add_worksheet(self, name=None): # Overwrite add_worksheet() to create a MyWorksheet object. worksheet = super().add_worksheet(name, MyWorksheet...
MyWorkbook
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_table38.py
{ "start": 306, "end": 1236 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("table38.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file with tables.""" workbook = Workbook(s...
TestCompareXLSXFiles
python
mahmoud__boltons
boltons/fileutils.py
{ "start": 11014, "end": 22396 }
class ____: """``AtomicSaver`` is a configurable `context manager`_ that provides a writable :class:`file` which will be moved into place as long as no exceptions are raised within the context manager's block. These "part files" are created in the same directory as the destination path to ensure ato...
AtomicSaver
python
facebook__pyre-check
api/query.py
{ "start": 2939, "end": 10232 }
class ____(NamedTuple): fully_qualified_name: str path: Optional[str] line: int column: int stop_line: int stop_column: int full_error_message: str def _defines(pyre_connection: PyreConnection, modules: Iterable[str]) -> List[Define]: query = "defines({})".format(",".join(modules)) ...
InvalidModel
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/unions3.py
{ "start": 558, "end": 633 }
class ____(type): def __ror__(cls: _T, other: type) -> _T: ...
Metaclass2
python
django__django
tests/generic_views/views.py
{ "start": 2300, "end": 2647 }
class ____(AuthorList): paginate_by = 5 def get_paginator( self, queryset, page_size, orphans=0, allow_empty_first_page=True ): return super().get_paginator( queryset, page_size, orphans=2, allow_empty_first_page=allow_empty_first_page, ...
AuthorListCustomPaginator
python
pydantic__pydantic
tests/mypy/outputs/mypy-plugin-strict_ini/plugin_fail_baseConfig.py
{ "start": 2055, "end": 2271 }
class ____(BaseModel): class Config: from_attributes: Any = {} # not sensible, but should still be handled gracefully # MYPY: error: Invalid value for "Config.from_attributes" [pydantic-config]
BadConfig1
python
realpython__materials
inheritance-and-composition/choosing/employees.py
{ "start": 820, "end": 1622 }
class ____(AsDictionaryMixin): def __init__(self, id): self.id = id info = employee_database.get_employee_info(self.id) self.name = info.get("name") self.address = get_employee_address(self.id) self._role = get_role(info.get("role")) self._payroll = get_policy(self.id...
Employee
python
tensorflow__tensorflow
tensorflow/python/compiler/tensorrt/test/const_broadcast_test.py
{ "start": 1012, "end": 2532 }
class ____(trt_test.TfTrtIntegrationTestBase): """Test for Constant broadcasting in TF-TRT.""" def GraphFn(self, x): """Return the expected graph to convert.""" dtype = x.dtype filt1 = constant_op.constant( 0.3, shape=(3, 3, 2, 1), dtype=dtype, name='filt1') y1 = nn.conv2d(x, filt1, strides...
ConstBroadcastTest
python
getsentry__sentry
src/sudo/views.py
{ "start": 1102, "end": 4291 }
class ____(View): """ The default view for the sudo mode page. The role of this page is to prompt the user for their password again, and if successful, redirect them back to ``next``. """ form_class = SudoForm template_name = "sudo/sudo.html" extra_context: dict[str, str] | None = None ...
SudoView
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/unions5.py
{ "start": 213, "end": 700 }
class ____: a: int # This should generate an error a1: type[Class1] | type[Class2] = Class1 | Class2 # This should generate an error a2: type[Class1] | type[Class2] = Union[Class1, Class2] b1 = Class1 | Class2 # This should generate an error print(b1.a) # This should generate an error b1() b2 = Union[Class...
Class2
python
spack__spack
lib/spack/spack/vendor/jinja2/nodes.py
{ "start": 33069, "end": 33168 }
class ____(Stmt): """An artificial scope.""" fields = ("body",) body: t.List[Node]
Scope
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/flake8_pie/PIE807.py
{ "start": 564, "end": 809 }
class ____(BaseTable): foo = fields.ListField(list) bar = fields.ListField(dict) lambda *args, **kwargs: [] lambda *args, **kwargs: {} lambda *args: [] lambda *args: {} lambda **kwargs: [] lambda **kwargs: {} lambda: {**unwrap}
FooTable
python
django__django
tests/proxy_models/models.py
{ "start": 4120, "end": 4253 }
class ____(ProxyBug): """ A proxy of proxy model with related field """ class Meta: proxy = True
ProxyProxyBug
python
run-llama__llama_index
llama-index-core/llama_index/core/indices/query/query_transform/feedback_transform.py
{ "start": 955, "end": 4484 }
class ____(BaseQueryTransform): """ Transform the query given the evaluation feedback. Args: eval(Evaluation): An evaluation object. llm(LLM): An LLM. resynthesize_query(bool): Whether to resynthesize the query. resynthesis_prompt(BasePromptTemplate): A prompt for resynthesi...
FeedbackQueryTransformation
python
getsentry__sentry
tests/acceptance/test_organization_group_index.py
{ "start": 602, "end": 6702 }
class ____(AcceptanceTestCase, SnubaTestCase): def setUp(self) -> None: super().setUp() self.user = self.create_user("foo@example.com") self.org = self.create_organization(owner=self.user, name="Rowdy Tiger") self.team = self.create_team( organization=self.org, name="Mari...
OrganizationGroupIndexTest
python
joke2k__faker
faker/providers/bank/en_GB/__init__.py
{ "start": 42, "end": 192 }
class ____(BankProvider): """Implement bank provider for ``en_GB`` locale.""" bban_format = "????##############" country_code = "GB"
Provider
python
pytorch__pytorch
test/distributed/tensor/experimental/test_register_sharding.py
{ "start": 529, "end": 5611 }
class ____(DTensorTestBase): @with_comms def test_softmax_fwd(self): # After registering the custom softmax sharding strategy, # the original entry would have been replaced. # The following line is for showcasing purpose only. DTensor._op_dispatcher.sharding_propagator.op_strateg...
TestRegisterSharding
python
huggingface__transformers
src/transformers/models/gemma3n/modeling_gemma3n.py
{ "start": 37503, "end": 38924 }
class ____(nn.Module): def __init__(self, config: Gemma3nAudioConfig): super().__init__() self.config = config self.register_buffer("gradient_clipping", torch.tensor(self.config.gradient_clipping), persistent=False) self.pre_layer_norm = Gemma3nRMSNorm(self.config.hidden_size) ...
Gemma3nAudioConformerFeedForward
python
django__django
tests/template_tests/syntax_tests/i18n/test_blocktranslate.py
{ "start": 26638, "end": 28520 }
class ____(MultipleLocaleActivationTestCase): tag_name = "blocktranslate" def get_template(self, template_string): return Template( template_string.replace( "{{% blocktranslate ", "{{% {}".format(self.tag_name) ).replace( "{{% endblocktranslate %}...
MultipleLocaleActivationBlockTranslateTests
python
plotly__plotly.py
plotly/graph_objs/layout/shape/_label.py
{ "start": 235, "end": 17369 }
class ____(_BaseLayoutHierarchyType): _parent_path_str = "layout.shape" _path_str = "layout.shape.label" _valid_props = { "font", "padding", "text", "textangle", "textposition", "texttemplate", "texttemplatefallback", "xanchor", "yancho...
Label
python
FactoryBoy__factory_boy
tests/test_alchemy.py
{ "start": 4539, "end": 5260 }
class ____(TransactionTestCase): def test_one_defined(self): obj1 = WithMultipleGetOrCreateFieldsFactory() obj2 = WithMultipleGetOrCreateFieldsFactory(slug=obj1.slug) self.assertEqual(obj1, obj2) def test_both_defined(self): obj1 = WithMultipleGetOrCreateFieldsFactory() ...
MultipleGetOrCreateFieldsTest
python
facebook__pyre-check
client/commands/tests/analyze_test.py
{ "start": 496, "end": 12740 }
class ____(testslide.TestCase): def test_serialize_arguments(self) -> None: def assert_serialized( arguments: analyze.Arguments, items: Iterable[Tuple[str, object]] ) -> None: serialized = arguments.serialize() for key, value in items: if key not i...
ArgumentTest
python
Pylons__pyramid
tests/pkgs/eventonly/__init__.py
{ "start": 77, "end": 321 }
class ____: def __init__(self, val, config): self.val = val def text(self): return f'path_startswith = {self.val}' phash = text def __call__(self, event): return getattr(event.response, 'yup', False)
Yup
python
astropy__astropy
astropy/samp/utils.py
{ "start": 4182, "end": 4824 }
class ____: def __init__(self, send, name): self.__send = send self.__name = name def __getattr__(self, name): return _HubAsClientMethod(self.__send, f"{self.__name}.{name}") def __call__(self, *args): return self.__send(self.__name, args) def get_num_args(f): """ ...
_HubAsClientMethod
python
getsentry__sentry
src/sentry/migrations/0923_dashboard_starred_backfill_orgs.py
{ "start": 1206, "end": 2574 }
class ____(CheckedMigration): # This flag is used to mark that a migration shouldn't be automatically run in production. # This should only be used for operations where it's safe to run the migration after your # code has deployed. So this should not be used for most operations that alter the schema # o...
Migration
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/distributions/special_math_test.py
{ "start": 8020, "end": 8434 }
class ____(NdtrTest): _use_log = True _grid32 = GridSpec( min=sm.LOGNDTR_FLOAT32_LOWER, max=sm.LOGNDTR_FLOAT32_UPPER, shape=[100]) _grid64 = GridSpec( min=sm.LOGNDTR_FLOAT64_LOWER, max=sm.LOGNDTR_FLOAT64_UPPER, shape=[100]) # Differences show up as soon as we're in the tail, so add some atol. _err...
LogNdtrTestMid
python
tensorflow__tensorflow
tensorflow/python/keras/saving/utils_v1/export_output.py
{ "start": 1178, "end": 3358 }
class ____(object): """Represents an output of a model that can be served. These typically correspond to model heads. """ __metaclass__ = abc.ABCMeta _SEPARATOR_CHAR = '/' @abc.abstractmethod def as_signature_def(self, receiver_tensors): """Generate a SignatureDef proto for inclusion in a MetaGrap...
ExportOutput
python
spack__spack
var/spack/test_repos/spack_repo/builtin_mock/packages/py_pip/package.py
{ "start": 217, "end": 458 }
class ____(Package): """Only needed because other mock packages use PythonPackage""" homepage = "http://www.example.com" url = "http://www.example.com/pip-1.0.tar.gz" version("1.0", md5="0123456789abcdef0123456789abcdef")
PyPip
python
bokeh__bokeh
src/bokeh/core/property/wrappers.py
{ "start": 4406, "end": 5586 }
class ____: """ A base class for property container classes that support change notifications on mutating operations. This class maintains an internal list of property owners, and also provides a private mechanism for methods wrapped with :func:`~bokeh.core.property.wrappers.notify_owners` to updat...
PropertyValueContainer
python
sqlalchemy__sqlalchemy
examples/versioned_rows/versioned_map.py
{ "start": 5291, "end": 6674 }
class ____(Base): """Relate ConfigData objects to associated ConfigValue objects.""" __tablename__ = "config_value_association" config_id = Column(ForeignKey("config.id"), primary_key=True) """Reference the primary key of the ConfigData object.""" config_value_id = Column(ForeignKey("config_value...
ConfigValueAssociation
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/matchValue1.py
{ "start": 713, "end": 1977 }
class ____: class_var_1: "MyClass" def __eq__(self, object: "MyClass") -> bool: ... def test_unknown(value_to_match): match value_to_match: case MyEnum1.V1 as a1: reveal_type(a1, expected_text="Unknown") reveal_type(value_to_match, expected_text="Unknown") def test_enum(...
MyClass
python
openai__openai-python
src/openai/resources/videos.py
{ "start": 28709, "end": 29443 }
class ____: def __init__(self, videos: Videos) -> None: self._videos = videos self.create = _legacy_response.to_raw_response_wrapper( videos.create, ) self.retrieve = _legacy_response.to_raw_response_wrapper( videos.retrieve, ) self.list = _le...
VideosWithRawResponse
python
openai__openai-python
src/openai/types/moderation_image_url_input_param.py
{ "start": 240, "end": 375 }
class ____(TypedDict, total=False): url: Required[str] """Either a URL of the image or the base64 encoded image data."""
ImageURL
python
getsentry__sentry
src/sentry/auth/providers/oauth2.py
{ "start": 4998, "end": 8344 }
class ____(Provider, abc.ABC): is_partner = False @abc.abstractmethod def get_client_id(self) -> str: raise NotImplementedError @abc.abstractmethod def get_client_secret(self) -> str: raise NotImplementedError def get_auth_pipeline(self) -> list[AuthView]: return [ ...
OAuth2Provider
python
pytorch__pytorch
torch/testing/_internal/distributed/rpc/examples/reinforcement_learning_rpc_test.py
{ "start": 2882, "end": 4126 }
class ____: r""" An observer has exclusive access to its own environment. Each observer captures the state from its environment, and send the state to the agent to select an action. Then, the observer applies the action to its environment and reports the reward to the agent. """ def __init_...
Observer
python
run-llama__llama_index
llama-index-integrations/readers/llama-index-readers-confluence/llama_index/readers/confluence/event.py
{ "start": 1891, "end": 2239 }
class ____(BaseEvent): """Event emitted when an attachment is successfully processed.""" page_id: str attachment_id: str attachment_name: str attachment_type: str attachment_size: int attachment_link: str @classmethod def class_name(cls) -> str: return "AttachmentProcessedE...
AttachmentProcessedEvent
python
huggingface__transformers
src/transformers/models/prophetnet/modeling_prophetnet.py
{ "start": 47842, "end": 52258 }
class ____(ProphetNetPreTrainedModel): def __init__(self, config: ProphetNetConfig): super().__init__(config) self.word_embeddings = nn.Embedding(config.vocab_size, config.hidden_size, padding_idx=config.pad_token_id) self.position_embeddings = ProphetNetPositionalEmbeddings(config) ...
ProphetNetEncoder
python
pytorch__pytorch
torch/utils/data/datapipes/iter/filelister.py
{ "start": 414, "end": 2554 }
class ____(IterDataPipe[str]): r""" Given path(s) to the root directory, yields file pathname(s) (path + filename) of files within the root directory. Multiple root directories can be provided (functional name: ``list_files``). Args: root: Root directory or a sequence of root directories ...
FileListerIterDataPipe
python
pallets__jinja
src/jinja2/nodes.py
{ "start": 29280, "end": 29508 }
class ____(Expr): """Loads an attribute from the environment object. This is useful for extensions that want to call a callback stored on the environment. """ fields = ("name",) name: str
EnvironmentAttribute
python
run-llama__llama_index
llama-index-integrations/readers/llama-index-readers-github/tests/test_github_repository_reader.py
{ "start": 39254, "end": 44023 }
class ____: """Test edge cases and error handling.""" def test_invalid_filter_type_raises_error(self): """Test that invalid filter types raise ValueError.""" gh_client = GithubClient(GITHUB_TOKEN) with pytest.raises(ValueError, match="Unknown filter type"): reader = GithubR...
TestGithubRepositoryReaderEdgeCases
python
numba__numba
numba/tests/test_maxmin.py
{ "start": 164, "end": 747 }
class ____(unittest.TestCase): def test_max3(self): pyfunc = domax3 argtys = (types.int32, types.float32, types.double) cfunc = njit(argtys)(pyfunc) a = 1 b = 2 c = 3 self.assertEqual(pyfunc(a, b, c), cfunc(a, b, c)) def test_min3(self): pyfunc ...
TestMaxMin
python
apache__thrift
lib/py/src/transport/TTransport.py
{ "start": 7151, "end": 9135 }
class ____(TTransportBase, CReadableTransport): """Class that wraps another transport and frames its I/O when writing.""" def __init__(self, trans,): self.__trans = trans self.__rbuf = BytesIO(b'') self.__wbuf = BytesIO() def isOpen(self): return self.__trans.isOpen() ...
TFramedTransport
python
sqlalchemy__sqlalchemy
test/typing/plain_files/ext/hybrid/hybrid_three.py
{ "start": 768, "end": 1667 }
class ____(Base): __tablename__ = "user" id: Mapped[int] = mapped_column(primary_key=True) name: Mapped[str] = mapped_column(String(100)) accounts: Mapped[List[SavingsAccount]] = relationship() @hybrid_property def _balance_getter(self) -> Optional[Decimal]: if self.accounts: ...
UserStyleOne
python
prompt-toolkit__python-prompt-toolkit
src/prompt_toolkit/layout/controls.py
{ "start": 17066, "end": 17224 }
class ____(NamedTuple): fragments: StyleAndTextTuples source_to_display: Callable[[int], int] display_to_source: Callable[[int], int]
_ProcessedLine
python
matplotlib__matplotlib
lib/matplotlib/offsetbox.py
{ "start": 49512, "end": 53671 }
class ____: """ Helper base class for a draggable artist (legend, offsetbox). Derived classes must override the following methods:: def save_offset(self): ''' Called when the object is picked for dragging; should save the reference position of the artist. ...
DraggableBase
python
giampaolo__psutil
tests/test_system.py
{ "start": 21923, "end": 27129 }
class ____(PsutilTestCase): def test_disk_usage(self): usage = psutil.disk_usage(os.getcwd()) assert usage._fields == ('total', 'used', 'free', 'percent') assert usage.total > 0, usage assert usage.used > 0, usage assert usage.free > 0, usage assert usage.total > usag...
TestDiskAPIs
python
getsentry__sentry
src/sentry/grouping/component.py
{ "start": 10526, "end": 10612 }
class ____(BaseGroupingComponent[str]): id: str = "message"
MessageGroupingComponent
python
bokeh__bokeh
src/bokeh/core/query.py
{ "start": 7318, "end": 7642 }
class ____(_Operator): ''' Predicate to test if property values are greater than some value. Construct and ``GT`` predicate as a dict with ``GT`` as the key, and a value to compare against. .. code-block:: python # matches any models with .size > 10 dict(size={ GT: 10 }) ''' ...
GT
python
oauthlib__oauthlib
oauthlib/openid/connect/core/exceptions.py
{ "start": 1223, "end": 1794 }
class ____(OpenIDClientError): """ The End-User is REQUIRED to select a session at the Authorization Server. The End-User MAY be authenticated at the Authorization Server with different associated accounts, but the End-User did not select a session. This error MAY be returned when the prompt parame...
AccountSelectionRequired
python
pytorch__pytorch
tools/testing/target_determination/heuristics/public_bindings.py
{ "start": 336, "end": 1277 }
class ____(HeuristicInterface): # Literally just a heuristic for test_public_bindings. Pretty much anything # that changes the public API can affect this testp test_public_bindings = "test_public_bindings" additional_files = ["test/allowlist_for_publicAPI.json"] def __init__(self, **kwargs: dict[s...
PublicBindings
python
pytorch__pytorch
torch/_dynamo/replay_record.py
{ "start": 953, "end": 1086 }
class ____: module: ModuleType accessed_attrs: dict[str, Any] = field(default_factory=dict) @dataclasses.dataclass
ModuleRecord
python
TheAlgorithms__Python
graphs/prim.py
{ "start": 237, "end": 3506 }
class ____: """Class Vertex.""" def __init__(self, id_): """ Arguments: id - input an id to identify the vertex Attributes: neighbors - a list of the vertices it is linked to edges - a dict to store the edges's weight """ self.id =...
Vertex