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
tensorflow__tensorflow
tensorflow/python/autograph/pyct/qual_names.py
{ "start": 6529, "end": 8127 }
class ____(gast.NodeTransformer): """Annotates nodes with QN information. Note: Not using NodeAnnos to avoid circular dependencies. """ def visit_Name(self, node): node = self.generic_visit(node) anno.setanno(node, anno.Basic.QN, QN(node.id)) return node def visit_Attribute(self, node): nod...
QnResolver
python
rapidsai__cudf
python/cudf/cudf/pandas/fast_slow_proxy.py
{ "start": 33528, "end": 33643 }
class ____(FallbackError): """Raises cuDF produces a NotImplementedError""" pass
NotImplementedFallbackError
python
automl__auto-sklearn
test/test_pipeline/components/classification/test_decision_tree.py
{ "start": 165, "end": 790 }
class ____(BaseClassificationComponentTest): __test__ = True res = dict() res["default_iris"] = 0.62 res["default_iris_iterative"] = -1 res["default_iris_proba"] = 0.51333963481747835 res["default_iris_sparse"] = 0.41999999999999998 res["default_digits"] = 0.15057680631451123 res["defa...
DecisionTreeComponentTest
python
python__mypy
mypy/semanal_newtype.py
{ "start": 974, "end": 10576 }
class ____: def __init__( self, options: Options, api: SemanticAnalyzerInterface, msg: MessageBuilder ) -> None: self.options = options self.api = api self.msg = msg def process_newtype_declaration(self, s: AssignmentStmt) -> bool: """Check if s declares a NewType; i...
NewTypeAnalyzer
python
coleifer__peewee
tests/regressions.py
{ "start": 54126, "end": 54223 }
class ____(TestModel): key = CharField(primary_key=True) date = DateTimeField(null=True)
NDF
python
getsentry__sentry
src/sentry/workflow_engine/migrations/0073_safe_pending_delete_actiongroupstatus.py
{ "start": 408, "end": 2665 }
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
airbytehq__airbyte
airbyte-integrations/connectors/source-appsflyer/source_appsflyer/source.py
{ "start": 9698, "end": 10053 }
class ____(RawDataMixin, IncrementalAppsflyerStream): intervals = 31 cursor_field = "event_time" def path( self, stream_state: Mapping[str, Any] = None, stream_slice: Mapping[str, Any] = None, next_page_token: Mapping[str, Any] = None ) -> str: return f"raw-data/export/app/{self.app_id}...
InAppEvents
python
spyder-ide__spyder
spyder/api/widgets/auxiliary_widgets.py
{ "start": 1947, "end": 5166 }
class ____(QToolBar): """ Corner widget to hold options menu, spinner and additional options. """ def __init__(self, parent, name): super().__init__(parent) self._icon_size = QSize(16, 16) self.setIconSize(self._icon_size) self._widgets = {} self._actions = [] ...
MainCornerWidget
python
getsentry__sentry
tests/sentry/sentry_apps/api/parsers/test_alert_rule_action.py
{ "start": 201, "end": 1074 }
class ____(unittest.TestCase): def setUp(self) -> None: self.schema: dict[str, Any] = { "type": "alert-rule-action", "title": "Create Task", "settings": { "type": "alert-rule-settings", "description": "This integration allows you to create ...
TestAlertRuleActionSchemaValidation
python
tensorflow__tensorflow
tensorflow/python/module/module_test.py
{ "start": 14244, "end": 14552 }
class ____(module.Module): @def_function.function(autograph=False) @module.Module.with_name_scope def forward(self): return get_name_scope() @def_function.function(autograph=True) @module.Module.with_name_scope def forward_ag(self): return get_name_scope()
ModuleWithFunctionAnnotatedCall
python
Pylons__pyramid
src/pyramid/events.py
{ "start": 224, "end": 3671 }
class ____: """Decorator activated via a :term:`scan` which treats the function being decorated as an event subscriber for the set of interfaces passed as ``*ifaces`` and the set of predicate terms passed as ``**predicates`` to the decorator constructor. For example: .. code-block:: python ...
subscriber
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/links/pubsub.py
{ "start": 1174, "end": 1363 }
class ____(BaseGoogleLink): """Helper class for constructing Pub/Sub Topic Link.""" name = "Pub/Sub Topic" key = "pubsub_topic" format_str = PUBSUB_TOPIC_LINK
PubSubTopicLink
python
pytorch__pytorch
test/test_custom_ops.py
{ "start": 168114, "end": 169603 }
class ____(TestCase): """In infer_schema(), we try to suggest a correct type when the type annotation is wrong.""" def setUp(self): self.supported_base_types = [ int, float, bool, str, torch.device, torch.Tensor, torch....
TestTypeConversion
python
kamyu104__LeetCode-Solutions
Python/maximum-number-of-accepted-invitations.py
{ "start": 4367, "end": 4901 }
class ____(object): def maximumInvitations(self, grid): """ :type grid: List[List[int]] :rtype: int """ adj = collections.defaultdict(list) for i in xrange(len(grid)): for j in xrange(len(grid[0])): if not grid[i][j]: co...
Solution
python
huggingface__transformers
src/transformers/activations.py
{ "start": 6811, "end": 7020 }
class ____(nn.Module): """ Applies the linear activation function, i.e. forwarding input directly to output. """ def forward(self, input: Tensor) -> Tensor: return input
LinearActivation
python
tensorflow__tensorflow
tensorflow/lite/python/test_util_test.py
{ "start": 981, "end": 1557 }
class ____(test_util.TensorFlowTestCase): def testBuiltinOp(self): model_path = resource_loader.get_path_to_datafile('../testdata/add.bin') op_set = tflite_test_util.get_ops_list(gfile.GFile(model_path, 'rb').read()) self.assertCountEqual(op_set, ['ADD']) def testFlexOp(self): model_path = resourc...
TestUtilTest
python
pandas-dev__pandas
asv_bench/benchmarks/index_object.py
{ "start": 2804, "end": 3193 }
class ____: def setup(self): idx_large_fast = RangeIndex(100_000) idx_small_slow = date_range(start="1/1/2012", periods=1) self.mi_large_slow = MultiIndex.from_product([idx_large_fast, idx_small_slow]) self.idx_non_object = RangeIndex(1) def time_non_object_equals_multiindex(se...
IndexEquals
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/orm/interfaces.py
{ "start": 4034, "end": 4199 }
class ____(roles.StatementRole): __slots__ = () _role_name = ( "Executable SQL or text() construct, including ORM aware objects" )
ORMStatementRole
python
django__django
tests/postgres_tests/test_ranges.py
{ "start": 6564, "end": 9899 }
class ____(PostgreSQLTestCase): @classmethod def setUpTestData(cls): cls.timestamps = [ datetime.datetime(year=2016, month=1, day=1), datetime.datetime(year=2016, month=1, day=2, hour=1), datetime.datetime(year=2016, month=1, day=2, hour=12), datetime.date...
TestRangeContainsLookup
python
gevent__gevent
src/greentest/3.10/test_socket.py
{ "start": 110464, "end": 112928 }
class ____(SendmsgTests): # Tests for sendmsg() which require a stream socket and do not # involve recvmsg() or recvmsg_into(). def testSendmsgExplicitNoneAddr(self): # Check that peer address can be specified as None. self.assertEqual(self.serv_sock.recv(len(MSG)), MSG) def _testSendm...
SendmsgStreamTests
python
fluentpython__example-code-2e
21-async/mojifinder/bottle.py
{ "start": 68791, "end": 69240 }
class ____(BaseRequest): ''' A thread-local subclass of :class:`BaseRequest` with a different set of attributes for each thread. There is usually only one global instance of this class (:data:`request`). If accessed during a request/response cycle, this instance always refers to the *current...
LocalRequest
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 187374, "end": 188646 }
class ____(sgqlc.types.Input): """Autogenerated input type of CreateMigrationSource""" __schema__ = github_schema __field_names__ = ("name", "url", "access_token", "type", "owner_id", "github_pat", "client_mutation_id") name = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name="name") """...
CreateMigrationSourceInput
python
walkccc__LeetCode
solutions/238. Product of Array Except Self/238-2.py
{ "start": 0, "end": 367 }
class ____: def productExceptSelf(self, nums: list[int]) -> list[int]: n = len(nums) ans = [1] * n # Use ans as the prefix product array. for i in range(1, n): ans[i] = ans[i - 1] * nums[i - 1] suffix = 1 # suffix product for i, num in reversed(list(enumerate(nums))): ans[i] *= ...
Solution
python
dagster-io__dagster
python_modules/libraries/dagster-fivetran/dagster_fivetran/components/workspace_component/component.py
{ "start": 9952, "end": 10535 }
class ____( create_component_translator_cls(FivetranAccountComponent, DagsterFivetranTranslator), ComponentTranslator[FivetranAccountComponent], ): def __init__(self, component: "FivetranAccountComponent"): self._component = component def get_asset_spec(self, props: FivetranConnectorTableProps)...
FivetranComponentTranslator
python
jazzband__django-polymorphic
src/polymorphic/query.py
{ "start": 2701, "end": 22420 }
class ____(QuerySet): """ QuerySet for PolymorphicModel Contains the core functionality for PolymorphicModel Usually not explicitly needed, except if a custom queryset class is to be used. """ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self._ite...
PolymorphicQuerySet
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/exc.py
{ "start": 16639, "end": 24183 }
class ____(StatementError): """Raised when the execution of a database operation fails. Wraps exceptions raised by the DB-API underlying the database operation. Driver-specific implementations of the standard DB-API exception types are wrapped by matching sub-types of SQLAlchemy's :class:`DBAPIErr...
DBAPIError
python
pyqtgraph__pyqtgraph
pyqtgraph/parametertree/parameterTypes/basetypes.py
{ "start": 10482, "end": 14497 }
class ____(ParameterItem): """ Group parameters are used mainly as a generic parent item that holds (and groups!) a set of child parameters. It also provides a simple mechanism for displaying a button or combo that can be used to add new parameters to the group. """ def __init__(self, param, de...
GroupParameterItem
python
apache__airflow
providers/google/tests/unit/google/cloud/hooks/test_dataproc_metastore.py
{ "start": 14135, "end": 24676 }
class ____: def setup_method(self): with mock.patch( BASE_STRING.format("GoogleBaseHook.__init__"), new=mock_base_gcp_hook_no_default_project_id ): self.hook = DataprocMetastoreHook(gcp_conn_id=TEST_GCP_CONN_ID) @mock.patch(DATAPROC_METASTORE_STRING.format("DataprocMetas...
TestDataprocMetastoreWithoutDefaultProjectIdHook
python
pytorch__pytorch
torch/distributed/elastic/multiprocessing/api.py
{ "start": 32913, "end": 38495 }
class ____(PContext): """``PContext`` holding worker processes invoked as a binary.""" def __init__( self, name: str, entrypoint: str, args: dict[int, tuple], envs: dict[int, dict[str, str]], logs_specs: LogsSpecs, log_line_prefixes: dict[int, str] | None...
SubprocessContext
python
huggingface__transformers
tests/models/dinov3_convnext/test_modeling_dinov3_convnext.py
{ "start": 1394, "end": 5456 }
class ____: def __init__( self, parent, batch_size=13, image_size=32, num_channels=3, hidden_sizes=[10, 20, 30, 40], depths=[2, 2, 3, 2], is_training=False, use_labels=True, intermediate_size=37, hidden_act="gelu", num_l...
DINOv3ConvNextModelTester
python
pypa__pip
src/pip/_vendor/pygments/filters/__init__.py
{ "start": 38098, "end": 39322 }
class ____(Filter): """Gobbles source code lines (eats initial characters). This filter drops the first ``n`` characters off every line of code. This may be useful when the source code fed to the lexer is indented by a fixed amount of space that isn't desired in the output. Options accepted: ...
GobbleFilter
python
readthedocs__readthedocs.org
readthedocs/api/v3/serializers.py
{ "start": 1976, "end": 2238 }
class ____(serializers.Serializer): def _absolute_url(self, path): scheme = "http" if settings.DEBUG else "https" domain = settings.PRODUCTION_DOMAIN return urllib.parse.urlunparse((scheme, domain, path, "", "", ""))
BaseLinksSerializer
python
bokeh__bokeh
src/bokeh/client/states.py
{ "start": 2518, "end": 2769 }
class ____(State): ''' The ``ClientConnection`` connected to a Bokeh server, and has received an ACK from it. ''' async def run(self, connection: ClientConnection) -> None: await connection._handle_messages()
CONNECTED_AFTER_ACK
python
bokeh__bokeh
src/bokeh/core/serialization.py
{ "start": 5178, "end": 5437 }
class ____: """ A mixin for making a type serializable. """ def to_serializable(self, serializer: Serializer) -> AnyRep: """ Converts this object to a serializable representation. """ raise NotImplementedError() ObjID = int
Serializable
python
HypothesisWorks__hypothesis
hypothesis-python/tests/nocover/test_stateful.py
{ "start": 2654, "end": 3009 }
class ____(RuleBasedStateMachine): nodes = Bundle("nodes") @rule(target=nodes, source=st.lists(nodes)) def bunch(self, source): return source @rule(source=nodes) def shallow(self, source): def depth(ls): return 0 if not ls else 1 + max(map(depth, ls)) assert de...
RoseTreeStateMachine
python
numba__numba
numba/tests/test_array_reductions.py
{ "start": 36480, "end": 37977 }
class ____(MemoryLeakMixin, TestCase): # int64, size 0 zero_size = np.arange(0) def check_exception(self, pyfunc, msg): cfunc = jit(nopython=True)(pyfunc) # make sure NumPy raises consistently/no behaviour change with self.assertRaises(BaseException): pyfunc(self.zero_s...
TestArrayReductionsExceptions
python
numba__numba
numba/tests/test_parallel_backend.py
{ "start": 23921, "end": 31573 }
class ____(ThreadLayerTestHelper): """ Checks Numba's behaviour in various situations involving GNU OpenMP and fork """ _DEBUG = False def test_check_threading_layer_is_gnu(self): runme = """if 1: from numba.np.ufunc import omppool assert omppool.openmp_vendor == 'GN...
TestForkSafetyIssues
python
squidfunk__mkdocs-material
material/plugins/social/plugin.py
{ "start": 2687, "end": 46662 }
class ____(BasePlugin[SocialConfig]): supports_multiple_instances = True # Manifest manifest: dict[str, str] = {} # Initialize plugin def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) # Initialize incremental builds self.is_serve = False # Determi...
SocialPlugin
python
django__django
tests/migrations/test_migrations_manual_porting/0001_initial.py
{ "start": 43, "end": 344 }
class ____(migrations.Migration): initial = True operations = [ migrations.CreateModel( "SomeModel", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField(max_length=255)), ], ), ]
Migration
python
PrefectHQ__prefect
src/prefect/server/schemas/actions.py
{ "start": 34848, "end": 35516 }
class ____(ActionBaseModel): """Data used by the Prefect REST API to update a work queue.""" name: Optional[str] = Field(None) description: Optional[str] = Field(None) is_paused: bool = Field( default=False, description="Whether or not the work queue is paused." ) concurrency_limit: Opt...
WorkQueueUpdate
python
python-poetry__poetry
tests/conftest.py
{ "start": 3871, "end": 4537 }
class ____(BaseConfig): _config_source: DictConfigSource _auth_config_source: DictConfigSource def get(self, setting_name: str, default: Any = None) -> Any: self.merge(self._config_source.config) self.merge(self._auth_config_source.config) return super().get(setting_name, default=d...
Config
python
sqlalchemy__sqlalchemy
test/sql/test_insert.py
{ "start": 38526, "end": 42889 }
class ____( _InsertTestBase, fixtures.TablesTest, AssertsCompiledSQL ): __dialect__ = "default_enhanced" def test_from_bound_col_value(self): mytable = self.tables.mytable # from_dml_column() refers to another column in SET, then the # same parameter is rendered stmt = myta...
FromDMLInsertTest
python
HypothesisWorks__hypothesis
hypothesis-python/src/hypothesis/internal/filtering.py
{ "start": 1706, "end": 14637 }
class ____(NamedTuple): """Return constraints to the appropriate strategy, and the predicate if needed. For example:: integers().filter(lambda x: x >= 0) -> {"min_value": 0"}, None integers().filter(lambda x: x >= 0 and x % 7) -> {"min_value": 0}, lambda x: x % 7 At least...
ConstructivePredicate
python
pytorch__pytorch
torch/distributed/pipelining/_IR.py
{ "start": 19548, "end": 46090 }
class ____(torch.nn.Module): def __init__( self, split_gm: fx.GraphModule, num_stages: int, has_loss_and_backward: bool, loss_spec, ): # TODO: is there a way not to hard wire init? torch.nn.Module.__init__(self) self.split_gm: fx.GraphModule = spli...
Pipe
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 1288163, "end": 1289925 }
class ____(sgqlc.types.Type, Node): """A GitHub Enterprise Importer (GEI) organization migration.""" __schema__ = github_schema __field_names__ = ( "created_at", "database_id", "failure_reason", "remaining_repositories_count", "source_org_name", "source_org_u...
OrganizationMigration
python
django__django
tests/constraints/models.py
{ "start": 1665, "end": 2352 }
class ____(models.Model): name = models.CharField(max_length=255, null=True) price = models.IntegerField(null=True) discounted_price = models.IntegerField(null=True) rebate = models.GeneratedField( expression=Coalesce("price", 0) - Coalesce("discounted_price", Coalesce("price", 0)), ...
GeneratedFieldVirtualProduct
python
tensorflow__tensorflow
tensorflow/compiler/tests/jit_test.py
{ "start": 9811, "end": 17180 }
class ____(test.TestCase): """Tests for auto-compilation on CPU/GPU devices.""" def testReshape(self): """Tests an operator with compile-time constant and non-constant inputs.""" with self.session(config=NoRewriteSessionConfig()) as sess: x = array_ops.placeholder(dtypes.float32) y = array_ops...
XlaCompilationTest
python
huggingface__transformers
tests/models/vipllava/test_modeling_vipllava.py
{ "start": 5627, "end": 10928 }
class ____(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase): """ Model tester for `VipLlavaForConditionalGeneration`. """ all_model_classes = ( ( VipLlavaModel, VipLlavaForConditionalGeneration, ) if is_torch_available() else () ) ...
VipLlavaForConditionalGenerationModelTest
python
spack__spack
lib/spack/spack/vendor/ruamel/yaml/compat.py
{ "start": 3083, "end": 5320 }
class ____: def __init__(self, file_name=None): # type: (Any) -> None self._max_print = None # type: Any self._count = None # type: Any self._file_name = file_name def __call__(self, *args, **kw): # type: (Any, Any) -> None if not bool(_debug): retu...
Nprint
python
sqlalchemy__sqlalchemy
test/dialect/mssql/test_compiler.py
{ "start": 63571, "end": 71429 }
class ____(fixtures.TestBase, AssertsCompiledSQL): __dialect__ = mssql.dialect() def assert_compile_with_warning(self, *args, **kwargs): with testing.expect_deprecated( "The dialect options 'mssql_identity_start' and " "'mssql_identity_increment' are deprecated. " "U...
CompileIdentityTest
python
mlflow__mlflow
mlflow/langchain/output_parsers.py
{ "start": 3197, "end": 3799 }
class ____(BaseTransformOutputParser[dict[str, Any]]): """ OutputParser that wraps the string output into an dictionary representation of a :py:class:`StringResponse` """ @classmethod def is_lc_serializable(cls) -> bool: """Return whether this class is serializable.""" return Tr...
StringResponseOutputParser
python
django-extensions__django-extensions
tests/testapp/models.py
{ "start": 12499, "end": 12603 }
class ____(TimeStampedModel): class Meta: app_label = "django_extensions"
TimestampedTestModel
python
rapidsai__cudf
python/cudf_polars/cudf_polars/utils/config.py
{ "start": 5168, "end": 5580 }
class ____(str, enum.Enum): """ **Deprecated**: Use :class:`Cluster` instead. The scheduler to use for the task-based streaming executor. * ``Scheduler.SYNCHRONOUS`` : Single-GPU execution (use ``Cluster.SINGLE`` instead) * ``Scheduler.DISTRIBUTED`` : Multi-GPU execution (use ``Cluster.DISTRIBUTED...
Scheduler
python
mlflow__mlflow
dev/clint/src/clint/rules/use_sys_executable.py
{ "start": 84, "end": 1105 }
class ____(Rule): def _message(self) -> str: return ( "Use `[sys.executable, '-m', 'mlflow', ...]` when running mlflow CLI in a subprocess." ) @staticmethod def check(node: ast.Call, resolver: Resolver) -> bool: """ Returns True if `node` looks like `subprocess.P...
UseSysExecutable
python
realpython__materials
python-tic-tac-toe-game-tkinter/source_code_step_3/tic_tac_toe.py
{ "start": 407, "end": 2787 }
class ____: def __init__(self, players=DEFAULT_PLAYERS, board_size=BOARD_SIZE): self._players = cycle(players) self.board_size = board_size self.current_player = next(self._players) self.winner_combo = [] self._current_moves = [] self._has_winner = False self....
TicTacToeGame
python
tensorflow__tensorflow
tensorflow/python/keras/regularizers.py
{ "start": 8995, "end": 9876 }
class ____(Regularizer): """A regularizer that applies a L1 regularization penalty. The L1 regularization penalty is computed as: `loss = l1 * reduce_sum(abs(x))` L1 may be passed to a layer as a string identifier: >>> dense = tf.keras.layers.Dense(3, kernel_regularizer='l1') In this case, the default v...
L1
python
doocs__leetcode
solution/0200-0299/0223.Rectangle Area/Solution.py
{ "start": 0, "end": 432 }
class ____: def computeArea( self, ax1: int, ay1: int, ax2: int, ay2: int, bx1: int, by1: int, bx2: int, by2: int, ) -> int: a = (ax2 - ax1) * (ay2 - ay1) b = (bx2 - bx1) * (by2 - by1) width = min(ax2, bx2) - max(ax1...
Solution
python
apache__airflow
providers/amazon/src/airflow/providers/amazon/aws/operators/s3.py
{ "start": 1519, "end": 3287 }
class ____(AwsBaseOperator[S3Hook]): """ This operator creates an S3 bucket. .. seealso:: For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:S3CreateBucketOperator` :param bucket_name: This is bucket name you want to create :param aws_c...
S3CreateBucketOperator
python
PrefectHQ__prefect
src/prefect/exceptions.py
{ "start": 5292, "end": 5804 }
class ____(PrefectException, TypeError): """Raised when parameters passed to a function do not match its signature.""" def __init__(self, msg: str): super().__init__(msg) @classmethod def from_bad_params( cls, expected_params: list[str], provided_params: list[str] ) -> Self: ...
SignatureMismatchError
python
kennethreitz__tablib
src/tablib/formats/_html.py
{ "start": 107, "end": 1601 }
class ____: BOOK_ENDINGS = 'h3' title = 'html' extensions = ('html', ) @classmethod def export_set(cls, dataset): """HTML representation of a Dataset.""" stream = BytesIO() page = markup.page() page.table.open() if dataset.headers is not None: ...
HTMLFormat
python
getsentry__sentry
src/sentry/utils/email/signer.py
{ "start": 213, "end": 1695 }
class ____(Signer): """ Generate a signature that is comprised of only lowercase letters. WARNING: Do not use this for anything that needs to be cryptographically secure! This is losing entropy and has a much higher chance of collision due to dropping to lowercase letters. For our purposes, this la...
_CaseInsensitiveSigner
python
great-expectations__great_expectations
contrib/great_expectations_semantic_types_expectations/great_expectations_semantic_types_expectations/expectations/expect_column_values_to_be_valid_isbn10.py
{ "start": 1566, "end": 3819 }
class ____(ColumnMapExpectation): """Expect column values to be valid ISBN10 format.""" # These examples will be shown in the public gallery. # They will also be executed as unit tests for your Expectation. examples = [ { "data": { "well_formed_isbn10": [ ...
ExpectColumnValuesToBeValidIsbn10
python
huggingface__transformers
tests/models/time_series_transformer/test_modeling_time_series_transformer.py
{ "start": 19689, "end": 23247 }
class ____(unittest.TestCase): def test_inference_no_head(self): model = TimeSeriesTransformerModel.from_pretrained("huggingface/time-series-transformer-tourism-monthly").to( torch_device ) batch = prepare_batch() with torch.no_grad(): output = model( ...
TimeSeriesTransformerModelIntegrationTests
python
great-expectations__great_expectations
contrib/great_expectations_semantic_types_expectations/great_expectations_semantic_types_expectations/expectations/expect_column_values_to_be_valid_ean.py
{ "start": 1834, "end": 4379 }
class ____(ColumnMapExpectation): """Expect column values to be valid EAN (International Article Number).""" # These examples will be shown in the public gallery. # They will also be executed as unit tests for your Expectation. examples = [ { "data": { "all_valid": [...
ExpectColumnValuesToBeValidEan
python
spyder-ide__spyder
external-deps/python-lsp-server/test/plugins/test_type_definition.py
{ "start": 276, "end": 1471 }
class ____: a: int b: int def main() -> None: l0 = list(1, 2) my_pair = IntPair(a=10, b=20) print(f"Original pair: {my_pair}") """ def test_type_definitions(config, workspace) -> None: # Over 'IntPair' in 'main' cursor_pos = {"line": 10, "character": 14} # The definition of 'IntPair...
IntPair
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/dataclass4.py
{ "start": 836, "end": 1015 }
class ____(DC3): # This should not generate an error because # aa replaces aa in DC3, and it's ordered # before the params with default values. aa: C2 @dataclass
DC5
python
dagster-io__dagster
python_modules/dagster/dagster/_core/definitions/partitions/utils/time_window.py
{ "start": 1583, "end": 2189 }
class ____: def __init__(self, time_window: TimeWindow, status: PartitionRangeStatus): self.time_window = time_window self.status = status def __repr__(self): return f"({self.time_window.start} - {self.time_window.end}): {self.status.value}" def __eq__(self, other): return ...
PartitionTimeWindowStatus
python
pyqtgraph__pyqtgraph
pyqtgraph/flowchart/library/Operators.py
{ "start": 3036, "end": 3247 }
class ____(BinOpNode): """Returns A // B. Does not check input types.""" nodeName = 'FloorDivide' def __init__(self, name): BinOpNode.__init__(self, name, '__floordiv__')
FloorDivideNode
python
Lightning-AI__lightning
src/lightning/pytorch/cli.py
{ "start": 3465, "end": 9393 }
class ____(ArgumentParser): """Extension of jsonargparse's ArgumentParser for pytorch-lightning.""" def __init__( self, *args: Any, description: str = "Lightning Trainer command line tool", env_prefix: str = "PL", default_env: bool = False, **kwargs: Any, ) -...
LightningArgumentParser
python
jmcnamara__XlsxWriter
xlsxwriter/test/worksheet/test_write_page_margins.py
{ "start": 301, "end": 3572 }
class ____(unittest.TestCase): """ Test the Worksheet _write_page_margins() method. """ def setUp(self): self.fh = StringIO() self.worksheet = Worksheet() self.worksheet._set_filehandle(self.fh) def test_write_page_margins(self): """Test the _write_page_margins() m...
TestWritePageMargins
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_chart_axis33.py
{ "start": 315, "end": 1570 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("chart_axis33.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file.""" workbook = Workbook(self.got_...
TestCompareXLSXFiles
python
tiangolo__fastapi
docs_src/dependencies/tutorial013_an_py310.py
{ "start": 284, "end": 937 }
class ____(SQLModel, table=True): id: int | None = Field(default=None, primary_key=True) name: str app = FastAPI() def get_session(): with Session(engine) as session: yield session def get_user(user_id: int, session: Annotated[Session, Depends(get_session)]): user = session.get(User, user_...
User
python
scipy__scipy
scipy/special/tests/test_orthogonal.py
{ "start": 2722, "end": 4473 }
class ____: def test_gegenbauer(self): a = 5*np.random.random() - 0.5 if np.any(a == 0): a = -0.2 Ca0 = orth.gegenbauer(0,a) Ca1 = orth.gegenbauer(1,a) Ca2 = orth.gegenbauer(2,a) Ca3 = orth.gegenbauer(3,a) Ca4 = orth.gegenbauer(4,a) Ca5 = ...
TestGegenbauer
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/links/translate.py
{ "start": 3097, "end": 3411 }
class ____(BaseGoogleLink): """ Helper class for constructing Translation Legacy Model link. Legacy Models are created and managed by AutoML API. """ name = "Translation Legacy Model" key = "translation_legacy_model" format_str = TRANSLATION_LEGACY_MODEL_LINK
TranslationLegacyModelLink
python
huggingface__transformers
src/transformers/models/gemma3n/modeling_gemma3n.py
{ "start": 5519, "end": 6409 }
class ____(nn.Module): def __init__(self, dim: int, eps: float = 1e-6, with_scale: bool = True): super().__init__() self.eps = eps self.with_scale = with_scale if self.with_scale: self.weight = nn.Parameter(torch.ones(dim)) else: self.register_buffer(...
Gemma3nRMSNorm
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/function3.py
{ "start": 141, "end": 286 }
class ____: def method(self) -> None: pass # This should generate an error. func1: Callable[[float], None] = TestClass.method
TestClass
python
bokeh__bokeh
src/bokeh/models/ui/icons.py
{ "start": 2060, "end": 2518 }
class ____(UIElement): """ An abstract base class for icon elements. """ # explicit __init__ to support Init signatures def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) size = Either(Int, FontSize, default="1em", help=""" The size of the icon. T...
Icon
python
spyder-ide__spyder
spyder/plugins/pylint/main_widget.py
{ "start": 2299, "end": 2366 }
class ____: Main = "main_section"
PylintWidgetMainToolbarSections
python
pytorch__pytorch
torch/distributed/elastic/metrics/api.py
{ "start": 749, "end": 952 }
class ____: __slots__ = ["params"] def __init__(self, params: dict[str, str] | None = None): self.params = params if self.params is None: self.params = {}
MetricsConfig
python
google__pytype
pytype/pyi/parser_test.py
{ "start": 76039, "end": 76621 }
class ____(parser_test_base.ParserTestBase): def test_basic(self): self.check( """ from typing import NewType X = NewType('X', int) """, """ X = newtype_X_0 class newtype_X_0(int): def __init__(self, val: int) -> None: ... """, ) def test_fullname...
NewTypeTest
python
google__flatbuffers
python/flatbuffers/number_types.py
{ "start": 1406, "end": 1553 }
class ____(object): bytewidth = 4 min_val = 0 max_val = (2**32) - 1 py_type = int name = "uint32" packer_type = packer.uint32
Uint32Flags
python
huggingface__transformers
tests/quantization/fp_quant_integration/test_fp_quant.py
{ "start": 986, "end": 2025 }
class ____(unittest.TestCase): def test_to_dict(self): """ Simple test that checks if one uses a config and converts it to a dict, the dict is the same as the config object """ quantization_config = FPQuantConfig() config_to_dict = quantization_config.to_dict() for k...
FPQuantConfigTest
python
walkccc__LeetCode
solutions/2595. Number of Even and Odd Bits/2595.py
{ "start": 0, "end": 195 }
class ____: def evenOddBit(self, n: int) -> list[int]: ans = [0] * 2 i = 0 # 0 := even, 1 := odd while n > 0: ans[i] += n & 1 n >>= 1 i ^= 1 return ans
Solution
python
getsentry__sentry
src/sentry/models/apitoken.py
{ "start": 1893, "end": 4008 }
class ____(ControlOutboxProducingManager["ApiToken"]): def create(self, *args, **kwargs): token_type: AuthTokenType | None = kwargs.get("token_type", None) # Typically the .create() method is called with `refresh_token=None` as an # argument when we specifically do not want a refresh_token....
ApiTokenManager
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/sql/sqltypes.py
{ "start": 69085, "end": 72382 }
class ____(TypeDecorator[object]): """Holds Python objects, which are serialized using pickle. PickleType builds upon the Binary type to apply Python's ``pickle.dumps()`` to incoming objects, and ``pickle.loads()`` on the way out, allowing any pickleable Python object to be stored as a serialized b...
PickleType
python
huggingface__transformers
src/transformers/models/omdet_turbo/modeling_omdet_turbo.py
{ "start": 27883, "end": 28782 }
class ____(nn.Module): def __init__(self, config: OmDetTurboConfig): super().__init__() self.layers = nn.ModuleList([OmDetTurboEncoderLayer(config) for _ in range(config.encoder_layers)]) def forward( self, src, src_mask=None, pos_embed=None, output_attentions: bool = False ) -> tu...
OmDetTurboEncoder
python
ray-project__ray
python/ray/tests/conftest_docker.py
{ "start": 838, "end": 7631 }
class ____(wrappers.Container): def ready(self): self._container.reload() if self.status == "exited": from pytest_docker_tools.exceptions import ContainerFailed raise ContainerFailed( self, f"Container {self.name} has already exited before " ...
Container
python
Textualize__textual
src/textual/reactive.py
{ "start": 3304, "end": 14780 }
class ____(Generic[ReactiveType]): """Reactive descriptor. Args: default: A default value or callable that returns a default. layout: Perform a layout on change. repaint: Perform a repaint on change. init: Call watchers on initialize (post mount). always_update: Call wat...
Reactive
python
kubernetes-client__python
kubernetes/client/models/v1_container_restart_rule_on_exit_codes.py
{ "start": 383, "end": 5305 }
class ____(object): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. """ """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attri...
V1ContainerRestartRuleOnExitCodes
python
dagster-io__dagster
examples/project_analytics/dagster_pypi/resources.py
{ "start": 1321, "end": 2151 }
class ____(PyPiResource): table: str = Field(description="BigQuery public table to query") def get_pypi_download_counts(self, date) -> pd.DataFrame: print("Fetching from bigquery for a given date: ", date) client = bigquery.Client() query = f""" SELECT date_trunc(file_...
PyPiBigQueryResource
python
PyCQA__pylint
doc/data/messages/s/super-without-brackets/bad.py
{ "start": 0, "end": 78 }
class ____: @staticmethod def temp(): print("Soup is hot!")
Soup
python
PrefectHQ__prefect
src/prefect/server/orchestration/rules.py
{ "start": 44390, "end": 44504 }
class ____( BaseUniversalTransform[orm_models.TaskRun, core.TaskRunPolicy] ): pass
TaskRunUniversalTransform
python
ansible__ansible
test/units/module_utils/urls/test_fetch_url.py
{ "start": 574, "end": 620 }
class ____(AnsibleModuleExit): pass
ExitJson
python
huggingface__transformers
src/transformers/models/convbert/modeling_convbert.py
{ "start": 20804, "end": 21600 }
class ____(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) if isinstance(config.hidden_act, str): self.transform_act_fn = ACT2FN[config.hidden_act] else: self.transform_act_fn = config.h...
ConvBertPredictionHeadTransform
python
tensorflow__tensorflow
tensorflow/python/eager/monitoring.py
{ "start": 5904, "end": 6488 }
class ____(object): """CounterCell stores each value of a Counter.""" __slots__ = ["_cell"] def __init__(self, cell): """Creates a new CounterCell. Args: cell: A c pointer of TFE_MonitoringCounterCell. """ self._cell = cell def increase_by(self, value): """Atomically increments the...
CounterCell
python
apache__airflow
providers/openlineage/src/airflow/providers/openlineage/plugins/listener.py
{ "start": 3032, "end": 33191 }
class ____: """OpenLineage listener sends events on task instance and dag run starts, completes and failures.""" def __init__(self): self._executor = None self.log = logging.getLogger(__name__) self.extractor_manager = ExtractorManager() self.adapter = OpenLineageAdapter() ...
OpenLineageListener
python
realpython__materials
python-oop/starfleet_objects.py
{ "start": 35, "end": 410 }
class ____: def __init__(self, name, age, position, year_started): self.name = name self.age = age self.position = position self.year_started = year_started kirk = Employee("James Kirk", 34, "Captain", 2265) spock = Employee("Spock", 35, "Science Officer", 2254) mccoy = Employee("L...
Employee
python
huggingface__transformers
src/transformers/models/glm4/modeling_glm4.py
{ "start": 16383, "end": 19504 }
class ____(Glm4PreTrainedModel): def __init__(self, config: Glm4Config): 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) self.layers ...
Glm4Model
python
scikit-learn__scikit-learn
sklearn/externals/array_api_compat/common/_typing.py
{ "start": 3439, "end": 3568 }
class ____(TypedDict): complex64: DType complex128: DType # `__array_namespace_info__.dtypes(kind="numeric")`
DTypesComplex
python
conda__conda
conda/auxlib/exceptions.py
{ "start": 149, "end": 245 }
class ____: """Mixin to identify exceptions associated with the auxlib package."""
AuxlibError