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
Lightning-AI__lightning
tests/tests_pytorch/checkpointing/test_model_checkpoint.py
{ "start": 41440, "end": 41673 }
class ____(Callback): def on_validation_epoch_start(self, trainer, pl_module): if not trainer.sanity_checking and trainer.current_epoch == 1: raise RuntimeError("Trouble!")
TroubledCallbackOnValidationEpochStart
python
mahmoud__glom
glom/test/test_target_types.py
{ "start": 238, "end": 7621 }
class ____(E): pass def test_types_leave_one_out(): ALL_TYPES = [A, B, C, D, E, F] for cur_t in ALL_TYPES: treg = TargetRegistry(register_default_types=False) treg.register(object, get=lambda: object) for t in ALL_TYPES: if t is cur_t: continue ...
F
python
openai__openai-python
tests/api_resources/test_moderations.py
{ "start": 2059, "end": 3916 }
class ____: parametrize = pytest.mark.parametrize( "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) @parametrize async def test_method_create(self, async_client: AsyncOpenAI) -> None: moderation = await async_client.moderatio...
TestAsyncModerations
python
apache__airflow
providers/amazon/src/airflow/providers/amazon/aws/sensors/redshift_cluster.py
{ "start": 1474, "end": 4609 }
class ____(AwsBaseSensor[RedshiftHook]): """ Waits for a Redshift cluster to reach a specific status. .. seealso:: For more information on how to use this sensor, take a look at the guide: :ref:`howto/sensor:RedshiftClusterSensor` :param cluster_identifier: The identifier for the clust...
RedshiftClusterSensor
python
walkccc__LeetCode
solutions/501. Find Mode in Binary Search Tree/501.py
{ "start": 0, "end": 715 }
class ____: def findMode(self, root: TreeNode | None) -> list[int]: self.ans = [] self.pred = None self.count = 0 self.maxCount = 0 def updateCount(root: TreeNode | None) -> None: if self.pred and self.pred.val == root.val: self.count += 1 else: self.count = 1 i...
Solution
python
huggingface__transformers
tests/models/bark/test_modeling_bark.py
{ "start": 6848, "end": 11960 }
class ____: def __init__( self, parent, batch_size=3, # need batch_size != num_hidden_layers seq_length=4, is_training=False, # for now training is not supported use_input_mask=True, use_labels=True, vocab_size=33, output_vocab_size=33, ...
BarkCoarseModelTester
python
walkccc__LeetCode
solutions/133. Clone Graph/133-2.py
{ "start": 0, "end": 349 }
class ____: def cloneGraph(self, node: 'Node') -> 'Node': if not node: return None if node in self.map: return self.map[node] newNode = Node(node.val, []) self.map[node] = newNode for neighbor in node.neighbors: self.map[node].neighbors.append(self.cloneGraph(neighbor)) re...
Solution
python
sphinx-doc__sphinx
sphinx/domains/cpp/__init__.py
{ "start": 17861, "end": 17922 }
class ____(CPPObject): object_type = 'union'
CPPUnionObject
python
huggingface__transformers
tests/models/mvp/test_modeling_mvp.py
{ "start": 15694, "end": 21146 }
class ____(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = ( (MvpModel, MvpForConditionalGeneration, MvpForSequenceClassification, MvpForQuestionAnswering) if is_torch_available() else () ) pipeline_model_mapping = ( { ...
MvpModelTest
python
huggingface__transformers
src/transformers/models/mistral3/modular_mistral3.py
{ "start": 1180, "end": 1230 }
class ____(MistralRMSNorm): pass
Mistral3RMSNorm
python
tensorflow__tensorflow
tensorflow/python/ops/template.py
{ "start": 23762, "end": 31941 }
class ____(Template): """Wrap a function to aid in variable sharing in Eager mode. Templates are functions that create variables the first time they are called and reuse them thereafter. See `make_template` for full documentation. Note: By default, the full variable scope is captured at the time of first ca...
EagerTemplate
python
kamyu104__LeetCode-Solutions
Python/check-if-matrix-is-x-matrix.py
{ "start": 39, "end": 309 }
class ____(object): def checkXMatrix(self, grid): """ :type grid: List[List[int]] :rtype: bool """ return all((i-j == 0 or i+j == len(grid)-1) == (grid[i][j] != 0) for i in xrange(len(grid)) for j in xrange(len(grid[0])))
Solution
python
django__django
django/db/migrations/operations/fields.py
{ "start": 9603, "end": 12787 }
class ____(FieldOperation): """Rename a field on the model. Might affect db_column too.""" category = OperationCategory.ALTERATION def __init__(self, model_name, old_name, new_name): self.old_name = old_name self.new_name = new_name super().__init__(model_name, old_name) @cach...
RenameField
python
PrefectHQ__prefect
src/prefect/server/schemas/filters.py
{ "start": 26892, "end": 27804 }
class ____(PrefectOperatorFilterBaseModel): """Filter by `TaskRun.flow_run_id`.""" any_: Optional[list[UUID]] = Field( default=None, description="A list of task run flow run ids to include" ) is_null_: Optional[bool] = Field( default=False, description="Filter for task runs with None a...
TaskRunFilterFlowRunId
python
getsentry__sentry
src/sentry/replays/lib/new_query/fields.py
{ "start": 6822, "end": 7039 }
class ____(ColumnField[int]): @property def expression(self) -> Function: return Function( "sum", parameters=[Function("length", parameters=[Column(self.column_name)])] )
SumLengthField
python
keras-team__keras
guides/making_new_layers_and_models_via_subclassing.py
{ "start": 7126, "end": 7334 }
class ____(keras.layers.Layer): ... def call(self, inputs): return tf.matmul(inputs, self.w) + self.b ``` And this would be the equivalent PyTorch-specific layer: ```python import torch
Linear
python
allegroai__clearml
clearml/utilities/plotlympl/renderer.py
{ "start": 708, "end": 32427 }
class ____(Renderer): """A renderer class inheriting from base for rendering mpl plots in plotly. A renderer class to be used with an exporter for rendering matplotlib plots in Plotly. This module defines the PlotlyRenderer class which handles the creation of the JSON structures that get sent to plotly...
PlotlyRenderer
python
PyCQA__pylint
tests/functional/n/not_callable.py
{ "start": 253, "end": 295 }
class ____: """callable object"""
Correct
python
django__django
tests/i18n/test_compilation.py
{ "start": 13712, "end": 13995 }
class ____(ProjectAndAppTests): def test_app_locale_compiled(self): call_command("compilemessages", locale=[self.LOCALE], verbosity=0) self.assertTrue(os.path.exists(self.PROJECT_MO_FILE)) self.assertTrue(os.path.exists(self.APP_MO_FILE))
AppCompilationTest
python
openai__openai-python
src/openai/types/beta/chatkit/chatkit_thread.py
{ "start": 1058, "end": 1683 }
class ____(BaseModel): id: str """Identifier of the thread.""" created_at: int """Unix timestamp (in seconds) for when the thread was created.""" object: Literal["chatkit.thread"] """Type discriminator that is always `chatkit.thread`.""" status: Status """Current status for the thread...
ChatKitThread
python
redis__redis-py
tests/test_asyncio/test_connection_pool.py
{ "start": 28504, "end": 36959 }
class ____: interval = 60 @pytest_asyncio.fixture() async def r(self, create_redis): redis = await create_redis(health_check_interval=self.interval) yield redis await redis.flushall() def assert_interval_advanced(self, connection): diff = connection.next_health_check - ...
TestHealthCheck
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/operators/vision.py
{ "start": 56728, "end": 60451 }
class ____(GoogleCloudBaseOperator): """ Detect Document Text in the image. .. seealso:: For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:CloudVisionTextDetectOperator` :param image: (Required) The image to analyze. See more: http...
CloudVisionTextDetectOperator
python
django-import-export__django-import-export
import_export/mixins.py
{ "start": 10241, "end": 11550 }
class ____(ExportViewMixin, FormView): # Deprecated, and will be removed in a future release (see #1666) def __init_subclass__(cls, **kwargs): super().__init_subclass__(**kwargs) warn( "ExportViewFormMixin is deprecated and will be removed " "in a future release.", ...
ExportViewFormMixin
python
sympy__sympy
sympy/codegen/ast.py
{ "start": 56396, "end": 57412 }
class ____(FunctionCall): """ Represents a call to a function with keyword arguments in the code. Parameters ========== name : str function_args : Tuple keyword_args : dict Dictionary mapping parameter names to their values Examples ======== >>> from sympy.codegen.ast imp...
KeywordFunctionCall
python
pytorch__pytorch
test/dynamo/cpython/3_13/test_with.py
{ "start": 22856, "end": 24892 }
class ____(__TestCase): def testSingleComplexTarget(self): targets = {1: [0, 1, 2]} with mock_contextmanager_generator() as targets[1][0]: self.assertEqual(list(targets.keys()), [1]) self.assertEqual(targets[1][0].__class__, MockResource) with mock_contextmanager_gen...
AssignmentTargetTestCase
python
scipy__scipy
scipy/optimize/tests/test_linprog.py
{ "start": 70451, "end": 80060 }
class ____(LinprogCommonTests): def test_callback(self): # this is the problem from test_callback def cb(res): return None c = np.array([-3, -2]) A_ub = [[2, 1], [1, 1], [1, 0]] b_ub = [10, 8, 4] assert_raises(NotImplementedError, linprog, c, A_ub=A_ub, b_...
LinprogHiGHSTests
python
PrefectHQ__prefect
tests/cli/test_block.py
{ "start": 511, "end": 638 }
class ____(Block): message: str """ TEST_BLOCK_CODE_BAD_SYNTAX = """\ from prefect.blocks.core import Bloc
TestForFileRegister
python
walkccc__LeetCode
solutions/871. Minimum Number of Refueling Stops/871.py
{ "start": 0, "end": 498 }
class ____: def minRefuelStops( self, target: int, startFuel: int, stations: list[list[int]], ) -> int: # dp[i] := the farthest position we can reach w / i refuels dp = [startFuel] + [0] * len(stations) for i, station in enumerate(stations): for j in range(i + 1, 0, -1): ...
Solution
python
pytorch__pytorch
test/inductor/extension_backends/triton/extension_codegen_backend.py
{ "start": 991, "end": 1392 }
class ____(DeviceOpOverrides): def import_get_raw_stream_as(self, name: str) -> str: return f"def {name}(name): None\n" def set_device(self, device_idx: int) -> str: # noqa: ARG002 unused-argument return "" def synchronize(self) -> None: pass def device_guard(self, device_idx...
CPUDeviceOpOverrides
python
django__django
tests/admin_views/models.py
{ "start": 27279, "end": 27371 }
class ____(models.Model): references = GenericRelation(ReferencedByGenRel)
GenRelReference
python
dagster-io__dagster
python_modules/libraries/dagster-airflow/dagster_airflow/resources/airflow_ephemeral_db.py
{ "start": 572, "end": 3878 }
class ____(AirflowDatabase): """A ephemeral Airflow database Dagster resource.""" def __init__( self, airflow_home_path: str, dagster_run: DagsterRun, dag_run_config: Optional[dict] = None ): self.airflow_home_path = airflow_home_path super().__init__(dagster_run=dagster_run, dag_ru...
AirflowEphemeralDatabase
python
numba__numba
numba/tests/test_repr.py
{ "start": 445, "end": 1656 }
class ____(TestCase): def setUp(self) -> None: tys_ns = {ty.__name__: ty for ty in NB_TYPES if hasattr(ty, "__name__")} tys_ns.update({ty.name: ty for ty in NB_TYPES if hasattr(ty, "name")}) self.tys_ns = tys_ns def check_repr(self, val): ty = typeof(val) ty2 = eval(repr...
TestRepr
python
getsentry__sentry
src/sentry/models/groupshare.py
{ "start": 411, "end": 1082 }
class ____(Model): """ A Group that was shared publicly. """ __relocation_scope__ = RelocationScope.Excluded project = FlexibleForeignKey("sentry.Project") group = FlexibleForeignKey("sentry.Group", unique=True) uuid = models.CharField(max_length=32, unique=True, default=default_uuid) ...
GroupShare
python
tensorflow__tensorflow
tensorflow/compiler/tests/repeat_op_test.py
{ "start": 972, "end": 1760 }
class ____(xla_test.XLATestCase): def test(self): # Verifies that bounded dynamic result generated from the Where op can be # Reshaped correctly. @def_function.function(jit_compile=True) def repeat(values, repeats, axis): return array_ops.repeat(values, repeats, axis) with self.session() ...
RepeatTest
python
pytorch__pytorch
torch/_inductor/utils.py
{ "start": 54573, "end": 55056 }
class ____(DeferredLineBase): """At end of codegen call `line.replace(key, value_fn())`""" def __init__(self, key: str, value_fn: Callable[[], str], line: str): super().__init__(line) self.key = key self.value_fn = value_fn def __call__(self) -> str: return self.line.replac...
DelayReplaceLine
python
django__django
django/db/migrations/serializer.py
{ "start": 8286, "end": 8497 }
class ____(DeconstructibleSerializer): def serialize(self): attr_name, path, args, kwargs = self.value.deconstruct() return self.serialize_deconstructed(path, args, kwargs)
ModelFieldSerializer
python
hynek__structlog
src/structlog/stdlib.py
{ "start": 27463, "end": 31529 }
class ____: """ Add extra attributes of `logging.LogRecord` objects to the event dictionary. This processor can be used for adding data passed in the ``extra`` parameter of the `logging` module's log methods to the event dictionary. Args: allow: An optional collection of at...
ExtraAdder
python
walkccc__LeetCode
solutions/3420. Count Non-Decreasing Subarrays After K Operations/3420.py
{ "start": 0, "end": 876 }
class ____: def countNonDecreasingSubarrays(self, nums: list[int], k: int) -> int: ans = 0 cost = 0 # Store (number, count) pairs in non-increasing order. The numbers in the # queue represent what nums[i..j] look like after adjustments. dq = collections.deque() j = len(nums) - 1 for i, nu...
Solution
python
urllib3__urllib3
test/with_dummyserver/test_socketlevel.py
{ "start": 84926, "end": 86047 }
class ____(SocketDummyServerTestCase): def test_pool_size_retry_drain_fail(self) -> None: def socket_handler(listener: socket.socket) -> None: for _ in range(2): sock = listener.accept()[0] while not sock.recv(65536).endswith(b"\r\n\r\n"): pass...
TestRetryPoolSizeDrainFail
python
apache__airflow
providers/exasol/src/airflow/providers/exasol/hooks/exasol.py
{ "start": 1385, "end": 14768 }
class ____(DbApiHook): """ Interact with Exasol. You can specify the pyexasol ``compression``, ``encryption``, ``json_lib`` and ``client_name`` parameters in the extra field of your connection as ``{"compression": True, "json_lib": "rapidjson", etc}``. See `pyexasol reference <https://git...
ExasolHook
python
getsentry__sentry
tests/sentry/replays/endpoints/test_organization_replay_events_meta.py
{ "start": 392, "end": 5944 }
class ____(APITestCase, SnubaTestCase, OccurrenceTestMixin): def setUp(self) -> None: super().setUp() self.min_ago = before_now(minutes=1).replace(microsecond=0) self.login_as(user=self.user) self.project_1 = self.create_project() self.project_2 = self.create_project() ...
OrganizationEventsMetaTest
python
spack__spack
lib/spack/spack/relocate_text.py
{ "start": 11145, "end": 11357 }
class ____(BinaryTextReplaceError): def __init__(self, old, new): return super().__init__( f"Cannot replace {old!r} with {new!r} because the new prefix is longer." )
CannotGrowString
python
keras-team__keras
keras/src/layers/preprocessing/image_preprocessing/random_grayscale.py
{ "start": 269, "end": 4525 }
class ____(BaseImagePreprocessingLayer): """Preprocessing layer for random conversion of RGB images to grayscale. This layer randomly converts input images to grayscale with a specified factor. When applied, it maintains the original number of channels but sets all channels to the same grayscale value....
RandomGrayscale
python
huggingface__transformers
src/transformers/models/rt_detr/image_processing_rt_detr_fast.py
{ "start": 3787, "end": 22244 }
class ____(BaseImageProcessorFast): resample = PILImageResampling.BILINEAR image_mean = IMAGENET_DEFAULT_MEAN image_std = IMAGENET_DEFAULT_STD format = AnnotationFormat.COCO_DETECTION do_resize = True do_rescale = True do_normalize = False do_pad = False size = {"height": 640, "width...
RTDetrImageProcessorFast
python
huggingface__transformers
src/transformers/models/superpoint/image_processing_superpoint.py
{ "start": 1474, "end": 3760 }
class ____(ImagesKwargs, total=False): r""" do_grayscale (`bool`, *optional*, defaults to `True`): Whether to convert the image to grayscale. Can be overridden by `do_grayscale` in the `preprocess` method. """ do_grayscale: bool def is_grayscale( image: np.ndarray, input_data_format: ...
SuperPointImageProcessorKwargs
python
PrefectHQ__prefect
src/prefect/server/schemas/sorting.py
{ "start": 3756, "end": 4443 }
class ____(AutoEnum): """Defines flow sorting options.""" CREATED_DESC = AutoEnum.auto() UPDATED_DESC = AutoEnum.auto() NAME_ASC = AutoEnum.auto() NAME_DESC = AutoEnum.auto() @db_injector def as_sql_sort(self, db: "PrefectDBInterface") -> Iterable[sa.ColumnElement[Any]]: """Return ...
FlowSort
python
scipy__scipy
scipy/sparse/_csc.py
{ "start": 5322, "end": 8232 }
class ____(_csc_base, sparray): """ Compressed Sparse Column array. This can be instantiated in several ways: csc_array(D) where D is a 2-D ndarray csc_array(S) with another sparse array or matrix S (equivalent to S.tocsc()) csc_array((M, N), [dtype]) ...
csc_array
python
gevent__gevent
src/gevent/libuv/watcher.py
{ "start": 28968, "end": 29069 }
class ____(_base.PrepareMixin, watcher): _watcher_callback_name = '_gevent_prepare_callback0'
prepare
python
scikit-learn__scikit-learn
sklearn/tests/test_metaestimators.py
{ "start": 1113, "end": 11585 }
class ____: def __init__( self, name, construct, skip_methods=(), fit_args=make_classification(random_state=0), ): self.name = name self.construct = construct self.fit_args = fit_args self.skip_methods = skip_methods # For the following m...
DelegatorData
python
pennersr__django-allauth
allauth/socialaccount/providers/feishu/provider.py
{ "start": 219, "end": 346 }
class ____(ProviderAccount): def get_avatar_url(self): return self.account.extra_data.get("avatar_big")
FeishuAccount
python
huggingface__transformers
src/transformers/models/data2vec/modeling_data2vec_text.py
{ "start": 30312, "end": 34601 }
class ____(Data2VecTextPreTrainedModel, GenerationMixin): _tied_weights_keys = { "lm_head.decoder.weight": "data2vec_text.embeddings.word_embeddings.weight", "lm_head.decoder.bias": "lm_head.bias", } def __init__(self, config): super().__init__(config) if not config.is_deco...
Data2VecTextForCausalLM
python
keras-team__keras
keras/src/layers/preprocessing/image_preprocessing/random_crop_test.py
{ "start": 150, "end": 5533 }
class ____(testing.TestCase): def test_random_crop(self): self.run_layer_test( layers.RandomCrop, init_kwargs={ "height": 2, "width": 2, "data_format": "channels_last", }, input_shape=(1, 3, 4, 3), su...
RandomCropTest
python
readthedocs__readthedocs.org
readthedocs/telemetry/migrations/0001_initial.py
{ "start": 184, "end": 1321 }
class ____(migrations.Migration): safe = Safe.after_deploy() initial = True dependencies = [] operations = [ migrations.CreateModel( name="BuildData", fields=[ ( "id", models.BigAutoField( a...
Migration
python
rq__rq
tests/test_group.py
{ "start": 264, "end": 6660 }
class ____(RQTestCase): job_1_data = Queue.prepare_data(say_hello, job_id='job1') job_2_data = Queue.prepare_data(say_hello, job_id='job2') def test_create_group(self): q = Queue(connection=self.connection) group = Group.create(connection=self.connection) group.enqueue_many(q, [self...
TestGroup
python
pypa__warehouse
tests/unit/admin/views/test_flags.py
{ "start": 199, "end": 548 }
class ____: def test_get_classifiers(self, db_request): # Clear out any existing flags added from migrations db_request.db.query(AdminFlag).delete() flag_a = AdminFlagFactory(id="flag-a") flag_b = AdminFlagFactory(id="flag-b") assert views.get_flags(db_request) == {"flags":...
TestGetFlags
python
boto__boto3
tests/unit/dynamodb/test_transform.py
{ "start": 21057, "end": 21349 }
class ____(unittest.TestCase): def test_register(self): base_classes = [object] register_high_level_interface(base_classes) # Check that the base classes are as expected assert base_classes == [DynamoDBHighLevelResource, object]
TestRegisterHighLevelInterface
python
RaRe-Technologies__gensim
gensim/models/ldamodel.py
{ "start": 5017, "end": 10882 }
class ____(utils.SaveLoad): """Encapsulate information for distributed computation of :class:`~gensim.models.ldamodel.LdaModel` objects. Objects of this class are sent over the network, so try to keep them lean to reduce traffic. """ def __init__(self, eta, shape, dtype=np.float32): """ ...
LdaState
python
dagster-io__dagster
python_modules/libraries/dagster-powerbi/dagster_powerbi/components/power_bi_workspace/component.py
{ "start": 3022, "end": 5567 }
class ____(AssetSpecUpdateKwargs, Resolvable): for_dashboard: Optional[ResolvedTargetedPowerBITranslationFn] = None for_report: Optional[ResolvedTargetedPowerBITranslationFn] = None for_semantic_model: Optional[ResolvedTargetedPowerBITranslationFn] = None # data sources are external assets, so only the ...
PowerBIAssetArgs
python
jazzband__django-polymorphic
src/polymorphic/tests/models.py
{ "start": 941, "end": 1012 }
class ____(Model2C): field4 = models.CharField(max_length=30)
Model2D
python
xlwings__xlwings
xlwings/rest/api.py
{ "start": 726, "end": 12499 }
class ____(PathConverter): regex = ".*?" if sys.platform.startswith("darwin"): # Hack to allow leading slashes on Mac api.url_map.converters["path"] = EverythingConverter def get_book_object(fullname=None, name_or_ix=None, app_ix=None): assert fullname is None or name_or_ix is None if fullname: ...
EverythingConverter
python
PyCQA__pylint
tests/functional/t/too/too_many_ancestors.py
{ "start": 385, "end": 539 }
class ____(Iiii): # [too-many-ancestors] pass # https://github.com/pylint-dev/pylint/issues/4166 # https://github.com/pylint-dev/pylint/issues/4415
Jjjj
python
plotly__plotly.py
tests/test_optional/test_graph_objs/test_skipped_b64_keys.py
{ "start": 158, "end": 2751 }
class ____(NumpyTestUtilsMixin, TestCase): def test_np_geojson(self): normal_coordinates = [ [ [-87, 35], [-87, 30], [-85, 30], [-85, 35], ] ] numpy_coordinates = np.array(normal_coordinates) da...
TestShouldNotUseBase64InUnsupportedKeys
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/pyflakes/future_annotations.py
{ "start": 188, "end": 742 }
class ____: x: int y: int @classmethod def a(cls) -> Foo: return cls(x=0, y=0) @classmethod def b(cls) -> "Foo": return cls(x=0, y=0) @classmethod def c(cls) -> Bar: return cls(x=0, y=0) @classmethod def d(cls) -> Fruit: return cls(x=0, y=0) ...
Foo
python
jmcnamara__XlsxWriter
xlsxwriter/test/styles/test_write_cell_style.py
{ "start": 295, "end": 801 }
class ____(unittest.TestCase): """ Test the Styles _write_cell_style() method. """ def setUp(self): self.fh = StringIO() self.styles = Styles() self.styles._set_filehandle(self.fh) def test_write_cell_style(self): """Test the _write_cell_style() method""" ...
TestWriteCellStyle
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 1535357, "end": 1536151 }
class ____(sgqlc.types.Type, Node): """Represents an 'unassigned' event on any assignable object.""" __schema__ = github_schema __field_names__ = ("actor", "assignable", "assignee", "created_at") actor = sgqlc.types.Field(Actor, graphql_name="actor") """Identifies the actor who performed the event....
UnassignedEvent
python
conda__conda
conda/core/path_actions.py
{ "start": 39619, "end": 40592 }
class ____(RemoveFromPrefixPathAction): @classmethod def create_actions(cls, transaction_context, linked_package_data, target_prefix): return tuple( cls(transaction_context, linked_package_data, target_prefix, trgt) for trgt in linked_package_data.files if bool(_MENU_...
RemoveMenuAction
python
numba__numba
numba/core/types/abstract.py
{ "start": 9863, "end": 10382 }
class ____(IterableType): """ Base class for all iterator types. Derived classes should implement the *yield_type* attribute. """ def __init__(self, name, **kwargs): super(IteratorType, self).__init__(name, **kwargs) @property @abstractmethod def yield_type(self): """ ...
IteratorType
python
langchain-ai__langchain
libs/core/langchain_core/stores.py
{ "start": 8458, "end": 9061 }
class ____(InMemoryBaseStore[bytes]): """In-memory store for bytes. Attributes: store: The underlying dictionary that stores the key-value pairs. Examples: ```python from langchain.storage import InMemoryByteStore store = InMemoryByteStore() store.mset([("key1", b"...
InMemoryByteStore
python
spack__spack
lib/spack/spack/vendor/ruamel/yaml/timestamp.py
{ "start": 280, "end": 1815 }
class ____(datetime.datetime): def __init__(self, *args, **kw): # type: (Any, Any) -> None self._yaml = dict(t=False, tz=None, delta=0) # type: Dict[Any, Any] def __new__(cls, *args, **kw): # datetime is immutable # type: (Any, Any) -> Any return datetime.datetime.__new__(cls,...
TimeStamp
python
apache__airflow
providers/http/tests/unit/http/hooks/test_http.py
{ "start": 27513, "end": 35681 }
class ____: @pytest.fixture(autouse=True) def setup_connections(self, create_connection_without_db): create_connection_without_db( Connection( conn_id="http_default", conn_type="http", host="test:8080/", extra='{"bearer": "test"}' ) ) create_connec...
TestHttpAsyncHook
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/metrics_test.py
{ "start": 141148, "end": 143912 }
class ____(test.TestCase): def setUp(self): ops.reset_default_graph() @test_util.run_deprecated_v1 def testVars(self): metrics.percentage_below(values=array_ops.ones((10,)), threshold=2) _assert_metric_variables(self, ( 'percentage_below_threshold/count:0', 'percentage_below_threshol...
PcntBelowThreshTest
python
encode__starlette
starlette/middleware/sessions.py
{ "start": 354, "end": 3572 }
class ____: def __init__( self, app: ASGIApp, secret_key: str | Secret, session_cookie: str = "session", max_age: int | None = 14 * 24 * 60 * 60, # 14 days, in seconds path: str = "/", same_site: Literal["lax", "strict", "none"] = "lax", https_only: b...
SessionMiddleware
python
pytorch__pytorch
torch/nn/modules/activation.py
{ "start": 14153, "end": 15307 }
class ____(Module): r"""Applies the Hardswish function, element-wise. Method described in the paper: `Searching for MobileNetV3 <https://arxiv.org/abs/1905.02244>`_. Hardswish is defined as: .. math:: \text{Hardswish}(x) = \begin{cases} 0 & \text{if~} x \le -3, \\ x & ...
Hardswish
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/orm/clsregistry.py
{ "start": 5434, "end": 7806 }
class ____(_ClsRegistryToken): """refers to multiple classes of the same name within _decl_class_registry. """ __slots__ = "on_remove", "contents", "__weakref__" contents: Set[weakref.ref[Type[Any]]] on_remove: CallableReference[Optional[Callable[[], None]]] def __init__( self, ...
_MultipleClassMarker
python
dagster-io__dagster
python_modules/dagster/dagster_tests/freshness_tests/test_internal_freshness.py
{ "start": 2134, "end": 9872 }
class ____: def test_asset_decorator_with_time_window_freshness_policy(self) -> None: """Can we define an asset from decorator with a time window freshness policy?""" @asset( freshness_policy=TimeWindowFreshnessPolicy.from_timedeltas( fail_window=timedelta(minutes=10), w...
TestTimeWindowFreshnessPolicy
python
dagster-io__dagster
python_modules/automation/automation_tests/dagster_docs_tests/test_check_commands.py
{ "start": 8598, "end": 14582 }
class ____: """Test suite for --ignore-exclude-lists flag functionality.""" def setup_method(self): """Set up test fixtures.""" self.runner = CliRunner() def test_ignore_exclude_lists_flag_with_symbol_excluded_symbol(self): """Test --ignore-exclude-lists with --symbol on a known ex...
TestIgnoreExcludeListsFlag
python
davidhalter__parso
parso/normalizer.py
{ "start": 4207, "end": 5153 }
class ____: code: int message: str def __init__(self, normalizer): self._normalizer = normalizer def is_issue(self, node): raise NotImplementedError() def get_node(self, node): return node def _get_message(self, message, node): if message is None: ...
Rule
python
tensorflow__tensorflow
tensorflow/python/ops/control_flow_ops_benchmark.py
{ "start": 1239, "end": 3893 }
class ____(test.Benchmark): """Checks the runtime performance of outputting all intermediates.""" NUM_INTERMEDIATES = 1000 NUM_ITERS = 500 NUM_WARM_UP_ITERS = 50 def _create_cond(self, x): def branch_fn(): # Use a random value so the adds can't be constant folded. return x + sum(random_ops....
CondWithManyIntermediatesBenchmark
python
joke2k__faker
faker/providers/phone_number/cs_CZ/__init__.py
{ "start": 49, "end": 1417 }
class ____(PhoneNumberProvider): # Phone numbers # https://cs.wikipedia.org/wiki/Telefonn%C3%AD_%C4%8D%C3%ADslo # https://www.srovnejto.cz/blog/jake-jsou-telefonni-predvolby-do-zahranici/ formats = ( # prefix 00420 # 601-608 "00420 601 ### ###", "00420 602 ### ###", ...
Provider
python
sqlalchemy__sqlalchemy
test/orm/test_lazy_relations.py
{ "start": 50854, "end": 53316 }
class ____(fixtures.MappedTest): """ORM-level test for [ticket:3788]""" @classmethod def define_tables(cls, metadata): Table( "a", metadata, Column("id1", Integer, primary_key=True), Column("id2", Integer, primary_key=True), ) Table( ...
CompositeSimpleM2OTest
python
mlflow__mlflow
mlflow/gateway/providers/ai21labs.py
{ "start": 316, "end": 3204 }
class ____(BaseProvider): NAME = "AI21Labs" CONFIG_TYPE = AI21LabsConfig def __init__(self, config: EndpointConfig) -> None: super().__init__(config) if config.model.config is None or not isinstance(config.model.config, AI21LabsConfig): raise TypeError(f"Unexpected config type {...
AI21LabsProvider
python
gevent__gevent
src/gevent/tests/test__monkey.py
{ "start": 133, "end": 6581 }
class ____(SubscriberCleanupMixin, unittest.TestCase): maxDiff = None def setUp(self): super(TestMonkey, self).setUp() self.all_events = [] self.addSubscriber(self.all_events.append) self.orig_saved = orig_saved = {} for k, v in monkey.saved.items(): orig_s...
TestMonkey
python
pytorch__pytorch
torch/testing/_internal/opinfo/core.py
{ "start": 11551, "end": 25633 }
class ____: """Class holds alias information. For example, torch.abs -> torch.absolute, torch.Tensor.absolute, torch.Tensor.absolute_ """ def __init__(self, alias_name): self.name = alias_name self.op = _getattr_qual(torch, alias_name) self.method_variant = getattr(torch.Tensor,...
AliasInfo
python
huggingface__transformers
src/transformers/models/zoedepth/modeling_zoedepth.py
{ "start": 38460, "end": 39012 }
class ____(nn.Module): def __init__(self, in_features, out_features) -> None: super().__init__() hidden_features = in_features self.linear1 = nn.Linear(in_features, hidden_features) self.activation = nn.ReLU() self.linear2 = nn.Linear(hidden_features, out_features) def ...
ZoeDepthMLPClassifier
python
huggingface__transformers
src/transformers/utils/import_utils.py
{ "start": 59608, "end": 77403 }
class ____(ModuleType): """ Module class that surfaces all objects but only performs associated imports when the objects are requested. """ # Very heavily inspired by optuna.integration._IntegrationModule # https://github.com/optuna/optuna/blob/master/optuna/integration/__init__.py def __init__...
_LazyModule
python
apache__airflow
helm-tests/tests/helm_tests/airflow_core/test_dag_processor.py
{ "start": 969, "end": 32212 }
class ____: """Tests DAG processor.""" @pytest.mark.parametrize( ("airflow_version", "num_docs"), [ ("2.2.0", 0), ("2.3.0", 1), ], ) def test_only_exists_on_new_airflow_versions(self, airflow_version, num_docs): """Standalone Dag Processor was onl...
TestDagProcessor
python
ray-project__ray
rllib/env/tests/test_multi_agent_env_runner.py
{ "start": 1224, "end": 7429 }
class ____(unittest.TestCase): @classmethod def setUpClass(cls) -> None: ray.init() @classmethod def tearDownClass(self) -> None: ray.shutdown() def test_sample_timesteps(self): # Build a multi agent config. config = self._build_config() # Create a `MultiAge...
TestMultiAgentEnvRunner
python
scipy__scipy
scipy/stats/_probability_distribution.py
{ "start": 173, "end": 69975 }
class ____(ABC): # generic type compatibility with scipy-stubs __class_getitem__ = classmethod(GenericAlias) @abstractmethod def support(self): r"""Support of the random variable The support of a random variable is set of all possible outcomes; i.e., the subset of the domain o...
_ProbabilityDistribution
python
ansible__ansible
test/integration/targets/collections/collections/ansible_collections/testns/content_adj/plugins/inventory/statichost.py
{ "start": 646, "end": 2156 }
class ____(BaseInventoryPlugin, Cacheable): NAME = 'testns.content_adj.statichost' def __init__(self): super(InventoryModule, self).__init__() self._hosts = set() def verify_file(self, path): """ Verify if file is usable by this plugin, base does minimal accessibility check """ ...
InventoryModule
python
sqlalchemy__sqlalchemy
test/dialect/mysql/test_dialect.py
{ "start": 16025, "end": 18654 }
class ____(fixtures.TablesTest): """This test exists because we removed the MySQL dialect's override of the UTC_TIMESTAMP() function, where the commit message for this feature stated that "it caused problems with executemany()". Since no example was provided, we are trying lots of combinations here....
RemoveUTCTimestampTest
python
pytorch__pytorch
torch/_dynamo/variables/base.py
{ "start": 2220, "end": 4084 }
class ____: """ Base class for Variable.mutation_type. It encodes information about 1. The type of mutation Dynamo allows on the variable. 2. Whether the value represented by this variable already existed before Dynamo tracing. """ def __init__(self, typ: SourceType) -> None: # In H...
MutationType
python
apache__airflow
airflow-core/tests/unit/serialization/test_dag_dependency.py
{ "start": 901, "end": 1615 }
class ____: @pytest.mark.parametrize("dep_type", ("asset", "asset-alias", "asset-name-ref", "asset-uri-ref")) def test_node_id_with_asset(self, dep_type): dag_dep = DagDependency( source=dep_type, target="target", label="label", dependency_type=dep_type, ...
TestDagDependency
python
pytorch__pytorch
torch/_inductor/exc.py
{ "start": 3314, "end": 3366 }
class ____(CppCompileError): pass
CUDACompileError
python
doocs__leetcode
solution/1100-1199/1130.Minimum Cost Tree From Leaf Values/Solution.py
{ "start": 0, "end": 519 }
class ____: def mctFromLeafValues(self, arr: List[int]) -> int: @cache def dfs(i: int, j: int) -> Tuple: if i == j: return 0, arr[i] s, mx = inf, -1 for k in range(i, j): s1, mx1 = dfs(i, k) s2, mx2 = dfs(k + 1, j) ...
Solution
python
mlflow__mlflow
docs/api_reference/source/languagesections/__init__.py
{ "start": 226, "end": 590 }
class ____(Directive): has_content = True def run(self): self.assert_has_content() text = "\n".join(self.content) node = nodes.container(text) node["classes"].append("code-section") self.add_name(node) self.state.nested_parse(self.content, self.content_offset, no...
CodeSectionDirective
python
walkccc__LeetCode
solutions/2587. Rearrange Array to Maximize Prefix Score/2587.py
{ "start": 0, "end": 161 }
class ____: def maxScore(self, nums: list[int]) -> int: return sum(num > 0 for num in itertools.accumulate(sorted(nums, reverse=True)))
Solution
python
google__jax
tests/tree_util_test.py
{ "start": 6262, "end": 7999 }
class ____: x: tuple[int, int] y: int z: int = dataclasses.field(metadata={"static": True}) TREES += ( (ADataclass(x=(1, 2), y=3),), (ADataclassWithMeta(x=(1, 2), y=3, z=4),), ) TREE_STRINGS += ( "PyTreeDef(CustomNode(ADataclass[()], [(*, *), *]))", "PyTreeDef(CustomNode(ADataclassWithMeta[(4,)],...
ADataclassWithMeta
python
django__django
tests/expressions_window/models.py
{ "start": 31, "end": 112 }
class ____(models.Model): code = models.CharField(max_length=10)
Classification
python
dagster-io__dagster
python_modules/libraries/dagster-dg-core/dagster_dg_core/config.py
{ "start": 13517, "end": 14024 }
class ____: projects: list["DgWorkspaceProjectSpec"] scaffold_project_options: "DgWorkspaceScaffoldProjectOptions" @classmethod def from_raw(cls, raw: "DgRawWorkspaceConfig") -> Self: projects = [DgWorkspaceProjectSpec.from_raw(spec) for spec in raw.get("projects", [])] scaffold_project...
DgWorkspaceConfig
python
pyparsing__pyparsing
pyparsing/core.py
{ "start": 108378, "end": 109465 }
class ____(Literal): """ Token to match a specified string, ignoring case of letters. Note: the matched results will always be in the case of the given match string, NOT the case of the input text. Example: .. doctest:: >>> CaselessLiteral("CMD")[1, ...].parse_string("cmd CMD Cmd10") ...
CaselessLiteral