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
astropy__astropy
astropy/io/ascii/core.py
{ "start": 7572, "end": 7651 }
class ____(NumType): """ Describes floating-point data. """
FloatType
python
dagster-io__dagster
python_modules/libraries/dagster-managed-elements/dagster_managed_elements/types.py
{ "start": 8535, "end": 9617 }
class ____(ABC): """Base class which defines the interface for checking and reconciling a managed element. Typically, the constructor will take in a set of resources or user configuration. The implementations of the check and apply methods will then use this configuration to determine the diff between ...
ManagedElementReconciler
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 214878, "end": 215459 }
class ____(sgqlc.types.relay.Connection): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("edges", "nodes", "page_info", "total_count") edges = sgqlc.types.Field(sgqlc.types.list_of("CWEEdge"), graphql_name="edges") nodes = sgqlc.types.Field(sgqlc.types...
CWEConnection
python
pyinstaller__pyinstaller
bootloader/waflib/Tools/ccroot.py
{ "start": 3237, "end": 5496 }
class ____(Task.Task): color = 'YELLOW' weight = 3 inst_to = None chmod = Utils.O755 def add_target(self, target): if isinstance(target, str): base = self.generator.path if target.startswith('#'): target = target[1:] base = self.genera...
link_task
python
run-llama__llama_index
llama-index-integrations/storage/docstore/llama-index-storage-docstore-tablestore/llama_index/storage/docstore/tablestore/base.py
{ "start": 254, "end": 2218 }
class ____(KVDocumentStore): """ TablestoreDocument Store. Args: tablestore_kvstore (TablestoreKVStore): tablestore_kvstore key-value store namespace (str): namespace for the docstore Returns: TablestoreDocumentStore: A Tablestore document store object. """ def __init...
TablestoreDocumentStore
python
huggingface__transformers
src/transformers/models/olmo2/modeling_olmo2.py
{ "start": 9396, "end": 12935 }
class ____(nn.Module): """Multi-headed attention from 'Attention Is All You Need' paper""" def __init__(self, config: Olmo2Config, layer_idx: Optional[int] = None): super().__init__() self.config = config self.layer_idx = layer_idx self.head_dim = getattr(config, "head_dim", con...
Olmo2Attention
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 1328412, "end": 1329350 }
class ____(sgqlc.types.Type, ProjectV2ItemFieldValueCommon, Node): """The value of an iteration field in a Project item.""" __schema__ = github_schema __field_names__ = ("duration", "iteration_id", "start_date", "title", "title_html") duration = sgqlc.types.Field(sgqlc.types.non_null(Int), graphql_name...
ProjectV2ItemFieldIterationValue
python
viewflow__viewflow
viewflow/workflow/migrations/0013_process_seed_content_type_process_seed_object_id_and_more.py
{ "start": 125, "end": 1416 }
class ____(migrations.Migration): dependencies = [ ("contenttypes", "0002_remove_content_type_name"), ("viewflow", "0012_alter_process_data_alter_task_data"), ] operations = [ migrations.AddField( model_name="process", name="seed_content_type", f...
Migration
python
wandb__wandb
wandb/sdk/artifacts/_generated/artifact_used_by.py
{ "start": 445, "end": 545 }
class ____(GQLResult): edges: List[ArtifactUsedByArtifactUsedByEdges]
ArtifactUsedByArtifactUsedBy
python
tornadoweb__tornado
tornado/test/iostream_test.py
{ "start": 1290, "end": 1395 }
class ____(RequestHandler): def get(self): self.write("Hello") @abstract_base_test
HelloHandler
python
Textualize__textual
docs/examples/styles/grid_rows.py
{ "start": 100, "end": 553 }
class ____(App): CSS_PATH = "grid_rows.tcss" def compose(self): yield Grid( Label("1fr"), Label("1fr"), Label("height = 6"), Label("height = 6"), Label("25%"), Label("25%"), Label("1fr"), Label("1fr"), ...
MyApp
python
ansible__ansible
lib/ansible/plugins/doc_fragments/action_core.py
{ "start": 325, "end": 2855 }
class ____(object): # requires action_common DOCUMENTATION = r""" attributes: async: support: none become: support: none bypass_task_loop: description: These tasks ignore the C(loop) and C(with_) keywords core: description: This is a 'core engine' feature and is not impl...
ModuleDocFragment
python
coleifer__peewee
tests/models.py
{ "start": 147842, "end": 148041 }
class ____(TestModel): key = TextField() value = TextField() extra = TextField() class Meta: indexes = ( (('key', 'value'), True), ) @requires_pglike
UKVRel
python
weaviate__weaviate-python-client
weaviate/collections/classes/aggregate.py
{ "start": 2823, "end": 3063 }
class ____(BaseModel): property_name: str count: bool def to_gql(self) -> str: raise NotImplementedError def to_grpc(self) -> aggregate_pb2.AggregateRequest.Aggregation: raise NotImplementedError
_MetricsBase
python
PyCQA__pylint
pylint/config/callback_actions.py
{ "start": 5067, "end": 5535 }
class ____(_AccessRunObjectAction): """Display all the confidence levels that pylint knows about.""" def __call__( self, parser: argparse.ArgumentParser, namespace: argparse.Namespace, values: str | Sequence[Any] | None, option_string: str | None = "--list-conf-levels", ...
_ListConfidenceLevelsAction
python
django__django
tests/admin_filters/tests.py
{ "start": 6296, "end": 6540 }
class ____(BookAdmin): list_filter = ( "year", ("author__email", AllValuesFieldListFilter), "contributors", "is_best_seller", "date_registered", "no", )
BookAdminWithUnderscoreLookupAndTuple
python
huggingface__transformers
src/transformers/models/encodec/modeling_encodec.py
{ "start": 13794, "end": 15074 }
class ____(nn.Module): """Codebook with Euclidean distance.""" def __init__(self, config: EncodecConfig): super().__init__() embed = torch.zeros(config.codebook_size, config.codebook_dim) self.codebook_size = config.codebook_size self.register_buffer("inited", torch.Tensor([Tr...
EncodecEuclideanCodebook
python
Textualize__textual
docs/examples/guide/workers/weather05.py
{ "start": 316, "end": 1807 }
class ____(App): """App to display the current weather.""" CSS_PATH = "weather.tcss" def compose(self) -> ComposeResult: yield Input(placeholder="Enter a City") with VerticalScroll(id="weather-container"): yield Static(id="weather") async def on_input_changed(self, message...
WeatherApp
python
spyder-ide__spyder
spyder/widgets/arraybuilder.py
{ "start": 5952, "end": 14148 }
class ____(QDialog): def __init__(self, parent=None, inline=True, offset=0, force_float=False, language='python'): super().__init__(parent=parent) self._language = language self._options = _REGISTERED_ARRAY_BUILDERS.get('python', None) self._parent = parent ...
ArrayBuilderDialog
python
walkccc__LeetCode
solutions/3191. Minimum Operations to Make Binary Array Elements Equal to One I/3191.py
{ "start": 0, "end": 263 }
class ____: def minOperations(self, nums: list[int]) -> int: ans = 0 for i in range(len(nums) - 2): if nums[i] == 0: nums[i + 1] ^= 1 nums[i + 2] ^= 1 ans += 1 return -1 if nums[-1] == 0 or nums[-2] == 0 else ans
Solution
python
numba__numba
numba/parfors/parfor.py
{ "start": 97010, "end": 124878 }
class ____: """Build Parfor nodes from prange loops. """ def __init__(self, pass_states): self.pass_states = pass_states self.rewritten = [] def run(self, blocks): pass_states = self.pass_states call_table, _ = get_call_table(blocks) cfg = compute_cfg_from_block...
ConvertLoopPass
python
keras-team__keras
keras/src/callbacks/early_stopping.py
{ "start": 214, "end": 6643 }
class ____(MonitorCallback): """Stop training when a monitored metric has stopped improving. Assuming the goal of a training is to minimize the loss. With this, the metric to be monitored would be `'loss'`, and mode would be `'min'`. A `model.fit()` training loop will check at end of every epoch whethe...
EarlyStopping
python
django-haystack__django-haystack
test_haystack/test_models.py
{ "start": 525, "end": 8275 }
class ____(TestCase): fixtures = ["base_data"] def setUp(self): super().setUp() cap = CaptureHandler() logging.getLogger("haystack").addHandler(cap) self.no_data = {} self.extra_data = {"stored": "I am stored data. How fun."} self.no_overwrite_data = { ...
SearchResultTestCase
python
matplotlib__matplotlib
lib/matplotlib/backends/_backend_pdf_ps.py
{ "start": 2778, "end": 3476 }
class ____: """ Helper for font subsetting by the pdf and ps backends. Maintains a mapping of font paths to the set of character codepoints that are being used from that font. """ def __init__(self): self.used = {} def track(self, font, s): """Record that string *s* is bei...
CharacterTracker
python
matplotlib__matplotlib
galleries/examples/user_interfaces/fourier_demo_wx_sgskip.py
{ "start": 1907, "end": 3176 }
class ____(Knob): def __init__(self, parent, label, param): self.sliderLabel = wx.StaticText(parent, label=label) self.sliderText = wx.TextCtrl(parent, -1, style=wx.TE_PROCESS_ENTER) self.slider = wx.Slider(parent, -1) # self.slider.SetMax(param.maximum*1000) self.slider.SetR...
SliderGroup
python
pennersr__django-allauth
allauth/account/auth_backends.py
{ "start": 348, "end": 4960 }
class ____(ModelBackend): def authenticate(self, request, **credentials): password = credentials.get("password") if not password: return None self._did_check_password = False user = self._authenticate(request, **credentials) if not self._did_check_password: ...
AuthenticationBackend
python
doocs__leetcode
solution/2500-2599/2559.Count Vowel Strings in Ranges/Solution2.py
{ "start": 0, "end": 334 }
class ____: def vowelStrings(self, words: List[str], queries: List[List[int]]) -> List[int]: vowels = set("aeiou") s = list( accumulate( (int(w[0] in vowels and w[-1] in vowels) for w in words), initial=0 ) ) return [s[r + 1] - s[l] for l, r in...
Solution
python
apache__airflow
airflow-ctl/tests/airflow_ctl/api/test_operations.py
{ "start": 3347, "end": 5839 }
class ____: def test_server_connection_refused(self): client = make_api_client(base_url="http://localhost") with pytest.raises( AirflowCtlConnectionException, match="Connection refused. Is the API server running?" ): client.connections.get("1") @pytest.mark.param...
TestBaseOperations
python
openai__openai-python
src/openai/types/fine_tuning/fine_tuning_job_event.py
{ "start": 239, "end": 854 }
class ____(BaseModel): id: str """The object identifier.""" created_at: int """The Unix timestamp (in seconds) for when the fine-tuning job was created.""" level: Literal["info", "warn", "error"] """The log level of the event.""" message: str """The message of the event.""" objec...
FineTuningJobEvent
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/autoVariance3.py
{ "start": 1430, "end": 1725 }
class ____(Generic[T]): def method1(self) -> "ShouldBeCovariant2[T]": ... vco3_1: ShouldBeCovariant3[float] = ShouldBeCovariant3[int]() # This should generate an error based on variance. vco3_2: ShouldBeCovariant3[int] = ShouldBeCovariant3[float]() @dataclass(frozen=True)
ShouldBeCovariant3
python
apache__airflow
providers/google/tests/unit/google/cloud/operators/test_gcs.py
{ "start": 23471, "end": 23889 }
class ____: @mock.patch("airflow.providers.google.cloud.operators.gcs.GCSHook") def test_delete_bucket(self, mock_hook): operator = GCSDeleteBucketOperator(task_id=TASK_ID, bucket_name=TEST_BUCKET) operator.execute(None) mock_hook.return_value.delete_bucket.assert_called_once_with( ...
TestGCSDeleteBucketOperator
python
doocs__leetcode
solution/0600-0699/0644.Maximum Average Subarray II/Solution.py
{ "start": 0, "end": 682 }
class ____: def findMaxAverage(self, nums: List[int], k: int) -> float: def check(v: float) -> bool: s = sum(nums[:k]) - k * v if s >= 0: return True t = mi = 0 for i in range(k, len(nums)): s += nums[i] - v t +=...
Solution
python
allegroai__clearml
clearml/backend_api/services/v2_23/queues.py
{ "start": 31896, "end": 33097 }
class ____(Response): """ Response of queues.delete_metadata endpoint. :param updated: Number of queues updated (0 or 1) :type updated: int """ _service = "queues" _action = "delete_metadata" _version = "2.23" _schema = { "definitions": {}, "properties": { ...
DeleteMetadataResponse
python
django__django
django/db/migrations/writer.py
{ "start": 4527, "end": 11739 }
class ____: """ Take a Migration instance and is able to produce the contents of the migration file from it. """ def __init__(self, migration, include_header=True): self.migration = migration self.include_header = include_header self.needs_manual_porting = False def as_...
MigrationWriter
python
huggingface__transformers
src/transformers/models/vilt/modeling_vilt.py
{ "start": 22052, "end": 28043 }
class ____(ViltPreTrainedModel): def __init__(self, config, add_pooling_layer=True): r""" add_pooling_layer (bool, *optional*, defaults to `True`): Whether to add a pooling layer """ super().__init__(config) self.config = config self.embeddings = ViltEmbe...
ViltModel
python
django__django
tests/field_defaults/tests.py
{ "start": 718, "end": 7731 }
class ____(TestCase): def test_field_defaults(self): a = Article() now = datetime.now() a.save() self.assertIsInstance(a.id, int) self.assertEqual(a.headline, "Default headline") self.assertLess((now - a.pub_date).seconds, 5) @skipUnlessDBFeature("supports_expre...
DefaultTests
python
joke2k__faker
tests/providers/test_color.py
{ "start": 13659, "end": 13970 }
class ____: """Test az_AZ color provider methods""" def test_color_name(self, faker, num_samples): for _ in range(num_samples): color_name = faker.color_name() assert isinstance(color_name, str) assert color_name in AzAzColorProvider.all_colors.keys()
TestAzAz
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/solver24.py
{ "start": 349, "end": 752 }
class ____(Generic[V_co]): def __init__(self, x: ClassA[V_co]): pass def func1(a: ClassA[V], b: ClassA[U], c: bool) -> ClassB[V | U]: x: ClassA[V | U] = a reveal_type(x, expected_text="ClassA[V@func1]") if c: x = b reveal_type(x, expected_text="ClassA[U@func1]") r = ClassB(...
ClassB
python
weaviate__weaviate-python-client
weaviate/collections/classes/config_vector_index.py
{ "start": 8885, "end": 9297 }
class ____: @staticmethod def muvera( ksim: Optional[int] = None, dprojections: Optional[int] = None, repetitions: Optional[int] = None, ) -> _MultiVectorEncodingConfigCreate: return _MuveraConfigCreate( enabled=True, ksim=ksim, dprojection...
_VectorIndexMultivectorEncoding
python
astropy__astropy
astropy/table/column.py
{ "start": 12670, "end": 18720 }
class ____(BaseColumnInfo): """ 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. """ attr_names = BaseColumnInfo.attr_names | {"groups"} _att...
ColumnInfo
python
doocs__leetcode
solution/2200-2299/2212.Maximum Points in an Archery Competition/Solution.py
{ "start": 0, "end": 655 }
class ____: def maximumBobPoints(self, numArrows: int, aliceArrows: List[int]) -> List[int]: st = mx = 0 m = len(aliceArrows) for mask in range(1, 1 << m): cnt = s = 0 for i, x in enumerate(aliceArrows): if mask >> i & 1: s += i ...
Solution
python
Unity-Technologies__ml-agents
ml-agents/mlagents/trainers/poca/trainer.py
{ "start": 1095, "end": 9819 }
class ____(OnPolicyTrainer): """The POCATrainer is an implementation of the MA-POCA algorithm.""" def __init__( self, behavior_name: str, reward_buff_cap: int, trainer_settings: TrainerSettings, training: bool, load: bool, seed: int, artifact_path...
POCATrainer
python
openai__openai-python
src/openai/_types.py
{ "start": 4103, "end": 4899 }
class ____: """ To explicitly omit something from being sent in a request, use `omit`. ```py # as the default `Content-Type` header is `application/json` that will be sent client.post("/upload/files", files={"file": b"my raw file content"}) # you can't explicitly override the header as it has ...
Omit
python
tensorflow__tensorflow
tensorflow/python/framework/test_util_test.py
{ "start": 37994, "end": 40419 }
class ____(test_util.TensorFlowTestCase): def _verify_test_in_set_up_or_tear_down(self): with self.assertRaises(unittest.SkipTest): with test_util.skip_if_error(self, ValueError, ["foo bar", "test message"]): raise ValueError("test message") try: with se...
SkipTestTest
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/pyupgrade/UP037_0.py
{ "start": 570, "end": 1064 }
class ____(TypedDict): E: TypedDict("E", {"foo": "int"}) x: Annotated["str", "metadata"] x: Arg("str", "name") x: DefaultArg("str", "name") x: NamedArg("str", "name") x: DefaultNamedArg("str", "name") x: DefaultNamedArg("str", name="name") x: VarArg("str") x: List[List[List["MyClass"]]] x: NamedTuple("X",...
D
python
numba__numba
numba/tests/doc_examples/test_typed_list_usage.py
{ "start": 214, "end": 2941 }
class ____(unittest.TestCase): def test_ex_inferred_list_jit(self): with captured_stdout(): # magictoken.ex_inferred_list_jit.begin from numba import njit from numba.typed import List @njit def foo(): # Instantiate a typed-list ...
DocsTypedListUsageTest
python
great-expectations__great_expectations
great_expectations/expectations/core/expect_table_row_count_to_equal.py
{ "start": 2277, "end": 11108 }
class ____(BatchExpectation): __doc__ = f"""{EXPECTATION_SHORT_DESCRIPTION} ExpectTableRowCountToEqual is a \ Batch Expectation. BatchExpectations are one of the most common types of Expectation. They are evaluated for an entire Batch, and answer a semantic question about the Batch itself. Ar...
ExpectTableRowCountToEqual
python
apache__airflow
providers/postgres/tests/unit/postgres/hooks/test_postgres.py
{ "start": 29792, "end": 37249 }
class ____: """PostgresHook tests that are specific to psycopg2.""" table = "test_postgres_hook_table" def setup_method(self): self.cur = mock.MagicMock(rowcount=0) self.conn = conn = mock.MagicMock() self.conn.cursor.return_value = self.cur class UnitTestPostgresHook(Post...
TestPostgresHookPPG2
python
scipy__scipy
scipy/stats/tests/test_distributions.py
{ "start": 120673, "end": 126925 }
class ____: def test_cdf(self): for n in [1, 2, 3, 10, 100, 1000]: # Test x-values: # 0, 1/2n, where the cdf should be 0 # 1/n, where the cdf should be n!/n^n # 0.5, where the cdf should match ksone.cdf # 1-1/n, where cdf = 1-2/n^n ...
TestKSTwo
python
google__pytype
pytype/tests/test_dataclasses.py
{ "start": 40727, "end": 43216 }
class ____(test_base.BaseTest): """Tests for pattern matching on dataclasses.""" def test_match(self): self.Check(""" import dataclasses @dataclasses.dataclass class Point: x: float y: float def f(x, y): p = Point(x, y) match p: case Point(x, y)...
TestPatternMatch
python
sympy__sympy
sympy/geometry/point.py
{ "start": 1119, "end": 24955 }
class ____(GeometryEntity): """A point in a n-dimensional Euclidean space. Parameters ========== coords : sequence of n-coordinate values. In the special case where n=2 or 3, a Point2D or Point3D will be created as appropriate. evaluate : if `True` (default), all floats are turn in...
Point
python
pydantic__pydantic
tests/test_deprecated.py
{ "start": 20920, "end": 27242 }
class ____(BaseModel): x: int def test_dict(): m = SimpleModel(x=1) with pytest.warns(PydanticDeprecatedSince20, match=r'^The `dict` method is deprecated; use `model_dump` instead\.'): assert m.dict() == {'x': 1} def test_json(): m = SimpleModel(x=1) with pytest.warns( PydanticDe...
SimpleModel
python
huggingface__transformers
src/transformers/models/swin2sr/modeling_swin2sr.py
{ "start": 3865, "end": 4843 }
class ____(nn.Module): """ Construct the patch and optional position embeddings. """ def __init__(self, config): super().__init__() self.patch_embeddings = Swin2SRPatchEmbeddings(config) num_patches = self.patch_embeddings.num_patches if config.use_absolute_embeddings:...
Swin2SREmbeddings
python
huggingface__transformers
src/transformers/models/ernie4_5/modeling_ernie4_5.py
{ "start": 18653, "end": 21479 }
class ____(Ernie4_5PreTrainedModel, GenerationMixin): _tied_weights_keys = {"lm_head.weight": "model.embed_tokens.weight"} _tp_plan = {"lm_head": "colwise_rep"} _pp_plan = {"lm_head": (["hidden_states"], ["logits"])} def __init__(self, config): super().__init__(config) self.model = Erni...
Ernie4_5ForCausalLM
python
kamyu104__LeetCode-Solutions
Python/maximum-students-taking-exam.py
{ "start": 5469, "end": 7006 }
class ____(object): def maxStudents(self, seats): """ :type seats: List[List[str]] :rtype: int """ directions = [(-1, -1), (0, -1), (1, -1), (-1, 1), (0, 1), (1, 1)] def dfs(seats, e, lookup, matching): i, j = e for dx, dy in directions: ...
Solution2
python
pennersr__django-allauth
allauth/mfa/totp/internal/auth.py
{ "start": 2543, "end": 3642 }
class ____: def __init__(self, instance: Authenticator) -> None: self.instance = instance @classmethod def activate(cls, user, secret: str) -> "TOTP": instance = Authenticator( user=user, type=Authenticator.Type.TOTP, data={"secret": encrypt(secret)} ) instance.s...
TOTP
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/pylint/if_stmt_min_max.py
{ "start": 2970, "end": 4294 }
class ____: _min = 0 _max = 0 def foo(self, value) -> None: if value < self._min: self._min = value if value > self._max: self._max = value if self._min < value: self._min = value if self._max > value: self._max = value ...
Foo
python
encode__django-rest-framework
tests/test_renderers.py
{ "start": 2251, "end": 2421 }
class ____(APIView): renderer_classes = (RendererA, RendererB) def get(self, request, **kwargs): return Response(DUMMYCONTENT, status=DUMMYSTATUS)
MockView
python
spack__spack
var/spack/test_repos/spack_repo/builtin_mock/packages/py_extension3/package.py
{ "start": 216, "end": 857 }
class ____(Package): """Package with a dependency whose presence is conditional to the version of Python being used. """ homepage = "http://www.example.com" url = "http://www.example.com/extension3-1.0.tar.gz" depends_on("python") depends_on("py-extension1", type=("build", "run"), when="^p...
PyExtension3
python
prabhupant__python-ds
data_structures/binary_trees/vertical_traversal.py
{ "start": 349, "end": 1841 }
class ____: def __init__(self, val): self.val = val self.left = None self.right = None self.col = None def print_vertical_util(root, col, d): if not root: return if col in d: d[col].append(root.val) else: d[col] = [root.val] print_vertica...
Node
python
great-expectations__great_expectations
tests/scripts/test_public_api_report.py
{ "start": 5740, "end": 10283 }
class ____: def test_get_all_class_method_and_function_names(self, code_parser: CodeParser): names = code_parser.get_all_class_method_and_function_names() assert names == { "ExampleClass", "ExamplePublicAPIClass", "__init__", "_example_private_method",...
TestCodeParser
python
modin-project__modin
modin/core/execution/ray/common/deferred_execution.py
{ "start": 17381, "end": 18277 }
class ____: """ Meta information, containing the result lengths and the worker address. Parameters ---------- obj : ray.ObjectID or list """ def __init__(self, obj: Union[ray.ObjectID, List]): self._obj = obj def __getitem__(self, index): """ Get item at the sp...
MetaList
python
prompt-toolkit__python-prompt-toolkit
src/prompt_toolkit/layout/controls.py
{ "start": 8046, "end": 16498 }
class ____(UIControl): """ Control that displays formatted text. This can be either plain text, an :class:`~prompt_toolkit.formatted_text.HTML` object an :class:`~prompt_toolkit.formatted_text.ANSI` object, a list of ``(style_str, text)`` tuples or a callable that takes no argument and returns one o...
FormattedTextControl
python
getsentry__sentry
src/sentry/integrations/source_code_management/commit_context.py
{ "start": 2825, "end": 3025 }
class ____: title: str subtitle: str | None url: str affected_users: int | None = None event_count: int | None = None function_name: str | None = None @dataclass
PullRequestIssue
python
PyCQA__pylint
tests/functional/a/arguments_differ.py
{ "start": 1125, "end": 1429 }
class ____(Varargs): def has_kwargs(self, arg): # [arguments-differ] "Not okay to lose capabilities. Also, type has changed." def no_kwargs(self, arg, **kwargs): # [arguments-renamed] "Addition of kwargs does not violate LSP, but first argument's name has changed."
VarargsChild
python
doocs__leetcode
lcci/10.09.Sorted Matrix Search/Solution2.py
{ "start": 0, "end": 427 }
class ____: def searchMatrix(self, matrix: List[List[int]], target: int) -> bool: if not matrix: return False m, n = len(matrix), len(matrix[0]) i, j = m - 1, 0 while i >= 0 and j < n: if matrix[i][j] == target: return True if matri...
Solution
python
PyCQA__pylint
tests/functional/p/protocol_classes_abstract.py
{ "start": 609, "end": 694 }
class ____(FooProtocol, BarProtocol, Protocol): """FooBar Protocol"""
FooBarProtocol
python
pandas-dev__pandas
pandas/tests/indexes/datetimelike_/test_drop_duplicates.py
{ "start": 1906, "end": 2411 }
class ____(DropDuplicates): @pytest.fixture(params=["D", "3D", "h", "2h", "min", "2min", "s", "3s"]) def freq(self, request): """ Fixture to test for different frequencies for PeriodIndex. """ return request.param @pytest.fixture def idx(self, freq): """ ...
TestDropDuplicatesPeriodIndex
python
airbytehq__airbyte
airbyte-integrations/connectors/destination-pgvector/unit_tests/destination_test.py
{ "start": 370, "end": 2954 }
class ____(unittest.TestCase): def setUp(self): self.config = { "processing": {"text_fields": ["str_col"], "metadata_fields": [], "chunk_size": 1000}, "embedding": {"mode": "openai", "openai_key": "mykey"}, "indexing": { "host": "MYACCOUNT", ...
TestDestinationPGVector
python
django__django
tests/admin_default_site/tests.py
{ "start": 906, "end": 1230 }
class ____(SimpleTestCase): def test_use_default_admin_site(self): self.assertEqual(admin.site.__class__.__name__, "AdminSite") def test_repr(self): self.assertEqual(str(admin.site), "AdminSite(name='admin')") self.assertEqual(repr(admin.site), "AdminSite(name='admin')")
DefaultAdminSiteTests
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/roots/mutation.py
{ "start": 8031, "end": 8321 }
class ____(graphene.ObjectType): """Output indicating that a run was terminated.""" run = graphene.Field(graphene.NonNull(GrapheneRun)) class Meta: interfaces = (GrapheneTerminatePipelineExecutionSuccess,) name = "TerminateRunSuccess"
GrapheneTerminateRunSuccess
python
apache__airflow
airflow-core/src/airflow/api_fastapi/core_api/base.py
{ "start": 1583, "end": 1939 }
class ____(Generic[T], ABC): """ Base class for filtering clauses with paginated_select. The subclasses should implement the `to_orm` method and set the `value` attribute. """ def __init__(self, value: T | None = None): self.value = value @abstractmethod def to_orm(self, select: S...
OrmClause
python
kamyu104__LeetCode-Solutions
Python/bitwise-xor-of-all-pairings.py
{ "start": 66, "end": 376 }
class ____(object): def xorAllNums(self, nums1, nums2): """ :type nums1: List[int] :type nums2: List[int] :rtype: int """ return (reduce(operator.xor, nums1) if len(nums2)%2 else 0) ^ \ (reduce(operator.xor, nums2) if len(nums1)%2 else 0)
Solution
python
scipy__scipy
benchmarks/benchmarks/go_benchmark_functions/go_funcs_T.py
{ "start": 3261, "end": 4310 }
class ____(Benchmark): r""" Treccani objective function. This class defines the Treccani [1]_ global optimization problem. This is a multimodal minimization problem defined as follows: .. math:: f_{\text{Treccani}}(x) = x_1^4 + 4x_1^3 + 4x_1^2 + x_2^2 with :math:`x_i \in [-5, 5...
Treccani
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 242777, "end": 243320 }
class ____(sgqlc.types.Input): """Ways in which lists of issue comments can be ordered upon return.""" __schema__ = github_schema __field_names__ = ("field", "direction") field = sgqlc.types.Field(sgqlc.types.non_null(IssueCommentOrderField), graphql_name="field") """The field in which to order iss...
IssueCommentOrder
python
google__flatbuffers
python/flatbuffers/reflection/KeyValue.py
{ "start": 179, "end": 1952 }
class ____(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset=0): n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) x = KeyValue() x.Init(buf, n + offset) return x @classmethod def GetRootAsKeyValue(cls, buf, offset=0): ...
KeyValue
python
doocs__leetcode
solution/0800-0899/0824.Goat Latin/Solution.py
{ "start": 0, "end": 358 }
class ____: def toGoatLatin(self, sentence: str) -> str: ans = [] for i, word in enumerate(sentence.split()): if word.lower()[0] not in ['a', 'e', 'i', 'o', 'u']: word = word[1:] + word[0] word += 'ma' word += 'a' * (i + 1) ans.append(w...
Solution
python
django-debug-toolbar__django-debug-toolbar
debug_toolbar/panels/sql/utils.py
{ "start": 1815, "end": 2714 }
class ____: """sqlparse filter to bold SQL keywords""" def process(self, stmt): idx = 0 while idx < len(stmt.tokens): token = stmt[idx] if token.is_keyword: stmt.insert_before(idx, sqlparse.sql.Token(T.Other, "<strong>")) stmt.insert_after...
BoldKeywordFilter
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/assignment10.py
{ "start": 168, "end": 425 }
class ____: instance: "A | None" def __init__(self) -> None: self.foo: bool @classmethod def method1(cls) -> bool: if cls.instance is None: cls.instance = cls() return cls.instance.foo T = TypeVar("T")
A
python
sphinx-doc__sphinx
tests/roots/test-ext-autodoc/target/inheritance.py
{ "start": 318, "end": 435 }
class ____: #: docstring def another_inheritedmeth(self): """Another inherited function."""
AnotherBase
python
python-pillow__Pillow
src/PIL/PdfParser.py
{ "start": 7588, "end": 7719 }
class ____(list[Any]): def __bytes__(self) -> bytes: return b"[ " + b" ".join(pdf_repr(x) for x in self) + b" ]"
PdfArray
python
facebook__pyre-check
scripts/callgraph_utilities.py
{ "start": 2739, "end": 4536 }
class ____(InputFormat): def __init__(self, call_graph: JSON) -> None: self.original_call_graph = self.validate_top_level_dict(call_graph) if "response" in self.original_call_graph: response = self.original_call_graph["response"] if not isinstance(response, dict): ...
PyreCallGraphInputFormat
python
donnemartin__system-design-primer
solutions/object_oriented_design/online_chat/online_chat.py
{ "start": 2089, "end": 2353 }
class ____(object): def __init__(self, from_user_id, to_user_id, request_status, timestamp): self.from_user_id = from_user_id self.to_user_id = to_user_id self.request_status = request_status self.timestamp = timestamp
AddRequest
python
apache__airflow
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/operators/job.py
{ "start": 2297, "end": 20304 }
class ____(KubernetesPodOperator): """ Executes a Kubernetes Job. .. seealso:: For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:KubernetesJobOperator` .. note:: If you use `Google Kubernetes Engine <https://cloud.google.com/kubern...
KubernetesJobOperator
python
huggingface__transformers
tests/models/sam_hq/test_processing_sam_hq.py
{ "start": 1067, "end": 5872 }
class ____(ProcessorTesterMixin, unittest.TestCase): processor_class = SamHQProcessor def prepare_image_inputs(self): """This function prepares a list of PIL images.""" return prepare_image_inputs() def prepare_mask_inputs(self): """This function prepares a list of PIL images, or a...
SamHQProcessorTest
python
bokeh__bokeh
src/bokeh/server/views/doc_handler.py
{ "start": 1591, "end": 2618 }
class ____(SessionHandler): ''' Implements a custom Tornado handler for document display page ''' @authenticated async def get(self, *args, **kwargs): session = await self.get_session() page = server_html_page_for_session(session, resources=s...
DocHandler
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/super2.py
{ "start": 1529, "end": 1614 }
class ____: def __new__(cls) -> "E": return super(type, cls).__new__(cls)
E
python
PyCQA__pylint
tests/functional/ext/docparams/return/missing_return_doc_Sphinx.py
{ "start": 1598, "end": 1918 }
class ____: """test_ignores_return_in_abstract_method_sphinx Example of an abstract method documenting the return type that an implementation should return. """ @abc.abstractmethod def foo(self): """docstring ... :returns: Ten :rtype: int """ return 10 ...
Foo
python
crytic__slither
slither/slithir/variables/tuple.py
{ "start": 171, "end": 881 }
class ____(SlithIRVariable): def __init__(self, node: "Node", index: Optional[int] = None) -> None: super().__init__() if index is None: self._index = node.compilation_unit.counter_slithir_tuple node.compilation_unit.counter_slithir_tuple += 1 else: self._...
TupleVariable
python
django__django
tests/template_tests/filter_tests/test_floatformat.py
{ "start": 287, "end": 1006 }
class ____(SimpleTestCase): @setup( { "floatformat01": ( "{% autoescape off %}{{ a|floatformat }} {{ b|floatformat }}" "{% endautoescape %}" ) } ) def test_floatformat01(self): output = self.engine.render_to_string( ...
FloatformatTests
python
graphql-python__graphene
graphene/types/decimal.py
{ "start": 165, "end": 861 }
class ____(Scalar): """ The `Decimal` scalar type represents a python Decimal. """ @staticmethod def serialize(dec): if isinstance(dec, str): dec = _Decimal(dec) assert isinstance( dec, _Decimal ), f'Received not compatible Decimal "{repr(dec)}"' ...
Decimal
python
doocs__leetcode
solution/2100-2199/2163.Minimum Difference in Sums After Removal of Elements/Solution.py
{ "start": 0, "end": 677 }
class ____: def minimumDifference(self, nums: List[int]) -> int: m = len(nums) n = m // 3 s = 0 pre = [0] * (m + 1) q1 = [] for i, x in enumerate(nums[: n * 2], 1): s += x heappush(q1, -x) if len(q1) > n: s -= -heap...
Solution
python
readthedocs__readthedocs.org
readthedocs/api/v2/serializers.py
{ "start": 7778, "end": 9247 }
class ____(serializers.ModelSerializer): """ Build serializer for user display. This is the default serializer for Build objects over read-only operations from regular users. Take into account that: - It doesn't display internal fields (builder, _config) - It's read-only for multiple fields (c...
BuildSerializer
python
has2k1__plotnine
plotnine/themes/themeable.py
{ "start": 35760, "end": 36705 }
class ____(MixinSequenceOfValues): """ y-axis major tick lines Parameters ---------- theme_element : element_line """ def apply_ax(self, ax: Axes): super().apply_ax(ax) params = ax.yaxis.get_tick_params(which="major") if not params.get("left", False): re...
axis_ticks_major_y
python
django__django
tests/forms_tests/tests/test_formsets.py
{ "start": 864, "end": 1011 }
class ____(ChoiceFormSet): def clean(self): super().clean() raise ValidationError("non-form error")
ChoiceFormsetWithNonFormError
python
huggingface__transformers
tests/models/vitpose/test_modeling_vitpose.py
{ "start": 4948, "end": 8326 }
class ____(ModelTesterMixin, unittest.TestCase): """ Here we also overwrite some of the tests of test_modeling_common.py, as VitPose does not use input_ids, inputs_embeds, attention_mask and seq_length. """ all_model_classes = (VitPoseForPoseEstimation,) if is_torch_available() else () test_re...
VitPoseModelTest
python
apache__airflow
providers/amazon/src/airflow/providers/amazon/aws/triggers/bedrock.py
{ "start": 1182, "end": 2533 }
class ____(AwsBaseWaiterTrigger): """ Trigger when a Bedrock model customization job is complete. :param job_name: The name of the Bedrock model customization job. :param waiter_delay: The amount of time in seconds to wait between attempts. (default: 120) :param waiter_max_attempts: The maximum num...
BedrockCustomizeModelCompletedTrigger
python
streamlit__streamlit
lib/tests/streamlit/commands/logo_test.py
{ "start": 951, "end": 4556 }
class ____(DeltaGeneratorTestCase): """Test st.logo""" def test_image(self): """Test that it can be called with image param only.""" streamlit = Image.open( str(pathlib.Path(__file__).parent / "full-streamlit.png") ) st.logo(streamlit) c = self.get_message_f...
LogoTest
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 221846, "end": 222457 }
class ____(sgqlc.types.relay.Connection): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("edges", "nodes", "page_info", "total_count") edges = sgqlc.types.Field( sgqlc.types.list_of("CheckStepEdge"), graphql_name="edges" ) nodes = sgqlc.typ...
CheckStepConnection
python
wandb__wandb
wandb/sdk/data_types/base_types/media.py
{ "start": 1347, "end": 11018 }
class ____(WBValue): """A WBValue stored as a file outside JSON that can be rendered in a media panel. If necessary, we move or copy the file into the Run's media directory so that it gets uploaded. """ _path: Optional[str] _run: Optional["wandb.Run"] _caption: Optional[str] _is_tmp: O...
Media