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
sympy__sympy
sympy/sets/ordinals.py
{ "start": 7045, "end": 7163 }
class ____(Ordinal): """The ordinal zero. OrdinalZero can be imported as ``ord0``. """ pass
OrdinalZero
python
networkx__networkx
networkx/linalg/tests/test_bethehessian.py
{ "start": 103, "end": 1268 }
class ____: @classmethod def setup_class(cls): deg = [3, 2, 2, 1, 0] cls.G = nx.havel_hakimi_graph(deg) cls.P = nx.path_graph(3) def test_bethe_hessian(self): "Bethe Hessian matrix" # fmt: off H = np.array([[4, -2, 0], [-2, 5, -2], ...
TestBetheHessian
python
PrefectHQ__prefect
src/prefect/client/base.py
{ "start": 1829, "end": 6075 }
class ____(Protocol): async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: ... @asynccontextmanager async def app_lifespan_context(app: ASGIApp) -> AsyncGenerator[None, None]: """ A context manager that calls startup/shutdown hooks for the given application. Lifespan contexts...
ASGIApp
python
sqlalchemy__sqlalchemy
test/sql/test_compare.py
{ "start": 5508, "end": 48348 }
class ____: # lambdas which return a tuple of ColumnElement objects. # must return at least two objects that should compare differently. # to test more varieties of "difference" additional objects can be added. fixtures = [ lambda: ( column("q"), column("x"), ...
CoreFixtures
python
pypa__pip
src/pip/_internal/index/sources.py
{ "start": 5199, "end": 6039 }
class ____(LinkSource): """``--find-links=<url>`` or ``--[extra-]index-url=<url>``. This returns: * ``page_candidates``: Links listed on an HTML file. * ``file_candidates``: The non-HTML file. """ def __init__( self, candidates_from_page: CandidatesFromPage, page_valid...
_RemoteFileSource
python
huggingface__transformers
src/transformers/models/byt5/tokenization_byt5.py
{ "start": 841, "end": 10047 }
class ____(PreTrainedTokenizer): """ Construct a ByT5 tokenizer. ByT5 simply uses raw bytes utf-8 encoding. This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to this superclass for more information regarding those methods. Args: ...
ByT5Tokenizer
python
huggingface__transformers
src/transformers/models/aria/configuration_aria.py
{ "start": 1360, "end": 9676 }
class ____(PreTrainedConfig): r""" This class handles the configuration for the text component of the Aria model. Instantiating a configuration with the defaults will yield a similar configuration to that of the model of the Aria [rhymes-ai/Aria](https://huggingface.co/rhymes-ai/Aria) architecture. ...
AriaTextConfig
python
sympy__sympy
sympy/core/mul.py
{ "start": 2345, "end": 79476 }
class ____(Expr, AssocOp): """ Expression representing multiplication operation for algebraic field. .. deprecated:: 1.7 Using arguments that aren't subclasses of :class:`~.Expr` in core operators (:class:`~.Mul`, :class:`~.Add`, and :class:`~.Pow`) is deprecated. See :ref:`non-expr-a...
Mul
python
django__django
django/contrib/postgres/indexes.py
{ "start": 1326, "end": 2890 }
class ____(PostgresIndex): suffix = "bloom" def __init__(self, *expressions, length=None, columns=(), **kwargs): super().__init__(*expressions, **kwargs) if len(self.fields) > 32: raise ValueError("Bloom indexes support a maximum of 32 fields.") if not isinstance(columns, (l...
BloomIndex
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/flake8_bugbear/B006_B008.py
{ "start": 1109, "end": 5849 }
class ____: @staticmethod def this_is_also_wrong_and_more_indented(value={}): pass def multiline_arg_wrong(value={ }): ... def single_line_func_wrong(value = {}): ... def and_this(value=set()): ... def this_too(value=collections.OrderedDict()): ... async def async_this_too(value=co...
Foo
python
kubernetes-client__python
kubernetes/client/models/v1alpha3_device_taint.py
{ "start": 383, "end": 6720 }
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...
V1alpha3DeviceTaint
python
pennersr__django-allauth
allauth/idp/oidc/views.py
{ "start": 11027, "end": 13273 }
class ____(View): def dispatch(self, request, *args, **kwargs): if "code" in request.GET: form = ConfirmCodeForm(request.GET) if form.is_valid(): return self._dispatch_authorization( request, form.cleaned_data["code"], ...
DeviceAuthorizationView
python
pennersr__django-allauth
allauth/mfa/migrations/0002_authenticator_timestamps.py
{ "start": 122, "end": 597 }
class ____(migrations.Migration): dependencies = [ ("mfa", "0001_initial"), ] operations = [ migrations.AddField( model_name="authenticator", name="created_at", field=models.DateTimeField(default=django.utils.timezone.now), ), migrations.A...
Migration
python
scipy__scipy
scipy/optimize/_trustregion_constr/tr_interior_point.py
{ "start": 742, "end": 14395 }
class ____: """ Barrier optimization problem: minimize fun(x) - barrier_parameter*sum(log(s)) subject to: constr_eq(x) = 0 constr_ineq(x) + s = 0 """ def __init__(self, x0, s0, fun, grad, lagr_hess, n_vars, n_ineq, n_eq, constr, jac, barrier_parame...
BarrierSubproblem
python
tensorflow__tensorflow
tensorflow/lite/python/lite_test.py
{ "start": 94455, "end": 112697 }
class ____(TestModels, parameterized.TestCase): def setUp(self): super(FromKerasFile, self).setUp() self._keras_file = None self._custom_objects = None if not context.executing_eagerly(): keras.backend.clear_session() def tearDown(self): if self._keras_file: os.remove(self._keras_f...
FromKerasFile
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/orm/strategy_options.py
{ "start": 33184, "end": 45935 }
class ____(_AbstractLoad): """Represents loader options which modify the state of a ORM-enabled :class:`_sql.Select` or a legacy :class:`_query.Query` in order to affect how various mapped attributes are loaded. The :class:`_orm.Load` object is in most cases used implicitly behind the scenes when o...
Load
python
apache__airflow
providers/cncf/kubernetes/tests/unit/cncf/kubernetes/executors/test_kubernetes_executor.py
{ "start": 10702, "end": 67616 }
class ____: """ Tests if an ApiException from the Kube Client will cause the task to be rescheduled. """ def setup_method(self) -> None: self.kubernetes_executor = KubernetesExecutor() self.kubernetes_executor.job_id = 5 @pytest.mark.skipif( AirflowKubernetesScheduler i...
TestKubernetesExecutor
python
openai__openai-python
src/openai/types/realtime/session_created_event.py
{ "start": 519, "end": 770 }
class ____(BaseModel): event_id: str """The unique ID of the server event.""" session: Session """The session configuration.""" type: Literal["session.created"] """The event type, must be `session.created`."""
SessionCreatedEvent
python
falconry__falcon
tests/test_middleware.py
{ "start": 3211, "end": 3277 }
class ____(ExecutedFirstMiddleware): pass
ExecutedLastMiddleware
python
huggingface__transformers
tests/models/gemma/test_modeling_gemma.py
{ "start": 1518, "end": 2226 }
class ____(CausalLMModelTest, unittest.TestCase): model_tester_class = GemmaModelTester # used in `test_torch_compile_for_training` _torch_compile_train_cls = GemmaForCausalLM if is_torch_available() else None # TODO (ydshieh): Check this. See https://app.circleci.com/pipelines/github/huggingface/tran...
GemmaModelTest
python
dagster-io__dagster
python_modules/automation/automation_tests/dagster_docs_tests/test_public_api_validator.py
{ "start": 487, "end": 14795 }
class ____: """Test suite for public API validation.""" @pytest.fixture def validator(self): """Create a validator instance for testing.""" dagster_root = Path(__file__).parent.parent.parent.parent.parent return PublicApiValidator(dagster_root) @pytest.fixture def public_sy...
TestPublicApiValidator
python
pytorch__pytorch
torch/_inductor/codegen/wrapper.py
{ "start": 15724, "end": 16174 }
class ____(WrapperLine): wrapper: PythonWrapperCodegen def __post_init__(self) -> None: self.wrapper.computed_sizes = self.wrapper.pop_computed_sizes() def codegen(self, code: IndentedBuffer) -> None: self.wrapper.pop_codegened_graph() code.do_unindent() def codegen_fx(self, c...
ExitSubgraphLine
python
pypa__pip
src/pip/_internal/commands/debug.py
{ "start": 5190, "end": 6805 }
class ____(Command): """ Display debug information. """ usage = """ %prog <options>""" ignore_require_venv = True def add_options(self) -> None: cmdoptions.add_target_python_options(self.cmd_opts) self.parser.insert_option_group(0, self.cmd_opts) self.parser.confi...
DebugCommand
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/initsubclass2.py
{ "start": 135, "end": 228 }
class ____: def __init_subclass__(cls, param_a: int): super().__init_subclass__()
A
python
numba__numba
numba/core/rewrites/registry.py
{ "start": 666, "end": 3651 }
class ____(object): '''Defines a registry for Numba rewrites. ''' _kinds = frozenset(['before-inference', 'after-inference']) def __init__(self): '''Constructor for the rewrite registry. Initializes the rewrites member to an empty list. ''' self.rewrites = defaultdict(l...
RewriteRegistry
python
Textualize__textual
src/textual/widgets/_markdown.py
{ "start": 22647, "end": 23119 }
class ____(Widget): """A bullet widget.""" DEFAULT_CSS = """ MarkdownBullet { width: auto; color: $text-primary; &:light { color: $text-secondary; } } """ symbol = reactive("\u25cf") """The symbol for the bullet.""" def get_selection(self, _...
MarkdownBullet
python
pytorch__pytorch
test/ao/sparsity/test_data_sparsifier.py
{ "start": 814, "end": 10898 }
class ____(TestCase): r"""This helper test class takes in any supported type of and runs some tests. The user is required to pass in the data that needs to sparsified and the runner will run some tests that needs to be passed in order for the data type to be supported. TODO: Change the structure by ...
_BaseDataSparsiferTestCase
python
hynek__structlog
tests/test_threadlocal.py
{ "start": 4189, "end": 8065 }
class ____: def test_wrap_returns_distinct_classes(self): """ Each call to wrap_dict returns a distinct new class whose context is independent from others. """ with pytest.deprecated_call(): D1 = wrap_dict(dict) D2 = wrap_dict(dict) assert D1 ...
TestThreadLocalDict
python
coleifer__peewee
tests/fields.py
{ "start": 25528, "end": 27144 }
class ____(ModelTestCase): requires = [BlobModel] def test_blob_field(self): b = BlobModel.create(data=b'\xff\x01') b_db = BlobModel.get(BlobModel.data == b'\xff\x01') self.assertEqual(b.id, b_db.id) data = b_db.data if isinstance(data, memoryview): data = d...
TestBlobField
python
facebook__pyre-check
source/interprocedural_analyses/taint/test/integration/properties.py
{ "start": 1276, "end": 1755 }
class ____: # This will be the model. @property def my_property(self) -> str: # Ensure that setter taint doesn't pollute the getter, there shouldn't # be an issue here. _test_sink(self) return "" @my_property.setter def my_property(self, value) -> None: pass ...
TaintedGetterAndSetter
python
pypa__hatch
src/hatch/utils/env.py
{ "start": 170, "end": 2445 }
class ____: def __init__(self, platform: Platform, executable: str = "python") -> None: self.platform = platform self.executable = executable self.__dep_check_data: dict[str, Any] | None = None self.__environment: dict[str, str] | None = None self.__sys_path: list[str] | Non...
PythonInfo
python
kamyu104__LeetCode-Solutions
Python/design-linked-list.py
{ "start": 144, "end": 3088 }
class ____(object): def __init__(self): """ Initialize your data structure here. """ self.__head = self.__tail = Node(-1) self.__head.next = self.__tail self.__tail.prev = self.__head self.__size = 0 def get(self, index): """ Get the valu...
MyLinkedList
python
spyder-ide__spyder
spyder/plugins/projects/widgets/projectdialog.py
{ "start": 7241, "end": 10517 }
class ____(BaseProjectPage): """New directory project page.""" LOCATION_TIP = _( "Select the location where the project directory will be created" ) PROJECTS_DOCS_URL = ( "https://docs.spyder-ide.org/current/panes/projects.html" ) def get_name(self): return _("New direc...
NewDirectoryPage
python
plotly__plotly.py
plotly/graph_objs/_contour.py
{ "start": 215, "end": 96398 }
class ____(_BaseTraceType): _parent_path_str = "" _path_str = "contour" _valid_props = { "autocolorscale", "autocontour", "coloraxis", "colorbar", "colorscale", "connectgaps", "contours", "customdata", "customdatasrc", "dx", ...
Contour
python
coleifer__peewee
tests/shortcuts.py
{ "start": 27698, "end": 27742 }
class ____(TSBase): key = TextField()
TSReg
python
streamlit__streamlit
lib/streamlit/errors.py
{ "start": 838, "end": 1110 }
class ____(Exception): """The base class for all exceptions thrown by Streamlit. Should be used for exceptions raised due to user errors (typically via StreamlitAPIException) as well as exceptions raised by Streamlit's internal code. """ pass
Error
python
donnemartin__interactive-coding-challenges
arrays_strings/permutation/test_permutation_solution.py
{ "start": 18, "end": 855 }
class ____(unittest.TestCase): def test_permutation(self, func): self.assertEqual(func(None, 'foo'), False) self.assertEqual(func('', 'foo'), False) self.assertEqual(func('Nib', 'bin'), False) self.assertEqual(func('act', 'cat'), True) self.assertEqual(func('a ct', 'ca t'), ...
TestPermutation
python
ray-project__ray
python/ray/data/_internal/issue_detection/detectors/hash_shuffle_detector.py
{ "start": 783, "end": 5333 }
class ____(IssueDetector): """Detector for hash shuffle aggregator health issues.""" def __init__( self, dataset_id: str, operators: List["PhysicalOperator"], config: HashShuffleAggregatorIssueDetectorConfig, ): self._dataset_id = dataset_id self._operators =...
HashShuffleAggregatorIssueDetector
python
apache__airflow
providers/google/tests/unit/google/cloud/operators/test_cloud_memorystore.py
{ "start": 2824, "end": 4097 }
class ____: @mock.patch("airflow.providers.google.cloud.operators.cloud_memorystore.CloudMemorystoreHook") def test_assert_valid_hook_call(self, mock_hook): task = CloudMemorystoreCreateInstanceOperator( task_id=TEST_TASK_ID, location=TEST_LOCATION, instance_id=TEST_I...
TestCloudMemorystoreCreateInstanceOperator
python
PyCQA__pylint
pylint/config/argument.py
{ "start": 6178, "end": 6990 }
class ____(_Argument): """Base class for store arguments to be parsed by an argparse.ArgumentsParser. This is based on the parameters passed to argparse.ArgumentsParser.add_message. See: https://docs.python.org/3/library/argparse.html#argparse.ArgumentParser.add_argument """ def __init__( ...
_BaseStoreArgument
python
pyinstaller__pyinstaller
bootloader/waflib/Tools/qt5.py
{ "start": 3351, "end": 3451 }
class ____(Task.Task): run_str = '${QT_LUPDATE} ${SRC} -ts ${TGT}' color = 'BLUE'
trans_update
python
allegroai__clearml
clearml/backend_api/services/v2_23/pipelines.py
{ "start": 2994, "end": 4837 }
class ____(Response): """ Response of pipelines.start_pipeline endpoint. :param pipeline: ID of the new pipeline task :type pipeline: str :param enqueued: True if the task was successfully enqueued :type enqueued: bool """ _service = "pipelines" _action = "start_pipeline" _vers...
StartPipelineResponse
python
kubernetes-client__python
kubernetes/client/models/v1_container_port.py
{ "start": 383, "end": 7629 }
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...
V1ContainerPort
python
django__django
tests/migrations/test_migrations_fake_split_initial/0001_initial.py
{ "start": 43, "end": 866 }
class ____(migrations.Migration): initial = True operations = [ migrations.CreateModel( "Author", [ ("id", models.AutoField(primary_key=True)), ("name", models.CharField(max_length=255)), ("slug", models.SlugField(null=True)), ...
Migration
python
Pylons__pyramid
src/pyramid/httpexceptions.py
{ "start": 19174, "end": 19454 }
class ____(_HTTPMove): """ subclass of :class:`~_HTTPMove` This indicates that the requested resource resides temporarily under a different URI. code: 307, title: Temporary Redirect """ code = 307 title = 'Temporary Redirect'
HTTPTemporaryRedirect
python
airbytehq__airbyte
airbyte-integrations/connectors/source-linkedin-ads/components.py
{ "start": 4833, "end": 5771 }
class ____(RecordExtractor): """ Extracts and transforms LinkedIn Ads records, ensuring that 'lastModified' and 'created' date-time fields are formatted to RFC3339. """ def _date_time_to_rfc3339(self, record: MutableMapping[str, Any]) -> MutableMapping[str, Any]: """ Converts 'lastM...
LinkedInAdsRecordExtractor
python
spyder-ide__spyder
spyder/plugins/console/widgets/main_widget.py
{ "start": 2408, "end": 20208 }
class ____(PluginMainWidget): # --- Signals # This signal emits a parsed error traceback text so we can then # request opening the file that traceback comes from in the Editor. sig_edit_goto_requested = Signal(str, int, str) # TODO: I do not think we use this? sig_focus_changed = Signal() ...
ConsoleWidget
python
huggingface__transformers
src/transformers/models/ibert/modeling_ibert.py
{ "start": 15074, "end": 16463 }
class ____(nn.Module): def __init__(self, config): super().__init__() self.quant_mode = config.quant_mode self.act_bit = 8 self.weight_bit = 8 self.bias_bit = 32 self.dense = QuantLinear( config.hidden_size, config.intermediate_size, ...
IBertIntermediate
python
getsentry__sentry
tests/sentry/uptime/endpoints/test_detector.py
{ "start": 2261, "end": 8859 }
class ____(UptimeDetectorBaseTest): endpoint = "sentry-api-0-organization-detector-details" def setUp(self) -> None: super().setUp() self.context = { "organization": self.project.organization, "project": self.project, "request": self.make_request(), ...
OrganizationDetectorDetailsPutTest
python
PyCQA__pylint
tests/functional/a/assignment/assignment_from_no_return_2.py
{ "start": 1493, "end": 1780 }
class ____: """bla bla""" def abstract_method(self): """use to return something in concrete implementation""" raise NotImplementedError def use_abstract(self): """should not issue E1111""" var = self.abstract_method() print(var)
Abstract
python
kamyu104__LeetCode-Solutions
Python/minimum-number-of-operations-to-make-array-xor-equal-to-k.py
{ "start": 48, "end": 331 }
class ____(object): def minOperations(self, nums, k): """ :type nums: List[int] :type k: int :rtype: int """ def popcount(x): return bin(x).count('1') return popcount(reduce(lambda x, y: x^y, nums, k))
Solution
python
kamyu104__LeetCode-Solutions
Python/maximize-the-number-of-target-nodes-after-connecting-trees-i.py
{ "start": 87, "end": 3588 }
class ____(object): def maxTargetNodes(self, edges1, edges2, k): """ :type edges1: List[List[int]] :type edges2: List[List[int]] :type k: int :rtype: List[int] """ def centroid_decomposition(adj, k): def dfs(u): # https://usaco.guid...
Solution
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/typeNarrowingIsinstance1.py
{ "start": 399, "end": 510 }
class ____(UnrelatedClass): def __init__(self) -> None: self.property2: None = None
UnrelatedSubclass
python
django-haystack__django-haystack
test_haystack/solr_tests/test_solr_management_commands.py
{ "start": 529, "end": 896 }
class ____(indexes.SearchIndex, indexes.Indexable): text = indexes.CharField(document=True, use_template=True) name = indexes.CharField(model_attr="author", faceted=True) pub_date = indexes.DateTimeField(model_attr="pub_date") def get_model(self): return MockModel def get_updated_field(sel...
SolrMockSearchIndex
python
huggingface__transformers
src/transformers/models/grounding_dino/modeling_grounding_dino.py
{ "start": 24510, "end": 25876 }
class ____(nn.Module): """ This is a more standard version of the position embedding, very similar to the one used by the Attention is all you need paper, generalized to work on images. """ def __init__(self, config): super().__init__() self.embedding_dim = config.d_model // 2 ...
GroundingDinoSinePositionEmbedding
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/inputs.py
{ "start": 4364, "end": 4735 }
class ____(graphene.InputObjectType): graphName = graphene.NonNull(graphene.String) repositoryName = graphene.NonNull(graphene.String) repositoryLocationName = graphene.NonNull(graphene.String) class Meta: description = """This type represents the fields necessary to identify a graph"""...
GrapheneGraphSelector
python
FactoryBoy__factory_boy
factory/django.py
{ "start": 8668, "end": 9369 }
class ____(FileField): DEFAULT_FILENAME = 'example.jpg' def _make_data(self, params): # ImageField (both django's and factory_boy's) require PIL. # Try to import it along one of its known installation paths. from PIL import Image width = params.get('width', 100) height ...
ImageField
python
donnemartin__interactive-coding-challenges
staging/graphs_trees/binary_tree/binary_search_tree.py
{ "start": 119, "end": 3231 }
class ____ (object): def __init__ (self): self.root = None def insert (self, newData): leaf = Node(newData) if self.root is None: self.root = leaf else: current = self.root parent = self.root while current is not None: parent = current if newData < current.data: current = current.le...
BinaryTree
python
getsentry__sentry
tests/sentry/models/test_releasefile.py
{ "start": 2278, "end": 7157 }
class ____(TestCase): def create_archive(self, fields, files, dist=None): manifest = dict( fields, files={filename: {"url": f"fake://{filename}"} for filename in files} ) buffer = BytesIO() with ZipFile(buffer, mode="w") as zf: zf.writestr("manifest.json", jso...
ReleaseArchiveTestCase
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/protocol11.py
{ "start": 466, "end": 683 }
class ____(SourceProvider[_TBase2]): def get(self) -> Optional[_TBase2]: source = my_next(self) return source def __next__(self) -> _TBase2: raise NotImplementedError
ManagedSourceProvider
python
streamlit__streamlit
lib/streamlit/components/v2/component_file_watcher.py
{ "start": 2417, "end": 14653 }
class ____: """Handle file watching for component asset directories. Parameters ---------- component_update_callback : Callable[[list[str]], None] Callback invoked when files change under any watched directory. It receives a list of component names affected by the change. """ d...
ComponentFileWatcher
python
PrefectHQ__prefect
src/prefect/client/schemas/objects.py
{ "start": 44230, "end": 44588 }
class ____(ObjectBaseModel): """An ORM representation of saved search data. Represents a set of filter criteria.""" name: str = Field(default=..., description="The name of the saved search.") filters: list[SavedSearchFilter] = Field( default_factory=lambda: [], description="The filter set f...
SavedSearch
python
altair-viz__altair
altair/vegalite/v6/schema/core.py
{ "start": 1007893, "end": 1008073 }
class ____(RangeScheme): """RangeRaw schema wrapper.""" _schema = {"$ref": "#/definitions/RangeRaw"} def __init__(self, *args): super().__init__(*args)
RangeRaw
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 40876, "end": 41364 }
class ____(sgqlc.types.Enum): """Properties by which milestone connections can be ordered. Enumeration Choices: * `CREATED_AT`: Order milestones by when they were created. * `DUE_DATE`: Order milestones by when they are due. * `NUMBER`: Order milestones by their number. * `UPDATED_AT`: Order m...
MilestoneOrderField
python
Lightning-AI__lightning
tests/tests_pytorch/trainer/connectors/test_callback_connector.py
{ "start": 12650, "end": 13235 }
class ____(Callback): @property def state_key(self): return "unique_key_2" def state_dict(self): return {"state": 2} @pytest.mark.parametrize( ("callbacks"), [ [Callback(), Callback()], [StatefulCallback()], [StatefulCallback1(), StatefulCallback2()], ]...
StatefulCallback2
python
getsentry__sentry
src/sentry/replays/usecases/query/conditions/tags.py
{ "start": 2642, "end": 5234 }
class ____(GenericBase): @staticmethod def visit_eq(expression: Expression, value: str) -> Condition: return contains(TagAggregate.visit_eq(expression, value)) @staticmethod def visit_neq(expression: Expression, value: str) -> Condition: return does_not_contain(TagAggregate.visit_eq(exp...
SumOfTagAggregate
python
pytorch__pytorch
test/dynamo/test_fake_distributed.py
{ "start": 3619, "end": 5004 }
class ____(torch.nn.Module): def forward(self, primals_1: "Sym(u0)", primals_2: "Sym(u1)", primals_3: "Sym(u2)", primals_4: "f32[u0, u1, u2]"): ge_1: "Sym(u0 >= 0)" = primals_1 >= 0 _assert_scalar = torch.ops.aten._assert_scalar.default(ge_1, "Runtime assertion failed for expression u0 >= 0 on node ...
GraphModule
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql_tests/graphql/test_runs.py
{ "start": 7486, "end": 37004 }
class ____(ExecutingGraphQLContextTestMatrix): def test_get_runs_over_graphql(self, graphql_context: WorkspaceRequestContext): # This include needs to be here because its inclusion screws up # other code in this file which reads itself to load a repo from dagster_graphql_tests.graphql.utils ...
TestGetRuns
python
apache__airflow
providers/amazon/src/airflow/providers/amazon/aws/hooks/glue_databrew.py
{ "start": 894, "end": 2580 }
class ____(AwsBaseHook): """ Interact with AWS DataBrew. Additional arguments (such as ``aws_conn_id``) may be specified and are passed down to the underlying AwsBaseHook. .. seealso:: - :class:`~airflow.providers.amazon.aws.hooks.base_aws.AwsBaseHook` """ def __init__(self, *args...
GlueDataBrewHook
python
getsentry__sentry
tests/sentry/integrations/api/endpoints/test_organization_integration_serverless_functions.py
{ "start": 554, "end": 3716 }
class ____(APITestCase): endpoint = "sentry-api-0-organization-integration-serverless-functions" def setUp(self) -> None: super().setUp() self.project = self.create_project(organization=self.organization) self.integration, self.org_integration = self.create_provider_integration_for( ...
AbstractServerlessTest
python
tox-dev__tox
src/tox/config/loader/replacer.py
{ "start": 2263, "end": 6524 }
class ____: # noqa: PLW1641 """An expression that is handled specially by the Replacer.""" def __init__(self, expr: Sequence[MatchArg], term_pos: int | None = None) -> None: self.expr = expr self.term_pos = term_pos def __repr__(self) -> str: return f"MatchExpression(expr={self.ex...
MatchExpression
python
pypa__setuptools
setuptools/command/build_py.py
{ "start": 13102, "end": 15826 }
class ____: """Inform users that package or module is included as 'data file'""" class _Warning(SetuptoolsDeprecationWarning): _SUMMARY = """ Package {importable!r} is absent from the `packages` configuration. """ _DETAILS = """ ############################ # Pa...
_IncludePackageDataAbuse
python
prompt-toolkit__python-prompt-toolkit
src/prompt_toolkit/layout/processors.py
{ "start": 14412, "end": 16010 }
class ____(Processor): """ When we're in Vi block insert mode, display all the cursors. """ def apply_transformation( self, transformation_input: TransformationInput ) -> Transformation: ( buffer_control, document, lineno, source_to_di...
DisplayMultipleCursors
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 243320, "end": 245445 }
class ____(sgqlc.types.Input): """Ways in which to filter lists of issues.""" __schema__ = github_schema __field_names__ = ( "assignee", "created_by", "labels", "mentioned", "milestone", "milestone_number", "since", "states", "viewer_s...
IssueFilters
python
huggingface__transformers
src/transformers/models/pegasus_x/modeling_pegasus_x.py
{ "start": 22580, "end": 27933 }
class ____(GradientCheckpointingLayer): def __init__(self, stagger_blocks_this_layer: bool, config: PegasusXConfig): super().__init__() self.embed_dim = config.d_model self.self_attn = PegasusXGlobalLocalAttention( embed_dim=self.embed_dim, num_heads=config.encoder_at...
PegasusXEncoderLayer
python
openai__openai-python
src/openai/types/beta/threads/runs/message_creation_step_details.py
{ "start": 347, "end": 506 }
class ____(BaseModel): message_creation: MessageCreation type: Literal["message_creation"] """Always `message_creation`."""
MessageCreationStepDetails
python
readthedocs__readthedocs.org
readthedocs/organizations/migrations/0001_squashed.py
{ "start": 238, "end": 13343 }
class ____(migrations.Migration): safe = Safe.after_deploy() initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ("projects", "0002_add_importedfile_model"), ] operations = [ migrations.CreateModel( name="Organization", ...
Migration
python
scrapy__scrapy
tests/test_spidermiddleware_referer.py
{ "start": 25053, "end": 25180 }
class ____(MixinUnsafeUrl, TestRefererMiddleware): req_meta = {"referrer_policy": POLICY_UNSAFE_URL}
TestRequestMetaUnsafeUrl
python
kamyu104__LeetCode-Solutions
Python/check-if-a-string-is-a-valid-sequence-from-root-to-leaves-path-in-a-binary-tree.py
{ "start": 894, "end": 1496 }
class ____(object): def isValidSequence(self, root, arr): """ :type root: TreeNode :type arr: List[int] :rtype: bool """ s = [(root, 0)] while s: node, depth = s.pop() if not node or depth == len(arr) or node.val != arr[depth]: ...
Solution2
python
readthedocs__readthedocs.org
readthedocs/search/tests/test_faceted_search.py
{ "start": 117, "end": 2290 }
class ____: @pytest.mark.parametrize("case", ["upper", "lower", "title"]) def test_search_exact_match(self, client, project, case): """Check quoted query match exact phrase with case insensitively Making a query with quoted text like ``"foo bar"`` should match exactly ``foo bar`` or ``F...
TestPageSearch
python
facebook__pyre-check
source/interprocedural_analyses/taint/test/integration/readonly.py
{ "start": 1078, "end": 1475 }
class ____: tainted: str = "" not_tainted: str = "" def readonly_foo_tainted(foo: PyreReadOnly[Foo]) -> None: _test_sink(foo.tainted) def readonly_foo_not_tainted(foo: PyreReadOnly[Foo]) -> None: _test_sink(foo.not_tainted) def regular_foo_tainted(foo: Foo) -> None: _test_sink(foo.tainted) d...
Foo
python
apache__airflow
airflow-core/tests/unit/core/test_sqlalchemy_config.py
{ "start": 1232, "end": 4595 }
class ____: @pytest.fixture(autouse=True, scope="class") def reset(self): try: with pytest.MonkeyPatch.context() as mp: mp.setattr( settings, "SQL_ALCHEMY_CONN", "mysql+foobar://user:pass@host/dbname?inline=param&ano...
TestSqlAlchemySettings
python
plotly__plotly.py
tests/test_optional/test_figure_factory/test_figure_factory.py
{ "start": 144901, "end": 153895 }
class ____(NumpyTestUtilsMixin, TestCaseNoTemplate): def compare_list_values(self, list1, list2, decimal=7): assert len(list1) == len(list2), "Lists are not of the same length." for i in range(len(list1)): if isinstance(list1[i], list): self.compare_list_values(list1[i], ...
TestHexbinMapbox
python
getsentry__sentry
tests/sentry/workflow_engine/endpoints/test_organization_detector_index.py
{ "start": 27469, "end": 46023 }
class ____(OrganizationDetectorIndexBaseTest): method = "POST" def setUp(self) -> None: super().setUp() self.connected_workflow = self.create_workflow( organization_id=self.organization.id, ) self.valid_data = { "name": "Test Detector", "type"...
OrganizationDetectorIndexPostTest
python
pymupdf__PyMuPDF
wdev.py
{ "start": 194, "end": 8403 }
class ____: r''' Windows only. Finds locations of Visual Studio command-line tools. Assumes VS2019-style paths. Members and example values:: .year: 2019 .grade: Community .version: 14.28.29910 .directory: C:\Program Files (x86)\Microsoft Visual Studio\2019\Co...
WindowsVS
python
getsentry__sentry
src/sentry/replays/models.py
{ "start": 1470, "end": 2739 }
class ____(Model): __relocation_scope__ = RelocationScope.Excluded project_id = BoundedBigIntegerField() replay_id = models.CharField(max_length=32, db_index=True) file_id = BoundedBigIntegerField(db_index=True) segment_id = BoundedIntegerField(db_column="sequence_id") date_added = models.DateT...
ReplayRecordingSegment
python
weaviate__weaviate-python-client
weaviate/collections/classes/config_vector_index.py
{ "start": 7589, "end": 7792 }
class ____(_QuantizerConfigCreate): cache: Optional[bool] bits: Optional[int] rescoreLimit: Optional[int] @staticmethod def quantizer_name() -> str: return "rq"
_RQConfigCreate
python
ray-project__ray
python/ray/serve/tests/test_cli_3.py
{ "start": 2096, "end": 2480 }
class ____: def __init__(self, h: DeploymentHandle): self._h = h async def __call__(self): return await self._h.remote() TestBuildFNode = global_f.bind() TestBuildDagNode = NoArgDriver.bind(TestBuildFNode) TestApp1Node = global_f.options(name="app1").bind() TestApp2Node = NoArgDriver.option...
NoArgDriver
python
tensorflow__tensorflow
tensorflow/python/framework/ops.py
{ "start": 7032, "end": 9346 }
class ____(contextlib.AbstractContextManager[None]): def __init__(self, *args, **kwargs) -> None: pass def __enter__(self) -> None: pass def __exit__(self, type_arg, value_arg, traceback_arg) -> bool: return False # False values do not suppress exceptions def _as_graph_element(obj): """Convert...
NullContextmanager
python
tornadoweb__tornado
tornado/template.py
{ "start": 21047, "end": 21795 }
class ____(_Node): def __init__(self, name: str, reader: "_TemplateReader", line: int) -> None: self.name = name self.template_name = reader.name self.line = line def find_named_blocks( self, loader: Optional[BaseLoader], named_blocks: Dict[str, _NamedBlock] ) -> None: ...
_IncludeBlock
python
numba__numba
numba/tests/test_cfunc.py
{ "start": 9894, "end": 13079 }
class ____(TestCase): c_source = """ typedef struct _big_struct { int i1; float f2; double d3; float af4[9]; } big_struct; typedef struct _error { int bits:4; } error; typedef double (*myfunc)(big_struct*, size_t); """ def get_ffi(self, src=c_source): from cffi import FFI ...
TestCffiStruct
python
getsentry__sentry
tests/sentry/api/endpoints/test_organization_spans_fields.py
{ "start": 5124, "end": 27185 }
class ____(BaseSpansTestCase, APITestCase): view = "sentry-api-0-organization-spans-fields-values" def setUp(self) -> None: super().setUp() self.login_as(user=self.user) def do_request(self, key: str, query=None, features=None, **kwargs): if features is None: features =...
OrganizationSpansTagKeyValuesEndpointTest
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 8207, "end": 8420 }
class ____(sgqlc.types.Enum): """ See source code for more info. """ __schema__ = graphql_schema __choices__ = ("CREATED_AT", "CUSTOMER_NAME", "HOST_NAME")
EnterpriseServerInstallationOrderField
python
Netflix__metaflow
metaflow/plugins/aws/batch/batch.py
{ "start": 1227, "end": 20395 }
class ____(object): def __init__(self, metadata, environment, flow_datastore=None): self.metadata = metadata self.environment = environment self.flow_datastore = flow_datastore self._client = BatchClient() atexit.register(lambda: self.job.kill() if hasattr(self, "job") else N...
Batch
python
realpython__materials
django-vue-graphql/source_code_final/back_end/blog/admin.py
{ "start": 258, "end": 910 }
class ____(admin.ModelAdmin): model = Post list_display = ( "id", "title", "subtitle", "slug", "publish_date", "published", ) list_filter = ( "published", "publish_date", ) list_editable = ( "title", "subtitle", ...
PostAdmin
python
more-itertools__more-itertools
tests/test_recipes.py
{ "start": 6046, "end": 6376 }
class ____(TestCase): def test_basic(self): iterable = range(2) for func in (mi.pad_none, mi.padnone): with self.subTest(func=func): p = func(iterable) self.assertEqual( [0, 1, None, None], [next(p) for _ in range(4)] ) ...
PadnoneTests
python
getsentry__sentry-python
tests/integrations/grpc/grpc_test_service_pb2_grpc.py
{ "start": 218, "end": 1738 }
class ____(object): """Missing associated documentation comment in .proto file.""" def __init__(self, channel): """Constructor. Args: channel: A grpc.Channel. """ self.TestServe = channel.unary_unary( '/grpc_test_server.gRPCTestService/TestServe', ...
gRPCTestServiceStub
python
huggingface__transformers
src/transformers/models/ernie4_5/modeling_ernie4_5.py
{ "start": 14952, "end": 15508 }
class ____(PreTrainedModel): config: Ernie4_5Config base_model_prefix = "model" supports_gradient_checkpointing = True _no_split_modules = ["Ernie4_5DecoderLayer"] _skip_keys_device_placement = ["past_key_values"] _supports_flash_attn = True _supports_sdpa = True _supports_flex_attn = Tr...
Ernie4_5PreTrainedModel
python
apache__airflow
providers/google/tests/unit/google/cloud/operators/test_cloud_batch.py
{ "start": 1384, "end": 3576 }
class ____: @mock.patch(CLOUD_BATCH_HOOK_PATH) def test_execute(self, mock): mock.return_value.wait_for_job.return_value = JOB operator = CloudBatchSubmitJobOperator( task_id=TASK_ID, project_id=PROJECT_ID, region=REGION, job_name=JOB_NAME, job=JOB ) completed_job = ...
TestCloudBatchSubmitJobOperator
python
ray-project__ray
rllib/env/tests/test_multi_agent_env.py
{ "start": 2930, "end": 5306 }
class ____(MultiAgentEnv): """Env for testing when the env terminates (after agent 0 does).""" def __init__(self): super().__init__() self.envs = [MockEnv(3), MockEnv(5)] self.agents = list(range(len(self.envs))) self.terminateds = set() self.truncateds = set() s...
EarlyDoneMultiAgent