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
joke2k__faker
faker/providers/date_time/hu_HU/__init__.py
{ "start": 46, "end": 881 }
class ____(DateTimeProvider): def day_of_week(self) -> str: day = self.date("%w") DAY_NAMES = { "0": "hétfő", "1": "kedd", "2": "szerda", "3": "csütörtök", "4": "péntek", "5": "szombat", "6": "vasárnap", } ...
Provider
python
ethereum__web3.py
web3/_utils/events.py
{ "start": 15820, "end": 16698 }
class ____(BaseArgumentFilter): def __init__(self, arg_type: TypeStr, abi_codec: ABICodec) -> None: self.abi_codec = abi_codec self.arg_type = arg_type @to_tuple def _get_match_values(self) -> Iterable[HexStr]: yield from (self._encode(value) for value in self._match_values) # ...
TopicArgumentFilter
python
huggingface__transformers
src/transformers/models/prompt_depth_anything/modeling_prompt_depth_anything.py
{ "start": 10548, "end": 12349 }
class ____(nn.Module): """ This class reassembles the hidden states of the backbone into image-like feature representations at various resolutions. This happens in 3 stages: 1. Take the patch embeddings and reshape them to image-like feature representations. 2. Project the channel dimension of ...
PromptDepthAnythingReassembleStage
python
huggingface__transformers
src/transformers/models/hunyuan_v1_dense/modeling_hunyuan_v1_dense.py
{ "start": 7077, "end": 10513 }
class ____(nn.Module): """Multi-headed attention from 'Attention Is All You Need' paper""" def __init__(self, config: HunYuanDenseV1Config, layer_idx: int): super().__init__() self.config = config self.layer_idx = layer_idx self.head_dim = getattr(config, "head_dim", config.hidd...
HunYuanDenseV1Attention
python
pytorch__pytorch
torch/_dynamo/variables/ctx_manager.py
{ "start": 30117, "end": 31774 }
class ____(ContextWrappingVariable): """represents torch.{are_deterministic_algorithms_enabled,use_deterministic_algorithms}()""" _guards_singleton = Guard( GlobalStateSource(), GuardBuilder.DETERMINISTIC_ALGORITHMS, # type: ignore[arg-type] ) @staticmethod def create( tx:...
DeterministicAlgorithmsVariable
python
doocs__leetcode
solution/3200-3299/3287.Find the Maximum Sequence Value of Array/Solution.py
{ "start": 0, "end": 1003 }
class ____: def maxValue(self, nums: List[int], k: int) -> int: m = 1 << 7 n = len(nums) f = [[[False] * m for _ in range(k + 2)] for _ in range(n + 1)] f[0][0][0] = True for i in range(n): for j in range(k + 1): for x in range(m): ...
Solution
python
openai__gym
gym/utils/play.py
{ "start": 956, "end": 11005 }
class ____: """Wraps an environment allowing keyboard inputs to interact with the environment.""" def __init__( self, env: Env, keys_to_action: Optional[Dict[Tuple[int, ...], int]] = None, zoom: Optional[float] = None, ): """Wraps an environment with a dictionary of ...
PlayableGame
python
pandas-dev__pandas
asv_bench/benchmarks/libs.py
{ "start": 1038, "end": 1540 }
class ____: def setup(self): N = 10000 K = 10 key1 = Index([f"i-{i}" for i in range(N)], dtype=object).values.repeat(K) key2 = Index([f"i-{i}" for i in range(N)], dtype=object).values.repeat(K) col_array = np.vstack([key1, key2, np.random.randn(N * K)]) col_array2 = c...
FastZip
python
pytorch__pytorch
test/torch_np/numpy_tests/linalg/test_linalg.py
{ "start": 14029, "end": 16408 }
class ____(SolveCases, TestCase): @parametrize("dtype", [single, double, csingle, cdouble]) def test_types(self, dtype): x = np.array([[1, 0.5], [0.5, 1]], dtype=dtype) assert_equal(linalg.solve(x, x).dtype, dtype) @skip(reason="subclass") def test_0_size(self): class ArraySubcl...
TestSolve
python
pytorch__pytorch
torch/_dynamo/variables/nn_module.py
{ "start": 55075, "end": 56338 }
class ____(UnspecializedNNModuleVariable): """ Tracing behavior: trace into submodules and treat them as Unspecialized, do not register parameters to the top-level, treat them as function inputs. Guards behavior: if 'skip_fsdp_guards', many guards that would be installed by a vanilla UnspecializedN...
FSDPManagedNNModuleVariable
python
bokeh__bokeh
src/bokeh/embed/bundle.py
{ "start": 7879, "end": 15315 }
class ____(TypedDict): name: NotRequired[str] version: NotRequired[str] module: NotRequired[str] main: NotRequired[str] _default_cdn_host = URL("https://unpkg.com") extension_dirs: dict[str, Path] = {} def _bundle_extensions(objs: set[HasProps] | None, resources: Resources) -> list[ExtensionEmbed]: ...
Pkg
python
urllib3__urllib3
test/with_dummyserver/test_https.py
{ "start": 52278, "end": 52913 }
class ____: @pytest.mark.parametrize("host", ["::1", "[::1]"]) def test_can_validate_ipv6_san( self, ipv6_san_server: ServerConfig, host: str, http_version: str ) -> None: """Ensure that urllib3 can validate SANs with IPv6 addresses in them.""" with HTTPSConnectionPool( h...
TestHTTPS_IPV6SAN
python
pennersr__django-allauth
allauth/socialaccount/providers/eveonline/provider.py
{ "start": 285, "end": 1054 }
class ____(ProviderAccount): def get_profile_url(self): return "https://gate.eveonline.com/Profile/{char_name}".format( char_name=self.account.extra_data.get("CharacterName") ) def get_avatar_url(self): return ("https://image.eveonline.com/Character/{char_id}_128.jpg").forma...
EveOnlineAccount
python
getsentry__sentry
src/sentry/integrations/slack/message_builder/image_block_builder.py
{ "start": 617, "end": 1185 }
class ____(BlockSlackMessageBuilder, IssueAlertImageBuilder): def __init__(self, group: Group) -> None: super().__init__( group=group, provider=ExternalProviderEnum.SLACK, ) def build_image_block(self) -> SlackBlock | None: image_url = self.get_image_url() ...
ImageBlockBuilder
python
sqlalchemy__sqlalchemy
test/orm/test_cascade.py
{ "start": 91880, "end": 96518 }
class ____(fixtures.MappedTest): """Test orphan behavior on an entity that requires two parents via many-to-one (one-to-many collection.). """ @classmethod def define_tables(cls, meta): Table( "sales_reps", meta, Column( "sales_rep_id", ...
DoubleParentO2MOrphanTest
python
facelessuser__pymdown-extensions
tests/test_extensions/test_inlinehilite.py
{ "start": 15614, "end": 16566 }
class ____(util.MdCase): """Test custom InlineHilite cases.""" extension = [ 'pymdownx.highlight', 'pymdownx.inlinehilite', ] extension_configs = { 'pymdownx.inlinehilite': { 'css_class': 'inlinehilite', 'custom_inline': [ { ...
TestInlineHiliteCustom5
python
jazzband__django-oauth-toolkit
tests/test_oauth2_backends.py
{ "start": 5591, "end": 6622 }
class ____(TestCase): """ Tests that the public API behaves as expected when we override the OAuthLibCoreBackend core methods. """ class MyOAuthLibCore(OAuthLibCore): def _get_extra_credentials(self, request): return 1 factory = RequestFactory() def test_create_token_r...
TestCustomOAuthLibCoreBackend
python
getsentry__sentry
src/sentry/utils/codecs.py
{ "start": 1402, "end": 1805 }
class ____(Codec[str, bytes]): """ Encode/decode strings to/from bytes using the encoding provided to the constructor. """ def __init__(self, encoding: str = "utf8"): self.encoding = encoding def encode(self, value: str) -> bytes: return value.encode(self.encoding) def dec...
BytesCodec
python
django__django
tests/modeladmin/test_checks.py
{ "start": 8832, "end": 9983 }
class ____(CheckTestCase): def test_invalid_type(self): class FakeForm: pass class TestModelAdmin(ModelAdmin): form = FakeForm class TestModelAdminWithNoForm(ModelAdmin): form = "not a form" for model_admin in (TestModelAdmin, TestModelAdminWith...
FormCheckTests
python
gwtw__py-sorting
test/bucket_sort_test.py
{ "start": 279, "end": 518 }
class ____(unittest.TestCase, BasePositiveIntegerSortTest, BaseNegativeIntegerSortTest): def setUp(self): self.sort = bucket_sort.sort if __name__ == '__main__': unittest.main()
BucketSortTest
python
scipy__scipy
benchmarks/benchmarks/go_benchmark_functions/go_funcs_S.py
{ "start": 33503, "end": 34578 }
class ____(Benchmark): r""" Sphere objective function. This class defines the Sphere [1]_ global optimization problem. This is a multimodal minimization problem defined as follows: .. math:: f_{\text{Sphere}}(x) = \sum_{i=1}^{n} x_i^2 Here, :math:`n` represents the number of dimensi...
Sphere
python
allegroai__clearml
clearml/backend_api/services/v2_23/tasks.py
{ "start": 439784, "end": 441283 }
class ____(Response): """ Response of tasks.get_configuration_names endpoint. :param configurations: Names of task configuration items (keyed by task ID) :type configurations: dict """ _service = "tasks" _action = "get_configuration_names" _version = "2.23" _schema = { "de...
GetConfigurationNamesResponse
python
readthedocs__readthedocs.org
readthedocs/api/v2/views/core_views.py
{ "start": 597, "end": 2271 }
class ____(APIView): """ Revoke a build API key. This is done by hitting the /api/v2/revoke/ endpoint with a POST request, while using the API key to be revoked as the authorization key. """ http_method_names = ["post"] permission_classes = [HasBuildAPIKey] renderer_classes = [JSONRend...
RevokeBuildAPIKeyView
python
keon__algorithms
tests/test_dp.py
{ "start": 4310, "end": 4544 }
class ____(unittest.TestCase): def test_longest_increasing_subsequence(self): sequence = [1, 101, 10, 2, 3, 100, 4, 6, 2] self.assertEqual(5, longest_increasing_subsequence(sequence))
TestLongestIncreasingSubsequence
python
gevent__gevent
src/greentest/3.9/test_socket.py
{ "start": 7535, "end": 11128 }
class ____: """Threadable Test class The ThreadableTest class makes it easy to create a threaded client/server pair from an existing unit test. To create a new threaded class from an existing unit test, use multiple inheritance: class NewClass (OldClass, ThreadableTest): pass ...
ThreadableTest
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_format20.py
{ "start": 315, "end": 1341 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("format20.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file with automatic color.""" workbook = W...
TestCompareXLSXFiles
python
readthedocs__readthedocs.org
readthedocs/projects/migrations/0080_historicalproject.py
{ "start": 320, "end": 27682 }
class ____(migrations.Migration): safe = Safe.after_deploy() dependencies = [ ("oauth", "0014_remove_remoterepository_project"), migrations.swappable_dependency(settings.AUTH_USER_MODEL), ("projects", "0079_httpheader"), ] operations = [ migrations.CreateModel( ...
Migration
python
OmkarPathak__pygorithm
tests/test_sorting.py
{ "start": 4555, "end": 4751 }
class ____(unittest.TestCase, TestSortingAlgorithm): inplace = True alph_support = True @staticmethod def sort(arr): return cocktail_sort.cocktail_sort(arr)
TestCocktailSort
python
spyder-ide__spyder
spyder/plugins/editor/utils/kill_ring.py
{ "start": 1819, "end": 4239 }
class ____(QObject): """ A kill ring attached to Q[Plain]TextEdit. """ # ------------------------------------------------------------------------- # QtKillRing interface # ------------------------------------------------------------------------- def __init__(self, text_edit): """ Creat...
QtKillRing
python
jazzband__tablib
tests/test_tablib.py
{ "start": 67870, "end": 70636 }
class ____(unittest.TestCase): def test_sql_date_and_timestamp_literals(self): # ANSI SQL date and timestamp literals ds = tablib.Dataset(title='tbl') ds.headers = ['col_date', 'col_timestamp'] ds.append([ dt.date(2020, 1, 2), dt.datetime(2020, 1, 2, 3, 4, 5) ...
SQLFormatTests
python
PrefectHQ__prefect
tests/server/models/test_artifacts.py
{ "start": 25163, "end": 29494 }
class ____: @pytest.fixture async def artifacts( self, session, ): # Create several artifacts with the same key artifact1_schema = schemas.core.Artifact( key="test-key-1", data="my important data", description="Info about the artifact", ...
TestDeleteArtifacts
python
keras-team__keras
keras/src/layers/attention/grouped_query_attention_test.py
{ "start": 384, "end": 15495 }
class ____(testing.TestCase): def setUp(self): super().setUp() # Flash attention is a newly introduced feature. We need to disable it # for testing purposes. disable_flash_attention() def tearDown(self): enable_flash_attention() return super().tearDown() def...
GroupedQueryAttentionTest
python
huggingface__transformers
src/transformers/models/blip/modeling_blip.py
{ "start": 21847, "end": 31758 }
class ____(BlipPreTrainedModel): config: BlipConfig def __init__(self, config: BlipConfig): super().__init__(config) if not isinstance(config.text_config, BlipTextConfig): raise TypeError( "config.text_config is expected to be of type BlipTextConfig but is of type" ...
BlipModel
python
Textualize__rich
tests/test_repr.py
{ "start": 1019, "end": 1222 }
class ____(Foo): def __rich_repr__(self): yield (self.foo,) yield None, self.foo, yield "bar", self.bar, None yield "egg", self.egg __rich_repr__.angular = True
Bar
python
ethereum__web3.py
tests/integration/go_ethereum/common.py
{ "start": 636, "end": 794 }
class ____(Web3ModuleTest): def _check_web3_client_version(self, client_version): assert client_version.startswith("Geth/")
GoEthereumWeb3ModuleTest
python
wandb__wandb
wandb/sdk/internal/job_builder.py
{ "start": 3246, "end": 23470 }
class ____: _settings: SettingsStatic _files_dir: str _metadatafile_path: Optional[str] _requirements_path: Optional[str] _config: Optional[Dict[str, Any]] _summary: Optional[Dict[str, Any]] _logged_code_artifact: Optional[ArtifactInfoForJob] _disable: bool _partial_source_id: Option...
JobBuilder
python
mlflow__mlflow
mlflow/genai/judges/optimizers/dspy.py
{ "start": 1211, "end": 8897 }
class ____(AlignmentOptimizer): """ Abstract base class for DSPy-based alignment optimizers. Provides common functionality for converting MLflow traces to DSPy examples and handling DSPy program compilation. """ _logger: logging.Logger _model: str _MINIMUM_TRACES_REQUIRED_FOR_OPTIMIZA...
DSPyAlignmentOptimizer
python
airbytehq__airbyte
airbyte-integrations/connectors/source-intercom/components.py
{ "start": 7045, "end": 9003 }
class ____(StateMigration): """ We require a custom state migration to move from the custom substream state that was generated via the legacy cursor custom components. State was not written back to the platform in a way that is compatible with concurrent cursors. The old state roughly had the following...
SubstreamStateMigration
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_chart_data_labels06.py
{ "start": 315, "end": 1709 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("chart_data_labels06.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file.""" workbook = Workbook(se...
TestCompareXLSXFiles
python
wandb__wandb
wandb/integration/keras/keras.py
{ "start": 9074, "end": 44213 }
class ____(tf.keras.callbacks.Callback): """`WandbCallback` automatically integrates keras with wandb. Example: ```python model.fit( X_train, y_train, validation_data=(X_test, y_test), callbacks=[WandbCallback()], ) ``` `Wandb...
WandbCallback
python
tensorflow__tensorflow
tensorflow/python/eager/run_eager_op_as_function_test.py
{ "start": 8612, "end": 10367 }
class ____(test.TestCase): @test_util.enable_eager_op_as_function def testSimpleGraphExecutesSynchronously(self): if context.num_gpus(): self.skipTest("CPU-only test (requires unpartitioned graph).") default_executor = test_util.TestDelta("flr_executor", "default") single_threaded = test_util.Te...
RunEagerOpAsFunctionInternalsTest
python
pyodide__pyodide
src/py/pyodide/webloop.py
{ "start": 5219, "end": 5750 }
class ____(Task[T], PyodideFuture[T]): """Inherits from both :py:class:`~asyncio.Task` and :py:class:`~pyodide.webloop.PyodideFuture` Instantiation is discouraged unless you are writing your own event loop. """ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) ...
PyodideTask
python
astropy__astropy
astropy/coordinates/angles/core.py
{ "start": 24340, "end": 24468 }
class ____(u.QuantityInfo): _represent_as_dict_attrs = u.QuantityInfo._represent_as_dict_attrs + ("wrap_angle",)
LongitudeInfo
python
huggingface__transformers
src/transformers/models/xlm_roberta/modeling_xlm_roberta.py
{ "start": 16041, "end": 16735 }
class ____(nn.Module): """XLMRoberta Head for masked language modeling.""" def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) self.layer_norm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps) self.decoder = ...
XLMRobertaLMHead
python
getsentry__sentry
src/sentry/api/endpoints/api_tokens.py
{ "start": 1218, "end": 2553 }
class ____(serializers.Serializer): name = CharField(max_length=255, allow_blank=True, required=False) scopes = serializers.MultipleChoiceField(required=True, choices=list(settings.SENTRY_SCOPES)) def get_appropriate_user_id(request: Request) -> int: """ Gets the user id to use for the request, based ...
ApiTokenSerializer
python
run-llama__llama_index
llama-index-instrumentation/src/llama_index_instrumentation/span/base.py
{ "start": 115, "end": 466 }
class ____(BaseModel): """Base data class representing a span.""" model_config = ConfigDict(arbitrary_types_allowed=True) id_: str = Field(default_factory=lambda: str(uuid4()), description="Id of span.") parent_id: Optional[str] = Field(default=None, description="Id of parent span.") tags: Dict[str...
BaseSpan
python
spyder-ide__spyder
spyder/widgets/github/gh_login.py
{ "start": 918, "end": 5990 }
class ____(QDialog): """Dialog to submit error reports to Github.""" def __init__(self, parent, token, remember_token=False): QDialog.__init__(self, parent) title = _("Sign in to Github") self.resize(415, 375) self.setWindowTitle(title) self.setWindowFlags( ...
DlgGitHubLogin
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/sql/sqltypes.py
{ "start": 122557, "end": 122646 }
class ____(String): """The SQL VARCHAR type.""" __visit_name__ = "VARCHAR"
VARCHAR
python
apache__airflow
providers/microsoft/azure/src/airflow/providers/microsoft/azure/hooks/powerbi.py
{ "start": 1648, "end": 1797 }
class ____(AirflowException): """An exception that indicates a failure in getting the list of groups (workspaces)."""
PowerBIWorkspaceListException
python
numpy__numpy
numpy/_core/tests/test_deprecations.py
{ "start": 5425, "end": 5718 }
class ____(_DeprecationTestCase): # 2024-07-29, 2.1.0 @pytest.mark.parametrize('badlist', [[0.5, 1.2, 1.5], ['0', '1', '1']]) def test_bincount_bad_list(self, badlist): self.assert_deprecated(lambda: np.bincount(badlist))
TestBincount
python
getsentry__sentry
tests/sentry/integrations/msteams/webhook/test_ms_teams_webhook_parsing.py
{ "start": 112, "end": 1689 }
class ____: def test_valid_new_installation_event(self) -> None: data: dict[str, Any] = {"type": "installationUpdate", "action": "add"} assert is_new_integration_installation_event(data) is True def test_valid_non_installation_event(self) -> None: data: dict[str, Any] = {"type": "messag...
TestIsNewIntegrationInstallationEvent
python
Textualize__textual
docs/examples/guide/content/renderables.py
{ "start": 163, "end": 538 }
class ____(Widget): """Widget to display Python code.""" DEFAULT_CSS = """ CodeView { height: auto; } """ code = reactive("") def render(self) -> RenderResult: # Syntax is a Rich renderable that displays syntax highlighted code syntax = Syntax(self.code, "python", line_numbers...
CodeView
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/sql/_util_cy.py
{ "start": 1287, "end": 2217 }
class ____(Dict[str, str]): """A map that creates new keys for missing key access. Considers keys of the form "<ident> <name>" to produce new symbols "<name>_<index>", where "index" is an incrementing integer corresponding to <name>. Inlines the approach taken by :class:`sqlalchemy.util.PopulateDi...
prefix_anon_map
python
jazzband__pip-tools
piptools/exceptions.py
{ "start": 368, "end": 2199 }
class ____(PipToolsError): def __init__( self, ireq: InstallRequirement, candidates_tried: Iterable[InstallationCandidate], finder: PackageFinder, ) -> None: self.ireq = ireq self.candidates_tried = candidates_tried self.finder = finder def __str__(se...
NoCandidateFound
python
matplotlib__matplotlib
lib/matplotlib/offsetbox.py
{ "start": 40181, "end": 49512 }
class ____(martist.Artist, mtext._AnnotationBase): """ Container for an `OffsetBox` referring to a specific position *xy*. Optionally an arrow pointing from the offsetbox to *xy* can be drawn. This is like `.Annotation`, but with `OffsetBox` instead of `.Text`. """ zorder = 3 def __str__...
AnnotationBbox
python
FactoryBoy__factory_boy
factory/declarations.py
{ "start": 5065, "end": 5982 }
class ____: pass def deepgetattr(obj, name, default=_UNSPECIFIED): """Try to retrieve the given attribute of an object, digging on '.'. This is an extended getattr, digging deeper if '.' is found. Args: obj (object): the object of which an attribute should be read name (str): the nam...
_UNSPECIFIED
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 10357, "end": 10526 }
class ____(sgqlc.types.Enum): """ See source code for more info. """ __schema__ = graphql_schema __choices__ = ("ALL", "PUBLIC", "SECRET")
GistPrivacy
python
wandb__wandb
wandb/apis/attrs.py
{ "start": 122, "end": 1472 }
class ____: def __init__(self, attrs: MutableMapping[str, Any]): self._attrs = attrs def snake_to_camel(self, string): camel = "".join([i.title() for i in string.split("_")]) return camel[0].lower() + camel[1:] def display(self, height=420, hidden=False) -> bool: """Display...
Attrs
python
keras-team__keras
keras/src/ops/numpy.py
{ "start": 135644, "end": 136660 }
class ____(Operation): def call(self, x1, x2): return backend.numpy.logaddexp(x1, x2) def compute_output_spec(self, x1, x2): x1_shape = getattr(x1, "shape", []) x2_shape = getattr(x2, "shape", []) output_shape = broadcast_shapes(x1_shape, x2_shape) dtype = dtypes.result_...
Logaddexp
python
ansible__ansible
test/lib/ansible_test/_internal/host_configs.py
{ "start": 8910, "end": 11286 }
class ____(ControllerHostConfig, PosixConfig): """Configuration for a docker host.""" name: t.Optional[str] = None image: t.Optional[str] = None memory: t.Optional[int] = None privileged: t.Optional[bool] = None seccomp: t.Optional[str] = None cgroup: t.Optional[CGroupVersion] = None au...
DockerConfig
python
openai__openai-python
src/openai/types/batch_error.py
{ "start": 176, "end": 622 }
class ____(BaseModel): code: Optional[str] = None """An error code identifying the error type.""" line: Optional[int] = None """The line number of the input file where the error occurred, if applicable.""" message: Optional[str] = None """A human-readable message providing more details about t...
BatchError
python
anthropics__anthropic-sdk-python
src/anthropic/types/beta/beta_text_editor_code_execution_create_result_block_param.py
{ "start": 249, "end": 438 }
class ____(TypedDict, total=False): is_file_update: Required[bool] type: Required[Literal["text_editor_code_execution_create_result"]]
BetaTextEditorCodeExecutionCreateResultBlockParam
python
kamyu104__LeetCode-Solutions
Python/consecutive-characters.py
{ "start": 29, "end": 423 }
class ____(object): def maxPower(self, s): """ :type s: str :rtype: int """ result, count = 1, 1 for i in xrange(1, len(s)): if s[i] == s[i-1]: count += 1 else: count = 1 result = max(result, count) ...
Solution
python
google__pytype
pytype/pytd/visitors.py
{ "start": 34996, "end": 35908 }
class ____(Visitor): """Visitor for converting ClassTypes called ~unknown* to just AnythingType. For example, this will change def f(x: ~unknown1) -> ~unknown2 class ~unknown1: ... class ~unknown2: ... to def f(x) -> Any """ def __init__(self): super().__init__() self.par...
RemoveUnknownClasses
python
weaviate__weaviate-python-client
weaviate/collections/classes/internal.py
{ "start": 2748, "end": 2983 }
class ____: """Metadata of an object returned by the `fetch_object_by_id` query.""" creation_time: datetime.datetime last_update_time: datetime.datetime is_consistent: Optional[bool] @dataclass
MetadataSingleObjectReturn
python
qdrant__qdrant-client
qdrant_client/http/models/models.py
{ "start": 36869, "end": 37000 }
class ____(BaseModel): value: "FacetValue" = Field(..., description="") count: int = Field(..., description="")
FacetValueHit
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/matchClass7.py
{ "start": 311, "end": 619 }
class ____: val: DC1 def func2(val: DC2): result = val match result.val: case DC1(result): reveal_type(result, expected_text="str") # This should generate an error because result.val # is no longer valid at this point. print(result.val)
DC2
python
apache__airflow
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_plugins.py
{ "start": 1097, "end": 6096 }
class ____: @pytest.mark.parametrize( ("query_params", "expected_total_entries", "expected_names"), [ # Filters ( {}, 13, [ "MetadataCollectionPlugin", "OpenLineageProviderPlugin", ...
TestGetPlugins
python
fastapi__sqlmodel
docs_src/tutorial/insert/tutorial002.py
{ "start": 92, "end": 925 }
class ____(SQLModel, table=True): id: Optional[int] = Field(default=None, primary_key=True) name: str secret_name: str age: Optional[int] = None sqlite_file_name = "database.db" sqlite_url = f"sqlite:///{sqlite_file_name}" engine = create_engine(sqlite_url, echo=True) def create_db_and_tables(): ...
Hero
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 501112, "end": 501433 }
class ____(sgqlc.types.Type): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("cursor", "node") cursor = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name="cursor") node = sgqlc.types.Field("ProjectColumn", graphql_name="node")
ProjectColumnEdge
python
sphinx-doc__sphinx
sphinx/domains/std/__init__.py
{ "start": 1454, "end": 2913 }
class ____(ObjectDescription[str]): """A generic x-ref directive registered with Sphinx.add_object_type().""" indextemplate: str = '' parse_node: Callable[[BuildEnvironment, str, desc_signature], str] | None = None def handle_signature(self, sig: str, signode: desc_signature) -> str: if self.p...
GenericObject
python
huggingface__transformers
src/transformers/models/umt5/configuration_umt5.py
{ "start": 770, "end": 6418 }
class ____(PreTrainedConfig): r""" This is the configuration class to store the configuration of a [`UMT5Model`]. It is used to instantiate a UMT5 model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configurati...
UMT5Config
python
getsentry__sentry
tests/sentry/api/bases/test_organization.py
{ "start": 1822, "end": 3567 }
class ____(TestCase): def setUp(self) -> None: self.org = self.create_organization() # default to the organization permission class self.permission_cls = OrganizationPermission super().setUp() def has_object_perm( self, method, obj, auth=None, ...
PermissionBaseTestCase
python
matplotlib__matplotlib
lib/matplotlib/axis.py
{ "start": 1021, "end": 12960 }
class ____(martist.Artist): """ Abstract base class for the axis ticks, grid lines and labels. Ticks mark a position on an Axis. They contain two lines as markers and two labels; one each for the bottom and top positions (in case of an `.XAxis`) or for the left and right positions (in case of a `.Y...
Tick
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 276577, "end": 277286 }
class ____(sgqlc.types.Input): """Autogenerated input type of RemoveEnterpriseSupportEntitlement""" __schema__ = github_schema __field_names__ = ("enterprise_id", "login", "client_mutation_id") enterprise_id = sgqlc.types.Field(sgqlc.types.non_null(ID), graphql_name="enterpriseId") """The ID of the...
RemoveEnterpriseSupportEntitlementInput
python
bokeh__bokeh
src/bokeh/models/widgets/inputs.py
{ "start": 15406, "end": 16273 }
class ____(InputWidget): ''' Multi-select widget. ''' # explicit __init__ to support Init signatures def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) options = List(Either(String, Tuple(String, String)), help=""" Available selection options. Opt...
MultiSelect
python
ray-project__ray
python/ray/util/state/common.py
{ "start": 6856, "end": 7620 }
class ____: # Timeout for the HTTP request timeout: int = DEFAULT_RPC_TIMEOUT # When the request is processed on the server side, # we should apply multiplier so that server side can finish # processing a request within timeout. Otherwise, # timeout will always lead Http timeout. server_time...
GetApiOptions
python
django__django
tests/unmanaged_models/models.py
{ "start": 240, "end": 398 }
class ____(models.Model): f_a = models.CharField(max_length=10, db_index=True) f_b = models.IntegerField() class Meta: db_table = "a01"
A01
python
doocs__leetcode
solution/2700-2799/2791.Count Paths That Can Form a Palindrome in a Tree/Solution.py
{ "start": 0, "end": 621 }
class ____: def countPalindromePaths(self, parent: List[int], s: str) -> int: def dfs(i: int, xor: int): nonlocal ans for j, v in g[i]: x = xor ^ v ans += cnt[x] for k in range(26): ans += cnt[x ^ (1 << k)] ...
Solution
python
apache__airflow
airflow-ctl/tests/airflow_ctl/api/test_operations.py
{ "start": 40337, "end": 43545 }
class ____: pool_name = "pool_name" pool = PoolBody( name=pool_name, slots=1, description="description", include_deferred=True, ) pools_bulk_body = BulkBodyPoolBody( actions=[ BulkCreateActionPoolBody( action="create", e...
TestPoolsOperations
python
davidhalter__jedi
jedi/inference/value/instance.py
{ "start": 3100, "end": 3284 }
class ____(FunctionExecutionContext): def __init__(self, instance, *args, **kwargs): super().__init__(*args, **kwargs) self.instance = instance
MethodExecutionContext
python
huggingface__transformers
src/transformers/models/layoutlmv3/configuration_layoutlmv3.py
{ "start": 810, "end": 8468 }
class ____(PreTrainedConfig): r""" This is the configuration class to store the configuration of a [`LayoutLMv3Model`]. It is used to instantiate an LayoutLMv3 model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a simila...
LayoutLMv3Config
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/sql/sqltypes.py
{ "start": 126193, "end": 131750 }
class ____(Emulated, TypeEngine[_UUID_RETURN]): """Represent a database agnostic UUID datatype. For backends that have no "native" UUID datatype, the value will make use of ``CHAR(32)`` and store the UUID as a 32-character alphanumeric hex string. For backends which are known to support ``UUID`` d...
Uuid
python
django__django
tests/model_inheritance_regress/models.py
{ "start": 911, "end": 1134 }
class ____(models.Model): # Test parent_link connector can be discovered in abstract classes. parent = models.OneToOneField(Place, models.CASCADE, parent_link=True) class Meta: abstract = True
ParkingLot4
python
walkccc__LeetCode
solutions/1869. Longer Contiguous Segments of Ones than Zeros/1869.py
{ "start": 0, "end": 435 }
class ____: def checkZeroOnes(self, s: str) -> bool: longestOnes = 0 longestZeros = 0 currentOnes = 0 currentZeros = 0 for c in s: if c == '0': currentOnes = 0 currentZeros += 1 longestZeros = max(longestZeros, currentZeros) else: currentZeros = 0 ...
Solution
python
pytorch__pytorch
test/dynamo/test_fake_distributed.py
{ "start": 5004, "end": 6398 }
class ____(torch.nn.Module): def forward(self, primals_1: "Sym(u0)", primals_2: "Sym(u1)", primals_3: "Sym(u2)", floordiv: "Sym((u0//2))", tangents_1: "f32[2*((u0//2)), u1, u2]"): all_to_all_single_1: "f32[2*((u0//2)), u1, u2]" = torch.ops._c10d_functional.all_to_all_single.default(tangents_1, [floordiv, fl...
GraphModule
python
airbytehq__airbyte
airbyte-integrations/connectors/source-facebook-marketing/unit_tests/integration/test_ads_insights_action_product_id.py
{ "start": 17734, "end": 22843 }
class ____(TestCase): @staticmethod def _read( config_: ConfigBuilder, state: Optional[List[AirbyteStateMessage]] = None, expecting_exception: bool = False, json_schema: Optional[Dict[str, any]] = None, ) -> EntrypointOutput: return read_output( config_bui...
TestIncremental
python
scikit-learn__scikit-learn
sklearn/neighbors/_nearest_centroid.py
{ "start": 837, "end": 13095 }
class ____( DiscriminantAnalysisPredictionMixin, ClassifierMixin, BaseEstimator ): """Nearest centroid classifier. Each class is represented by its centroid, with test samples classified to the class with the nearest centroid. Read more in the :ref:`User Guide <nearest_centroid_classifier>`. ...
NearestCentroid
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/math_ops/batch_matmul_op_test.py
{ "start": 8796, "end": 12831 }
class ____(test.Benchmark): # Batch sizes are 512. shape_pairs = [ # Typical fully connected layer. ((4, 8, 4, 2, 1, 1024), (1024, 1024)), ((4, 1, 4, 1, 1, 1024), (1, 8, 1, 2, 1024, 1024)), # Square matmul. ((4, 8, 4, 2, 512, 512), (512, 512)), ((4, 1, 4, 1, 512, 512), (1, 8, 1, ...
BatchMatMulBenchmark
python
pytorch__pytorch
torch/_dynamo/variables/lazy.py
{ "start": 286, "end": 1299 }
class ____: """Container to cache the real VariableTracker""" def __init__(self, value: Any, source: Any) -> None: if not isinstance(value, LazySymNodeFormatString): assert source self.value = value self.source = source self.name_hint: Optional[str] = None se...
LazyCache
python
huggingface__transformers
src/transformers/models/timesfm/modeling_timesfm.py
{ "start": 5137, "end": 7988 }
class ____(nn.Module): """Generates position embedding for a given 1-d sequence.""" def __init__(self, config: TimesFmConfig): super().__init__() min_timescale = config.min_timescale max_timescale = config.max_timescale self.embedding_dims = config.hidden_size num_times...
TimesFmPositionalEmbedding
python
python__mypy
mypyc/analysis/dataflow.py
{ "start": 4469, "end": 4773 }
class ____(Generic[T]): def __init__(self, before: AnalysisDict[T], after: AnalysisDict[T]) -> None: self.before = before self.after = after def __str__(self) -> str: return f"before: {self.before}\nafter: {self.after}\n" GenAndKill = tuple[set[T], set[T]]
AnalysisResult
python
docker__docker-py
tests/unit/models_networks_test.py
{ "start": 122, "end": 1298 }
class ____(unittest.TestCase): def test_create(self): client = make_fake_client() network = client.networks.create("foobar", labels={'foo': 'bar'}) assert network.id == FAKE_NETWORK_ID client.api.inspect_network.assert_called_once_with(FAKE_NETWORK_ID) client.api.create_netw...
NetworkCollectionTest
python
hyperopt__hyperopt
hyperopt/tests/unit/test_anneal.py
{ "start": 309, "end": 609 }
class ____(unittest.TestCase, CasePerDomain): def work(self): trials = Trials() space = self.bandit.expr fmin( fn=passthrough, space=space, trials=trials, algo=anneal.suggest, max_evals=10, )
TestItJustRuns
python
getsentry__sentry
tests/sentry/middleware/integrations/parsers/test_github.py
{ "start": 12209, "end": 12580 }
class ____(GithubRequestParserTest): """ Test fixture that runs the routing tests with header-based routing enabled. """ @pytest.fixture(autouse=True) def setup(self): with override_options({"github.webhook-type-routing.enabled": True}): yield @control_silo_test(regions=create...
GithubRequestParserTypeRoutingTest
python
GoogleCloudPlatform__python-docs-samples
appengine/standard_python3/bundled-services/blobstore/flask/main.py
{ "start": 1259, "end": 2537 }
class ____(blobstore.BlobstoreDownloadHandler): def get(self, photo_key): if not blobstore.get(photo_key): return "Photo key not found", 404 else: headers = self.send_blob(request.environ, photo_key) # Prevent Flask from setting a default content-type. ...
ViewPhotoHandler
python
huggingface__transformers
tests/models/convbert/test_modeling_convbert.py
{ "start": 9762, "end": 18792 }
class ____(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = ( ( ConvBertModel, ConvBertForMaskedLM, ConvBertForMultipleChoice, ConvBertForQuestionAnswering, ConvBertForSequenceClassification, ConvBertForTok...
ConvBertModelTest
python
cython__cython
Demos/benchmarks/bm_richards_cclass.py
{ "start": 1294, "end": 1626 }
class ____(TaskRec): def __init__(self): self.work_in = None self.device_in = None def workInAdd(self,p): self.work_in = p.append_to(self.work_in) return self.work_in def deviceInAdd(self,p): self.device_in = p.append_to(self.device_in) return self.device_in...
HandlerTaskRec
python
charliermarsh__ruff
crates/ty_python_semantic/resources/corpus/85_match_attr.py
{ "start": 6, "end": 66 }
class ____: y = 1 match x: case A.y as z: pass
A
python
astropy__astropy
astropy/coordinates/angles/errors.py
{ "start": 414, "end": 527 }
class ____(ValueError): """ Raised when some part of an angle is out of its valid range. """
RangeError