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
huggingface__transformers
examples/quantization/custom_quantization_int8_example.py
{ "start": 488, "end": 4137 }
class ____(torch.nn.Module): def __init__(self, in_features, out_features, bias, dtype=torch.float32): super().__init__() self.in_features = in_features self.out_features = out_features self.register_buffer("weight", torch.zeros((out_features, in_features), dtype=torch.int8)) ...
Int8SymmetricLinear
python
encode__django-rest-framework
tests/test_model_serializer.py
{ "start": 39264, "end": 39936 }
class ____(TestCase): def test_queryset_all(self): class TestSerializer(serializers.ModelSerializer): additional_attr = serializers.CharField() class Meta: model = OneFieldModel fields = ('char_field', 'additional_attr') OneFieldModel.objects...
Issue2704TestCase
python
allegroai__clearml
clearml/automation/scheduler.py
{ "start": 3309, "end": 12801 }
class ____(BaseScheduleJob): _weekdays_ind = ( "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday", ) execution_limit_hours = attrib(type=float, default=None) recurring = attrib(type=bool, default=True) starting_time =...
ScheduleJob
python
nedbat__coveragepy
coverage/results.py
{ "start": 6560, "end": 10386 }
class ____: """ For reducing an `Analysis` to a subset of its lines. Originally this was a simpler method on Analysis, but that led to quadratic behavior. This class does the bulk of the work up-front to provide the same results in linear time. Create an AnalysisNarrower from an Analysis, bul...
AnalysisNarrower
python
mlflow__mlflow
mlflow/telemetry/events.py
{ "start": 168, "end": 382 }
class ____: name: str @classmethod def parse(cls, arguments: dict[str, Any]) -> dict[str, Any] | None: """ Parse the arguments and return the params. """ return None
Event
python
facebook__pyre-check
tools/generate_taint_models/tests/get_models_filtered_by_callable_test.py
{ "start": 1195, "end": 1532 }
class ____(unittest.TestCase): def test_compute_models(self) -> None: generator = ModelsFilteredByCallableGenerator( generator_to_filter=TestModelGenerator(), filter=is_even_index ) self.assertListEqual(generator.compute_models([]), [TestModel(0), TestModel(2)])
ModelsFilteredByCallableGeneratorTest
python
google__pytype
pytype/pytd/serialize_ast.py
{ "start": 526, "end": 770 }
class ____(visitors.Visitor): """Visitor to find class and function types.""" def __init__(self): super().__init__() self.class_type_nodes = [] def EnterClassType(self, n): self.class_type_nodes.append(n)
FindClassTypesVisitor
python
numba__numba
numba/core/types/scalars.py
{ "start": 3505, "end": 4084 }
class ____(Number): def __init__(self, name, underlying_float, **kwargs): super(Complex, self).__init__(name, **kwargs) self.underlying_float = underlying_float # Determine bitwidth assert self.name.startswith('complex') bitwidth = int(self.name[7:]) self.bitwidth = b...
Complex
python
weaviate__weaviate-python-client
weaviate/collections/config/executor.py
{ "start": 1473, "end": 23218 }
class ____(Generic[ConnectionType]): def __init__( self, connection: ConnectionType, name: str, tenant: Optional[str] = None, ) -> None: self._connection = connection self._name = name self._tenant = tenant def __get(self) -> executor.Result[Dict[str,...
_ConfigCollectionExecutor
python
pdm-project__pdm
src/pdm/cli/commands/venv/create.py
{ "start": 192, "end": 2156 }
class ____(BaseCommand): """Create a virtualenv pdm venv create <python> [-other args] """ description = "Create a virtualenv" arguments = (verbose_option,) def add_arguments(self, parser: argparse.ArgumentParser) -> None: parser.add_argument( "-w", "--with", ...
CreateCommand
python
bokeh__bokeh
src/bokeh/server/tornado.py
{ "start": 3019, "end": 31887 }
class ____(TornadoApplication): ''' A Tornado Application used to implement the Bokeh Server. Args: applications (dict[str,Application] or Application) : A map from paths to ``Application`` instances. If the value is a single Application, then the following mapping ...
BokehTornado
python
allegroai__clearml
clearml/backend_api/services/v2_23/frames.py
{ "start": 173337, "end": 176515 }
class ____(Response): """ Response of frames.get_count_for_dataview_id endpoint. :param total: Total count of frames for the entire query. :type total: int :param rules: Specific information for each rule of this query. :type rules: Sequence[RuleCount] """ _service = "frames" _acti...
GetCountForDataviewIdResponse
python
facebook__pyre-check
source/interprocedural_analyses/taint/test/integration/always_in_none.py
{ "start": 294, "end": 877 }
class ____: def serve_tainted_request(self): return "Valid" def test(complicated_service: ComplicatedService): exception = False result = None try: result = complicated_service.serve_tainted_request() except: exception = True # Only try reactivation if all other check...
ComplicatedService
python
great-expectations__great_expectations
great_expectations/types/configurations.py
{ "start": 77, "end": 520 }
class ____: """Defines information sufficient to identify a class to be (dynamically) loaded for a DataContext.""" # noqa: E501 # FIXME CoP def __init__(self, class_name, module_name=None) -> None: self._class_name = class_name self._module_name = module_name @property def class_name(...
ClassConfig
python
matplotlib__matplotlib
lib/matplotlib/dates.py
{ "start": 39869, "end": 42120 }
class ____(DateLocator): # use the dateutil rrule instance def __init__(self, o, tz=None): super().__init__(tz) self.rule = o def __call__(self): # if no data have been set, this will tank with a ValueError try: dmin, dmax = self.viewlim_to_dt() except V...
RRuleLocator
python
plotly__plotly.py
plotly/graph_objs/sankey/node/hoverlabel/_font.py
{ "start": 233, "end": 17163 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "sankey.node.hoverlabel" _path_str = "sankey.node.hoverlabel.font" _valid_props = { "color", "colorsrc", "family", "familysrc", "lineposition", "linepositionsrc", "shadow", "shadowsrc", ...
Font
python
openai__openai-python
src/openai/types/uploads/part_create_params.py
{ "start": 240, "end": 362 }
class ____(TypedDict, total=False): data: Required[FileTypes] """The chunk of bytes for this Part."""
PartCreateParams
python
getsentry__sentry
src/sentry/workflow_engine/processors/delayed_workflow.py
{ "start": 17247, "end": 32158 }
class ____(Exception): """ Raised when a group is missing from a query result. """ def __init__( self, group_id: GroupId, query: UniqueConditionQuery, query_result: QueryResult | None ): self.group_id = group_id self.query = query self.query_result = query_result d...
MissingQueryResult
python
huggingface__transformers
src/transformers/models/metaclip_2/modeling_metaclip_2.py
{ "start": 29895, "end": 39079 }
class ____(MetaClip2PreTrainedModel): """ This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads etc.) This model is also a PyTorch...
MetaClip2Model
python
matplotlib__matplotlib
lib/matplotlib/backends/backend_macosx.py
{ "start": 4359, "end": 5750 }
class ____(_macosx.NavigationToolbar2, NavigationToolbar2): def __init__(self, canvas): data_path = cbook._get_data_path('images') _, tooltips, image_names, _ = zip(*NavigationToolbar2.toolitems) _macosx.NavigationToolbar2.__init__( self, canvas, tuple(str(data_path ...
NavigationToolbar2Mac
python
pytorch__pytorch
torch/_dynamo/variables/iter.py
{ "start": 18109, "end": 19199 }
class ____(ZipVariable): """ Represents map(fn, *iterables) """ def __init__( self, fn: VariableTracker, iterables: list[VariableTracker], **kwargs: Any, ) -> None: super().__init__(iterables, **kwargs) self.fn = fn def python_type(self) -> type:...
MapVariable
python
getsentry__sentry
tests/sentry/integrations/msteams/notifications/test_note.py
{ "start": 590, "end": 2232 }
class ____(MSTeamsActivityNotificationTest): def test_note(self, mock_send_card: MagicMock) -> None: """ Test that the card for MS Teams notification is generated correctly when a comment is made on an issue. """ notification = NoteActivityNotification( Activity( ...
MSTeamsNoteNotificationTest
python
redis__redis-py
tests/test_asyncio/test_multidb/test_pipeline.py
{ "start": 10371, "end": 19684 }
class ____: @pytest.mark.asyncio @pytest.mark.parametrize( "mock_multi_db_config,mock_db, mock_db1, mock_db2", [ ( {}, {"weight": 0.2, "circuit": {"state": CBState.CLOSED}}, {"weight": 0.7, "circuit": {"state": CBState.CLOSED}}, ...
TestTransaction
python
readthedocs__readthedocs.org
readthedocs/api/v3/filters.py
{ "start": 1804, "end": 1963 }
class ____(filters.FilterSet): class Meta: model = Notification fields = { "state": ["in", "exact"], }
NotificationFilter
python
tensorflow__tensorflow
tensorflow/python/compiler/tensorrt/test/reshape_transpose_test.py
{ "start": 1063, "end": 3497 }
class ____(trt_test.TfTrtIntegrationTestBase): def GraphFn(self, inp): outputs = [] # Here we test two types of reshapes, one changes the batch dimension and # the other does not. Note that we're not able to test reshaping to # scalar, since TRT requires input tensor to be of rank at least 2, so a ...
ReshapeTest
python
pytorch__pytorch
torch/_dynamo/functional_export.py
{ "start": 8339, "end": 18562 }
class ____(torch.fx.Transformer): """Graph transformer for dynamo export that flattens inputs/outputs without complex matching.""" def __init__( self, module: torch.fx.GraphModule, flat_inputs: list[Any], flat_args_dynamic_dims: list[set[int]], graph_input_order: dict[in...
DynamoGraphTransformer
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 775114, "end": 775897 }
class ____(sgqlc.types.Type, Node): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ( "actor", "after_commit", "before_commit", "created_at", "pull_request", "ref", ) actor = sgqlc.types.Field(Actor, graphq...
HeadRefForcePushedEvent
python
jmcnamara__XlsxWriter
xlsxwriter/test/worksheet/test_write_sheet_views5.py
{ "start": 301, "end": 3686 }
class ____(unittest.TestCase): """ Test the Worksheet _write_sheet_views() method. """ def setUp(self): self.fh = StringIO() self.worksheet = Worksheet() self.worksheet._set_filehandle(self.fh) def test_write_sheet_views1(self): """Test the _write_sheet_views() met...
TestWriteSheetViews
python
pandas-dev__pandas
asv_bench/benchmarks/series_methods.py
{ "start": 1731, "end": 2982 }
class ____: params = [ [ "datetime64[ns]", "float32", "float64", "Float64", "Int64", "int64[pyarrow]", "string", "string[pyarrow]", ], ] param_names = ["dtype"] def setup(self, dtype): ...
Fillna
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_chart_format30.py
{ "start": 315, "end": 1786 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("chart_format30.xlsx") def test_create_file(self): """Test the creation of an XlsxWriter file with chart formatting.""" workbook = ...
TestCompareXLSXFiles
python
great-expectations__great_expectations
contrib/experimental/great_expectations_experimental/expectations/expect_queried_column_values_to_exist_in_second_table_column.py
{ "start": 272, "end": 4457 }
class ____(QueryExpectation): """Expect all values in a specific column to exist in another table's column. Args: template_dict: dict containing the following keys: \ first_table_column (name of the main table column), \ second_table_column (name of the column to compare to in...
ExpectQueriedColumnValuesToExistInSecondTableColumn
python
doocs__leetcode
solution/0600-0699/0677.Map Sum Pairs/Solution.py
{ "start": 629, "end": 1079 }
class ____: def __init__(self): self.d = defaultdict(int) self.tree = Trie() def insert(self, key: str, val: int) -> None: x = val - self.d[key] self.d[key] = val self.tree.insert(key, x) def sum(self, prefix: str) -> int: return self.tree.search(prefix) #...
MapSum
python
dagster-io__dagster
python_modules/dagster/dagster_tests/execution_tests/misc_execution_tests/test_custom_reconstructable.py
{ "start": 162, "end": 2884 }
class ____: def __init__(self, prefix: str): self.prefix = prefix def make_job(self, has_nested_scope_solid: bool, name: str) -> dg.JobDefinition: @dg.op def nested_scope_op(_context): pass @dg.job(name=self.prefix + name) def _job(): if has_nest...
JobFactory
python
getsentry__sentry
src/sentry/releases/migrations/0004_cleanup_failed_safe_deletes.py
{ "start": 207, "end": 1900 }
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
apache__avro
lang/py/avro/test/test_protocol.py
{ "start": 15919, "end": 17237 }
class ____(unittest.TestCase): """Enable generating round-trip parse test cases over all the valid test protocols.""" def __init__(self, test_proto): """Ignore the normal signature for unittest.TestCase because we are generating many test cases from this one class. This is safe as long as the a...
RoundTripParseTestCase
python
kamyu104__LeetCode-Solutions
Python/best-time-to-buy-and-sell-stock.py
{ "start": 29, "end": 360 }
class ____(object): # @param prices, a list of integer # @return an integer def maxProfit(self, prices): max_profit, min_price = 0, float("inf") for price in prices: min_price = min(min_price, price) max_profit = max(max_profit, price - min_price) return max_p...
Solution
python
kamyu104__LeetCode-Solutions
Python/maximum-sum-score-of-array.py
{ "start": 48, "end": 517 }
class ____(object): def maximumSumScore(self, nums): """ :type nums: List[int] :rtype: int """ prefix = suffix = 0 result = float("-inf") right = len(nums)-1 for left in xrange(len(nums)): prefix += nums[left] suffix += nums[rig...
Solution
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/protocol3.py
{ "start": 4942, "end": 5014 }
class ____: prop1: Final[int] = 0 @dataclass(frozen=True)
Concrete15_4
python
spack__spack
lib/spack/spack/vendor/jinja2/compiler.py
{ "start": 4497, "end": 4729 }
class ____: def __init__(self, node: t.Union[nodes.Macro, nodes.CallBlock]) -> None: self.node = node self.accesses_caller = False self.accesses_kwargs = False self.accesses_varargs = False
MacroRef
python
pytorch__pytorch
test/test_varlen_attention.py
{ "start": 4836, "end": 19564 }
class ____(NNTestCase): @skipIfRocm(msg="ROCM does not support variable length attention") @unittest.skipIf( not PLATFORM_SUPPORTS_FLASH_ATTENTION, "Flash Attention not supported" ) @parametrize("dtype", [torch.bfloat16, torch.float16]) def test_basic_functionality(self, device, dtype): ...
TestVarlenAttention
python
Textualize__textual
tests/option_list/test_option_list_create.py
{ "start": 289, "end": 6381 }
class ____(App[None]): """Test option list application.""" def compose(self) -> ComposeResult: yield OptionList( "0", Option("1"), None, Option("2", disabled=True), None, Option("3", id="3"), Option("4", id="4", disable...
OptionListApp
python
sympy__sympy
sympy/holonomic/recurrence.py
{ "start": 2884, "end": 9036 }
class ____: """ The Recurrence Operators are defined by a list of polynomials in the base ring and the parent ring of the Operator. Explanation =========== Takes a list of polynomials for each power of Sn and the parent ring which must be an instance of RecurrenceOperatorAlgebra. A Re...
RecurrenceOperator
python
vyperlang__vyper
vyper/venom/basicblock.py
{ "start": 5447, "end": 5902 }
class ____(IROperand): """ IRVariable represents a variable in IR. A variable is a string that starts with a %. """ _name: str def __init__(self, name: str) -> None: assert isinstance(name, str) # name = name.removeprefix("%") if not name.startswith("%"): name =...
IRVariable
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/metadata.py
{ "start": 1924, "end": 2123 }
class ____(graphene.ObjectType): text = graphene.NonNull(graphene.String) class Meta: interfaces = (GrapheneMetadataEntry,) name = "TextMetadataEntry"
GrapheneTextMetadataEntry
python
kamyu104__LeetCode-Solutions
Python/construct-binary-tree-from-inorder-and-postorder-traversal.py
{ "start": 153, "end": 982 }
class ____(object): # @param inorder, a list of integers # @param postorder, a list of integers # @return a tree node def buildTree(self, inorder, postorder): lookup = {} for i, num in enumerate(inorder): lookup[num] = i return self.buildTreeRecu(lookup, postorder, in...
Solution
python
great-expectations__great_expectations
great_expectations/checkpoint/checkpoint.py
{ "start": 20640, "end": 20814 }
class ____(TypedDict): evaluated_validations: int success_percent: float successful_validations: int unsuccessful_validations: int
CheckpointDescriptionStatistics
python
getsentry__sentry
src/sentry/integrations/pagerduty/handlers/pagerduty_handler.py
{ "start": 812, "end": 1808 }
class ____(IntegrationActionHandler): group = ActionHandler.Group.NOTIFICATION provider_slug = IntegrationProviderSlug.PAGERDUTY config_schema = ONCALL_ACTION_CONFIG_SCHEMA data_schema = { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties":...
PagerdutyActionHandler
python
ray-project__ray
python/ray/util/collective/tests/cpu_util.py
{ "start": 214, "end": 4477 }
class ____: def __init__(self): self.buffer = None self.list_buffer = None def init_tensors(self): self.buffer = np.ones((10,), dtype=np.float32) self.list_buffer = [np.ones((10,), dtype=np.float32) for _ in range(2)] return True def init_group(self, world_size, ran...
Worker
python
pydantic__pydantic
tests/mypy/outputs/mypy-plugin-strict_ini/plugin_fail.py
{ "start": 2599, "end": 2744 }
class ____(BaseModel, from_attributes=list): # MYPY: error: Invalid value for "Config.from_attributes" [pydantic-config] pass
KwargsBadConfig2
python
sympy__sympy
sympy/physics/quantum/hilbert.py
{ "start": 5337, "end": 6725 }
class ____(HilbertSpace): """The Hilbert space of square integrable functions on an interval. An L2 object takes in a single SymPy Interval argument which represents the interval its functions (vectors) are defined on. Examples ======== >>> from sympy import Interval, oo >>> from sympy.ph...
L2
python
google__jax
jax/_src/state/types.py
{ "start": 2048, "end": 2099 }
class ____(RefEffect): name: str = "Read"
ReadEffect
python
apache__airflow
providers/google/tests/unit/google/cloud/triggers/test_vertex_ai.py
{ "start": 9017, "end": 11624 }
class ____: def setup_method(self): self.trigger = CreateHyperparameterTuningJobTrigger( conn_id=TEST_CONN_ID, project_id=TEST_PROJECT_ID, location=TEST_LOCATION, job_id=TEST_HPT_JOB_ID, poll_interval=TEST_POLL_INTERVAL, impersonation_c...
TestCreateHyperparameterTuningJobTrigger
python
apache__airflow
airflow-ctl/src/airflowctl/api/datamodels/generated.py
{ "start": 32714, "end": 33703 }
class ____(BaseModel): """ Asset event serializer for responses. """ id: Annotated[int, Field(title="Id")] asset_id: Annotated[int, Field(title="Asset Id")] uri: Annotated[str | None, Field(title="Uri")] = None name: Annotated[str | None, Field(title="Name")] = None group: Annotated[str...
AssetEventResponse
python
sphinx-doc__sphinx
tests/roots/test-inheritance/dummy/test.py
{ "start": 205, "end": 231 }
class ____(B, C): pass
D
python
ray-project__ray
python/ray/autoscaler/v2/instance_manager/subscribers/threaded_ray_installer.py
{ "start": 708, "end": 3307 }
class ____(InstanceUpdatedSubscriber): """ThreadedRayInstaller is responsible for install ray on new nodes.""" def __init__( self, head_node_ip: str, instance_storage: InstanceStorage, ray_installer: RayInstaller, error_queue: Queue, max_install_attempts: int = 3...
ThreadedRayInstaller
python
great-expectations__great_expectations
great_expectations/expectations/core/expect_column_values_to_be_in_type_list.py
{ "start": 2926, "end": 27743 }
class ____(ColumnMapExpectation): __doc__ = f"""{EXPECTATION_SHORT_DESCRIPTION} ExpectColumnValuesToBeInTypeList is a \ Column Map Expectation \ for typed-column backends, and also for Pandas Datasources where the column dtype provides an \ unambiguous constraints (any dtype except 'object'). ...
ExpectColumnValuesToBeInTypeList
python
pyparsing__pyparsing
examples/adventureEngine.py
{ "start": 5097, "end": 5740 }
class ____(Command): def __init__(self, quals): super().__init__("TAKE", "taking") self.subject = quals.item @staticmethod def help_description(): return "TAKE or PICKUP or PICK UP - pick up an object (but some are deadly)" def _do_command(self, player): rm = player.roo...
TakeCommand
python
tensorflow__tensorflow
tensorflow/python/keras/engine/base_layer_utils.py
{ "start": 16303, "end": 18885 }
class ____(object): """Keeps track of properties currently inside a Layer/Model's `call`. Attributes: in_call: Whether currently inside the `call` of a Layer. layer: The `Layer` whose `call` is currently active. inputs: The inputs to the currently active `Layer`. build_graph: Whether currently insi...
CallContext
python
python__mypy
mypy/errors.py
{ "start": 7957, "end": 10456 }
class ____: """An `IterationDependentErrors` instance serves to collect the `unreachable`, `redundant-expr`, and `redundant-casts` errors, as well as the revealed types, handled by the individual `IterationErrorWatcher` instances sequentially applied to the same code section.""" # One set of `unrea...
IterationDependentErrors
python
airbytehq__airbyte
airbyte-integrations/connectors/source-iterable/source_iterable/streams.py
{ "start": 18280, "end": 18369 }
class ____(IterableExportEventsStreamAdjustableRange): data_field = "smsClick"
SmsClick
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/pyflakes/F821_17.py
{ "start": 839, "end": 1164 }
class ____: ... # Type parameters do not escape function scopes from some_library import some_decorator @some_decorator(T) # F821: Undefined name `T` - not accessible in decorators def foo[T](t: T) -> None: ... T # F821: Undefined name `T` - not accessible afterward function scope # Type parameters in classes ...
ForwardB
python
bokeh__bokeh
src/bokeh/models/tools.py
{ "start": 66464, "end": 69318 }
class ____(EditTool, Drag, Tap): ''' *toolbar icon*: |box_edit_icon| Allows drawing, dragging and deleting box-like glyphs (e.g. ``Block``, ``Rect``, ``HStrip``) on one or more renderers by editing the underlying ``ColumnDataSource`` data. Like other drawing tools, the renderers that are to be edit...
BoxEditTool
python
spyder-ide__spyder
external-deps/spyder-remote-services/spyder_remote_services/services/files/compression.py
{ "start": 281, "end": 571 }
class ____(enum.Enum): ZIP_64 = enum.auto() ZIP_32 = enum.auto() NO_COMPRESSION_BUFFERED_32 = enum.auto() NO_COMPRESSION_BUFFERED_64 = enum.auto() NO_COMPRESSION_STREAMED_32 = enum.auto() NO_COMPRESSION_STREAMED_64 = enum.auto() @dataclass(frozen=True)
CompressionType
python
scipy__scipy
scipy/stats/_discrete_distns.py
{ "start": 63174, "end": 66095 }
class ____(_nchypergeom_gen): r"""A Wallenius' noncentral hypergeometric discrete random variable. Wallenius' noncentral hypergeometric distribution models drawing objects of two types from a bin. `M` is the total number of objects, `n` is the number of Type I objects, and `odds` is the odds ratio: the...
nchypergeom_wallenius_gen
python
pytest-dev__pytest
doc/en/example/assertion/failure_demo.py
{ "start": 331, "end": 646 }
class ____: def test_simple(self): def f(): return 42 def g(): return 43 assert f() == g() def test_simple_multiline(self): otherfunc_multi(42, 6 * 9) def test_not(self): def f(): return 42 assert not f()
TestFailing
python
pypa__pipenv
pipenv/vendor/tomlkit/parser.py
{ "start": 2449, "end": 38523 }
class ____: """ Parser for TOML documents. """ def __init__(self, string: str | bytes) -> None: # Input to parse self._src = Source(decode(string)) self._aot_stack: list[Key] = [] @property def _state(self): return self._src.state @property def _idx(se...
Parser
python
gevent__gevent
src/greentest/3.14/test_urllib2.py
{ "start": 1021, "end": 2752 }
class ____(unittest.TestCase): def test___all__(self): # Verify which names are exposed for module in 'request', 'response', 'parse', 'error', 'robotparser': context = {} exec('from urllib.%s import *' % module, context) del context['__builtins__'] fo...
TrivialTests
python
tox-dev__tox
src/tox/tox_env/python/pip/req/args.py
{ "start": 3322, "end": 3801 }
class ____(Action): def __call__( self, parser: ArgumentParser, # noqa: ARG002 namespace: Namespace, values: str | Sequence[Any] | None, option_string: str | None = None, # noqa: ARG002 ) -> None: if getattr(namespace, self.dest, None) is None: setat...
AddUniqueAction
python
PyCQA__pylint
tests/functional/i/invalid/invalid_length/invalid_length_hint_returned.py
{ "start": 600, "end": 676 }
class ____: """LengthHintgth through the metaclass."""
ThirdGoodLengthHint
python
huggingface__transformers
src/transformers/cache_utils.py
{ "start": 9539, "end": 14942 }
class ____(CacheLayerMixin): """ A static cache layer that stores the key and value states as static tensors of shape `[batch_size, num_heads, max_cache_len), head_dim]`. It lazily allocates its full backing tensors, and then mutates them in-place. Built for `torch.compile` support. Args: max_c...
StaticLayer
python
apache__airflow
providers/amazon/src/airflow/providers/amazon/aws/sensors/emr.py
{ "start": 15663, "end": 20421 }
class ____(EmrBaseSensor): """ Poll the EMR JobFlow Cluster until it reaches any of the target states; raise AirflowException on failure. With the default target states, sensor waits cluster to be terminated. When target_states is set to ['RUNNING', 'WAITING'] sensor waits until job flow to be read...
EmrJobFlowSensor
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 260865, "end": 261460 }
class ____(sgqlc.types.Input): """A collaborator to update on a project. Only one of the userId or teamId should be provided. """ __schema__ = github_schema __field_names__ = ("user_id", "team_id", "role") user_id = sgqlc.types.Field(ID, graphql_name="userId") """The ID of the user as a col...
ProjectV2Collaborator
python
pandas-dev__pandas
pandas/core/indexes/extension.py
{ "start": 4927, "end": 5365 }
class ____(ExtensionIndex): """ Index subclass for indexes backed by NDArrayBackedExtensionArray. """ _data: NDArrayBackedExtensionArray def _get_engine_target(self) -> np.ndarray: return self._data._ndarray def _from_join_target(self, result: np.ndarray) -> ArrayLike: assert ...
NDArrayBackedExtensionIndex
python
astropy__astropy
astropy/time/core.py
{ "start": 14422, "end": 16481 }
class ____(TimeInfoBase): """ Container for meta information like name, description, format. This is required when the object is used as a mixin column within a table, but can be used as a general way to store meta information. """ _represent_as_dict_extra_attrs = ("format", "scale") def ...
TimeDeltaInfo
python
getsentry__sentry
src/sentry/sentry_apps/logic.py
{ "start": 4035, "end": 15421 }
class ____: sentry_app: SentryApp name: str | None = None author: str | None = None status: str | None = None scopes: list[str] | None = None events: list[str] | None = None webhook_url: str | None = None redirect_url: str | None = None is_alertable: bool | None = None verify_ins...
SentryAppUpdater
python
chardet__chardet
chardet/metadata/languages.py
{ "start": 320, "end": 12470 }
class ____: """Metadata about a language useful for training models :ivar name: The human name for the language, in English. :type name: str :ivar iso_code: 2-letter ISO 639-1 if possible, 3-letter ISO code otherwise, or use another catalog as a last resort. :type iso_code: str ...
Language
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/typedDictClosed3.py
{ "start": 1625, "end": 1691 }
class ____(ParentClosed4): b: ReadOnly[int | str]
ChildClosed4_5
python
huggingface__transformers
src/transformers/models/vit_mae/modeling_vit_mae.py
{ "start": 11729, "end": 14637 }
class ____(nn.Module): """ This class turns `pixel_values` of shape `(batch_size, num_channels, height, width)` into the initial `hidden_states` (patch embeddings) of shape `(batch_size, seq_length, hidden_size)` to be consumed by a Transformer. """ def __init__(self, config): super()._...
ViTMAEPatchEmbeddings
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 302547, "end": 303043 }
class ____(sgqlc.types.Input): """Ordering options for sponsorship newsletter connections.""" __schema__ = github_schema __field_names__ = ("field", "direction") field = sgqlc.types.Field(sgqlc.types.non_null(SponsorshipNewsletterOrderField), graphql_name="field") """The field to order sponsorship ...
SponsorshipNewsletterOrder
python
astropy__astropy
astropy/samp/tests/web_profile_test_helpers.py
{ "start": 373, "end": 739 }
class ____(WebProfileDialog): def __init__(self): self.polling = True WebProfileDialog.__init__(self) def show_dialog(self, *args): self.consent() def poll(self): while self.polling: self.handle_queue() time.sleep(0.1) def stop(self): se...
AlwaysApproveWebProfileDialog
python
wandb__wandb
wandb/util.py
{ "start": 25571, "end": 25995 }
class ____(json.JSONEncoder): """A JSON Encoder that handles some extra types. This encoder turns numpy like objects with a size > 32 into histograms. """ def default(self, obj: Any) -> Any: obj, converted = json_friendly(obj) obj, compressed = maybe_compress_history(obj) if co...
WandBHistoryJSONEncoder
python
huggingface__transformers
tests/models/aya_vision/test_modeling_aya_vision.py
{ "start": 7104, "end": 19831 }
class ____(unittest.TestCase): @classmethod def setUpClass(cls): cls.model_checkpoint = "CohereForAI/aya-vision-8b" cls.model = None @classmethod def tearDownClass(cls): del cls.model cleanup(torch_device, gc_collect=True) def tearDown(self): cleanup(torch_d...
AyaVisionIntegrationTest
python
pandas-dev__pandas
pandas/tests/indexes/datetimes/test_date_range.py
{ "start": 64465, "end": 66065 }
class ____: def test_date_range_unit_inference_matching_unit(self, unit): start = Timestamp("2025-11-25").as_unit(unit) end = Timestamp("2025-11-26").as_unit(unit) dti = date_range(start, end, freq="D") assert dti.unit == unit def test_date_range_unit_inference_mismatched_unit(...
TestDateRangeUnitInference
python
sympy__sympy
sympy/physics/quantum/tests/test_commutator.py
{ "start": 2034, "end": 2727 }
class ____(Operator): def _eval_commutator_Foo(self, foo): return Integer(1) def test_eval_commutator(): F = Foo('F') B = Bar('B') T = Tam('T') assert Comm(F, B).doit() == 0 assert Comm(B, F).doit() == 0 assert Comm(F, T).doit() == -1 assert Comm(T, F).doit() == 1 assert C...
Tam
python
walkccc__LeetCode
solutions/1150. Check If a Number Is Majority Element in a Sorted Array/1150.py
{ "start": 0, "end": 201 }
class ____: def isMajorityElement(self, nums: list[int], target: int) -> bool: n = len(nums) i = bisect.bisect_left(nums, target) return i + n // 2 < n and nums[i + n // 2] == target
Solution
python
apache__airflow
airflow-core/src/airflow/models/crypto.py
{ "start": 1365, "end": 2128 }
class ____: """ A "Null" encryptor class that doesn't encrypt or decrypt but that presents a similar interface to Fernet. The purpose of this is to make the rest of the code not have to know the difference, and to only display the message once, not 20 times when `airflow db migrate` is run. """...
_NullFernet
python
kamyu104__LeetCode-Solutions
Python/reverse-vowels-of-a-string.py
{ "start": 29, "end": 550 }
class ____(object): def reverseVowels(self, s): """ :type s: str :rtype: str """ vowels = "aeiou" string = list(s) i, j = 0, len(s) - 1 while i < j: if string[i].lower() not in vowels: i += 1 elif string[j].lower...
Solution
python
tensorflow__tensorflow
tensorflow/python/trackable/data_structures_test.py
{ "start": 1536, "end": 5057 }
class ____(test.TestCase): def testJSONSerialization(self): obj = autotrackable.AutoTrackable() obj.l = [1] json.dumps(obj.l, default=serialization.get_json_type) def testNotTrackable(self): class NotTrackable(object): pass with self.assertRaises(ValueError): data_structures.List(...
ListTests
python
getsentry__sentry
src/sentry/grouping/enhancer/matchers.py
{ "start": 10861, "end": 10920 }
class ____(PathLikeMatch): field = "package"
PackageMatch
python
huggingface__transformers
src/transformers/models/depth_anything/configuration_depth_anything.py
{ "start": 924, "end": 7505 }
class ____(PreTrainedConfig): r""" This is the configuration class to store the configuration of a [`DepthAnythingModel`]. It is used to instantiate a DepthAnything model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a s...
DepthAnythingConfig
python
huggingface__transformers
src/transformers/models/sam2_video/configuration_sam2_video.py
{ "start": 3388, "end": 6705 }
class ____(PreTrainedConfig): r""" This is the configuration class to store the configuration of a [`Sam2VideoMaskDecoder`]. It is used to instantiate a SAM2_VIDEO memory encoder according to the specified arguments, defining the model architecture. Configuration objects inherit from [`PreTrainedConfig...
Sam2VideoMaskDecoderConfig
python
doocs__leetcode
lcof2/剑指 Offer II 069. 山峰数组的顶部/Solution.py
{ "start": 0, "end": 320 }
class ____: def peakIndexInMountainArray(self, arr: List[int]) -> int: left, right = 1, len(arr) - 2 while left < right: mid = (left + right) >> 1 if arr[mid] > arr[mid + 1]: right = mid else: left = mid + 1 return left
Solution
python
pennersr__django-allauth
allauth/socialaccount/providers/base/constants.py
{ "start": 91, "end": 211 }
class ____: AUTHENTICATE = "authenticate" REAUTHENTICATE = "reauthenticate" REREQUEST = "rerequest"
AuthAction
python
fluentpython__example-code
21-class-metaprog/bulkfood/model_v7.py
{ "start": 1290, "end": 1694 }
class ____(type): """Metaclass for business entities with validated fields""" def __init__(cls, name, bases, attr_dict): super().__init__(name, bases, attr_dict) # <1> for key, attr in attr_dict.items(): # <2> if isinstance(attr, Validated): type_name = type(attr)....
EntityMeta
python
getsentry__sentry
tests/sentry/monitors/endpoints/test_organization_detector_index.py
{ "start": 3376, "end": 8110 }
class ____(APITestCase): endpoint = "sentry-api-0-organization-detector-index" method = "post" def setUp(self): super().setUp() self.login_as(user=self.user) def _get_detector_post_data(self, **overrides): data = { "projectId": self.project.id, "type": M...
OrganizationDetectorIndexPostTest
python
pytorch__pytorch
torch/_dynamo/replay_record.py
{ "start": 1955, "end": 4389 }
class ____: LOCAL_MOD_PREFIX = "___local_mod_" code: CodeType closure: tuple[CellType] globals: dict[str, Any] = field(default_factory=dict) locals: dict[str, Any] = field(default_factory=dict) builtins: dict[str, Any] = field(default_factory=dict) code_options: dict[str, Any] = field(defau...
ExecutionRecorder
python
ray-project__ray
python/ray/autoscaler/command_runner.py
{ "start": 115, "end": 3464 }
class ____: """Interface to run commands on a remote cluster node. **Important**: This is an INTERNAL API that is only exposed for the purpose of implementing custom node providers. It is not allowed to call into CommandRunner methods from any Ray package outside the autoscaler, only to define new ...
CommandRunnerInterface
python
streamlit__streamlit
lib/streamlit/vendor/pympler/asizeof.py
{ "start": 28216, "end": 29127 }
class ____(object): """Store referred object along with the name of the referent. """ __slots__ = ("name", "ref") def __init__(self, name, ref): self.name = name self.ref = ref # class _Slots(tuple): # '''Wrapper class for __slots__ attribute at class definition. # The...
_NamedRef
python
dagster-io__dagster
.buildkite/buildkite-shared/buildkite_shared/step_builders/command_step_builder.py
{ "start": 2181, "end": 20320 }
class ____: _step: CommandStepConfiguration def __init__( self, label, key: Optional[str] = None, timeout_in_minutes: int = DEFAULT_TIMEOUT_IN_MIN, retry_automatically: bool = True, plugins: Optional[list[dict[str, object]]] = None, ): self._secrets =...
CommandStepBuilder
python
pytorch__pytorch
tools/experimental/torchfuzz/operators/nn_functional.py
{ "start": 3735, "end": 7431 }
class ____(Operator): """Operator for torch.nn.functional.linear.""" def __init__(self): super().__init__("torch.nn.functional.linear") @property def torch_op_name(self) -> str | None: """Return the torch operation name.""" return "torch.nn.functional.linear" def can_produ...
LinearOperator