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
plotly__plotly.py
plotly/graph_objs/funnel/marker/colorbar/_tickfont.py
{ "start": 233, "end": 9949 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "funnel.marker.colorbar" _path_str = "funnel.marker.colorbar.tickfont" _valid_props = { "color", "family", "lineposition", "shadow", "size", "style", "textcase", "variant", "weight...
Tickfont
python
ray-project__ray
python/ray/dashboard/modules/reporter/reporter_agent.py
{ "start": 10946, "end": 66535 }
class ____( dashboard_utils.DashboardAgentModule, reporter_pb2_grpc.ReporterServiceServicer, metrics_service_pb2_grpc.MetricsServiceServicer, ): """A monitor process for monitoring Ray nodes. Attributes: dashboard_agent: The DashboardAgent object contains global config raylet_client...
ReporterAgent
python
keras-team__keras
guides/making_new_layers_and_models_via_subclassing.py
{ "start": 17822, "end": 18507 }
class ____(layers.Layer): """Maps MNIST digits to a triplet (z_mean, z_log_var, z).""" def __init__( self, latent_dim=32, intermediate_dim=64, name="encoder", **kwargs ): super().__init__(name=name, **kwargs) self.dense_proj = layers.Dense(intermediate_dim, activation="relu") ...
Encoder
python
readthedocs__readthedocs.org
readthedocs/projects/migrations/0077_remote_repository_data_migration.py
{ "start": 489, "end": 712 }
class ____(migrations.Migration): safe = Safe.after_deploy() dependencies = [ ("projects", "0076_project_remote_repository"), ] operations = [ migrations.RunPython(migrate_data), ]
Migration
python
astropy__astropy
astropy/visualization/lupton_rgb.py
{ "start": 9537, "end": 11805 }
class ____(AsinhMapping): """ A mapping for an asinh stretch, estimating the linear stretch by zscale. x = asinh(Q (I - z1)/(z2 - z1))/Q Parameters ---------- image1 : ndarray or a list of arrays The image to analyse, or a list of 3 images to be converted to an intensity image....
AsinhZScaleMapping
python
eth-brownie__brownie
brownie/test/managers/runner.py
{ "start": 1385, "end": 3765 }
class ____: def __init__( self, revert_msg=None, dev_revert_msg=None, revert_pattern=None, dev_revert_pattern=None ): if revert_msg is not None and revert_pattern is not None: raise ValueError("Can only use one of`revert_msg` and `revert_pattern`") if dev_revert_msg is not No...
RevertContextManager
python
coleifer__peewee
tests/cockroachdb.py
{ "start": 569, "end": 618 }
class ____(TestModel): data = TextField()
Normal
python
jmcnamara__XlsxWriter
xlsxwriter/test/worksheet/test_data_bar05.py
{ "start": 345, "end": 7604 }
class ____(unittest.TestCase): """ Test assembling a complete Worksheet file. """ def test_assemble_xml_file(self): """Test writing a worksheet with conditional formatting.""" self.maxDiff = None fh = StringIO() worksheet = Worksheet() worksheet._set_filehandle...
TestAssembleWorksheet
python
kubernetes-client__python
kubernetes/client/api/events_api.py
{ "start": 543, "end": 5185 }
class ____(object): """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ def __init__(self, api_client=None): if api_client is None: api_client = ApiClient() self.api_client = api_client ...
EventsApi
python
walkccc__LeetCode
solutions/759. Employee Free Time/759.py
{ "start": 0, "end": 425 }
class ____: def employeeFreeTime(self, schedule: '[[Interval]]') -> '[Interval]': ans = [] intervals = [] for s in schedule: intervals.extend(s) intervals.sort(key=lambda x: x.start) prevEnd = intervals[0].end for interval in intervals: if interval.start > prevEnd: ans....
Solution
python
doocs__leetcode
solution/1200-1299/1222.Queens That Can Attack the King/Solution.py
{ "start": 0, "end": 567 }
class ____: def queensAttacktheKing( self, queens: List[List[int]], king: List[int] ) -> List[List[int]]: n = 8 s = {(i, j) for i, j in queens} ans = [] for a in range(-1, 2): for b in range(-1, 2): if a or b: x, y = king ...
Solution
python
PrefectHQ__prefect
tests/test_flows.py
{ "start": 44981, "end": 50949 }
class ____: async def test_flows_fail_with_timeout(self): @flow(timeout_seconds=0.1) def my_flow(): time.sleep(SLEEP_TIME) state = my_flow(return_state=True) assert state.is_failed() assert state.name == "TimedOut" with pytest.raises(TimeoutError): ...
TestFlowTimeouts
python
dagster-io__dagster
python_modules/libraries/dagster-dg-core/dagster_dg_core/config.py
{ "start": 21920, "end": 22152 }
class ____(_DgConfigErrorRecord): parent_key: str key: str @property def message(self) -> str: return f"Unrecognized field at `{self.parent_key}`:\n {self.key}" @record
_DgConfigUnrecognizedFieldErrorRecord
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 262835, "end": 263121 }
class ____(sgqlc.types.Input): """Ways in which to filter lists of projects.""" __schema__ = github_schema __field_names__ = ("state",) state = sgqlc.types.Field(ProjectV2State, graphql_name="state") """List project v2 filtered by the state given."""
ProjectV2Filters
python
django__django
tests/generic_views/views.py
{ "start": 6049, "end": 6231 }
class ____(BookDetail): def get_object(self, queryset=None): return super().get_object(queryset=Book.objects.filter(pk=self.kwargs["pk"]))
BookDetailGetObjectCustomQueryset
python
huggingface__transformers
src/transformers/models/falcon_mamba/modular_falcon_mamba.py
{ "start": 25909, "end": 25958 }
class ____(MambaOutput): pass
FalconMambaOutput
python
scrapy__scrapy
scrapy/contracts/default.py
{ "start": 320, "end": 593 }
class ____(Contract): """Contract to set the url of the request (mandatory) @url http://scrapy.org """ name = "url" def adjust_request_args(self, args: dict[str, Any]) -> dict[str, Any]: args["url"] = self.args[0] return args
UrlContract
python
numba__numba
numba/tests/test_struct_ref.py
{ "start": 1594, "end": 2813 }
class ____(types.StructRef): """Test associated with this type represent the higher-level uses of structef. """ pass # Call to define_proxy is needed to register the use of `MyStruct` as a # PyObject proxy for creating a Numba-allocated structref. # The `MyStruct` class can then be used in both jit-co...
MyStructType
python
dagster-io__dagster
python_modules/dagster/dagster/_core/definitions/declarative_automation/operators/dep_operators.py
{ "start": 1182, "end": 3441 }
class ____( BuiltinAutomationCondition[T_EntityKey], Generic[T_EntityKey, U_EntityKey] ): key: U_EntityKey operand: AutomationCondition[U_EntityKey] @property def name(self) -> str: return self.key.to_user_string() @property def children(self) -> Sequence[AutomationCondition]: ...
EntityMatchesCondition
python
getsentry__sentry
src/sentry/replays/usecases/query/conditions/aggregate.py
{ "start": 5585, "end": 6586 }
class ____(GenericBase): @staticmethod def visit_eq(expression: Expression, value: str) -> Condition: return contains(StringArray.visit_eq(expression, value)) @staticmethod def visit_neq(expression: Expression, value: str) -> Condition: return does_not_contain(StringArray.visit_eq(expre...
SumOfStringArray
python
RaRe-Technologies__gensim
gensim/models/phrases.py
{ "start": 17014, "end": 31338 }
class ____(_PhrasesTransformation): """Detect phrases based on collocation counts.""" def __init__( self, sentences=None, min_count=5, threshold=10.0, max_vocab_size=40000000, delimiter='_', progress_per=10000, scoring='default', connector_words=frozenset(), ): ...
Phrases
python
django__django
django/contrib/gis/geos/io.py
{ "start": 640, "end": 799 }
class ____(_WKTReader): def read(self, wkt): "Return a GEOSGeometry for the given WKT string." return GEOSGeometry(super().read(wkt))
WKTReader
python
huggingface__transformers
src/transformers/models/musicgen/modeling_musicgen.py
{ "start": 59560, "end": 113330 }
class ____(MusicgenPreTrainedModel, GenerationMixin): config: MusicgenConfig output_modalities = ("audio",) base_model_prefix = "encoder_decoder" main_input_name = "input_ids" supports_gradient_checkpointing = True def __init__( self, config: Optional[MusicgenConfig] = None, ...
MusicgenForConditionalGeneration
python
huggingface__transformers
src/transformers/models/pixtral/processing_pixtral.py
{ "start": 1773, "end": 11607 }
class ____(ProcessorMixin): r""" Constructs a Pixtral processor which wraps a Pixtral image processor and a Pixtral tokenizer into a single processor. [`PixtralProcessor`] offers all the functionalities of [`CLIPImageProcessor`] and [`LlamaTokenizerFast`]. See the [`~PixtralProcessor.__call__`] and [`~...
PixtralProcessor
python
numba__numba
numba/cuda/tests/cudadrv/test_linker.py
{ "start": 2225, "end": 10161 }
class ____(CUDATestCase): _NUMBA_NVIDIA_BINDING_0_ENV = {'NUMBA_CUDA_USE_NVIDIA_BINDING': '0'} @require_context def test_linker_basic(self): '''Simply go through the constructor and destructor ''' linker = Linker.new(cc=(5, 3)) del linker def _test_linking(self, eager):...
TestLinker
python
skorch-dev__skorch
skorch/tests/test_scoring.py
{ "start": 76, "end": 3849 }
class ____: @pytest.fixture(scope="module") def data(self, classifier_data): return classifier_data @pytest.fixture(scope="module", params=["mean", "sum"]) def reduction(self, request): return request.param @pytest.fixture(scope="module") def net_cls(self): from skorch ...
TestLossScoring
python
pypa__pipenv
pipenv/vendor/tomlkit/toml_document.py
{ "start": 56, "end": 124 }
class ____(Container): """ A TOML document. """
TOMLDocument
python
numba__numba
numba/core/typing/builtins.py
{ "start": 9981, "end": 10070 }
class ____(BitwiseShiftOperation): pass @infer_global(operator.ilshift)
BitwiseLeftShift
python
spyder-ide__spyder
spyder/plugins/updatemanager/workers.py
{ "start": 13935, "end": 19189 }
class ____(BaseWorker): """ Worker that checks and updates Spyder-updater without blocking the Spyder user interface. """ def __init__(self, stable_only): super().__init__() self.stable_only = stable_only self.asset_info = None self.installer_path = None self...
WorkerUpdateUpdater
python
sphinx-doc__sphinx
sphinx/ext/autodoc/_legacy_class_based/_documenters.py
{ "start": 43770, "end": 46852 }
class ____: """Mixin for FunctionDocumenter and MethodDocumenter to provide the feature of reading the signature from the docstring. """ _new_docstrings: list[list[str]] | None = None _signatures: list[str] = [] def _find_signature(self) -> tuple[str | None, str | None] | None: # candi...
DocstringSignatureMixin
python
airbytehq__airbyte
airbyte-integrations/bases/connector-acceptance-test/connector_acceptance_test/utils/backward_compatibility.py
{ "start": 700, "end": 1034 }
class ____(Exception): def __init__(self, error_message: str, context: BackwardIncompatibilityContext) -> None: self.error_message = error_message self.context = context super().__init__(error_message) def __str__(self): return f"{self.context} - {self.error_message}"
NonBackwardCompatibleError
python
getsentry__sentry
tests/sentry/notifications/notification_action/metric_alert_registry/test_msteams_metric_alert_handler.py
{ "start": 1131, "end": 8376 }
class ____(MetricAlertHandlerBase): def setUp(self) -> None: self.create_models() self.action = self.create_action( type=Action.Type.MSTEAMS, integration_id=1234567890, config={ "target_identifier": "channel123", "target_display": "...
TestMsteamsMetricAlertHandler
python
plotly__plotly.py
plotly/graph_objs/choroplethmapbox/_colorbar.py
{ "start": 233, "end": 61680 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "choroplethmapbox" _path_str = "choroplethmapbox.colorbar" _valid_props = { "bgcolor", "bordercolor", "borderwidth", "dtick", "exponentformat", "labelalias", "len", "lenmode", "min...
ColorBar
python
prabhupant__python-ds
data_structures/binary_trees/check_cousin.py
{ "start": 120, "end": 1182 }
class ____: def __init__(self, val): self.val = val self.left = None self.right = None def level(root, node, lev): if not root: return 0 if root == node: return lev l = level(root.left, node, lev+1) if not l == 0: return l l = level(root.rig...
Node
python
davidhalter__jedi
test/completion/goto.py
{ "start": 2598, "end": 3297 }
class ____(): """ abc """ pass # ----------------- # params # ----------------- param = ClassDef #! 8 ['param param'] def ab1(param): pass #! 9 ['param param'] def ab2(param): pass #! 11 ['param = ClassDef'] def ab3(a=param): pass ab1(ClassDef);ab2(ClassDef);ab3(ClassDef) # ----------------- # for loops # -...
ClassDef
python
google__jax
tests/debug_nans_test.py
{ "start": 7091, "end": 8919 }
class ____(jtu.JaxTestCase): def testSingleResultPrimitiveNoInf(self): A = jnp.array([[1., 2.], [2., 3.]]) ans = jnp.tanh(A) ans.block_until_ready() def testMultipleResultPrimitiveNoInf(self): A = jnp.array([[1., 2.], [2., 3.]]) ans, _ = jnp.linalg.eigh(A) ans.block_until_ready() def te...
DebugInfsTest
python
fastapi__sqlmodel
docs_src/tutorial/offset_and_limit/tutorial003_py310.py
{ "start": 71, "end": 1593 }
class ____(SQLModel, table=True): id: int | None = Field(default=None, primary_key=True) name: str = Field(index=True) secret_name: str age: int | None = Field(default=None, index=True) sqlite_file_name = "database.db" sqlite_url = f"sqlite:///{sqlite_file_name}" engine = create_engine(sqlite_url, ec...
Hero
python
un33k__django-uuslug
uuslug/tests/tests.py
{ "start": 10029, "end": 10197 }
class ____(TestCase): def test_uuslug_checks_for_model_instance(self): self.assertRaises(Exception, uuslug, 'test_slug', CoolSlug)
ModelInstanceExeptionTestCase
python
keon__algorithms
tests/test_dfs.py
{ "start": 805, "end": 1186 }
class ____(unittest.TestCase): def test_num_islands(self): self.assertEqual(1, num_islands([[1, 1, 1, 1, 0], [1, 1, 0, 1, 0], [1, 1, 0, 0, 0], [0, 0, 0, 0, 0]])) self.assertEqual(3, num_islands([[1, 1, 0, 0, 0], [1, 1, 0, 0, 0], ...
TestCountIslands
python
huggingface__transformers
src/transformers/models/detr/configuration_detr.py
{ "start": 921, "end": 12438 }
class ____(PreTrainedConfig): r""" This is the configuration class to store the configuration of a [`DetrModel`]. It is used to instantiate a DETR model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configurati...
DetrConfig
python
numba__numba
numba/core/typing/builtins.py
{ "start": 11184, "end": 11676 }
class ____(ConcreteTemplate): # Note Numba follows the Numpy semantics of returning a bool, # while Python returns an int. This makes it consistent with # np.invert() and makes array expressions correct. cases = [signature(types.boolean, types.boolean)] cases += [signature(choose_result_int(op), op...
BitwiseInvert
python
pallets__flask
src/flask/sessions.py
{ "start": 556, "end": 1524 }
class ____(MutableMapping[str, t.Any]): """Expands a basic dictionary with session attributes.""" @property def permanent(self) -> bool: """This reflects the ``'_permanent'`` key in the dict.""" return self.get("_permanent", False) # type: ignore[no-any-return] @permanent.setter d...
SessionMixin
python
lazyprogrammer__machine_learning_examples
rl2/a3c/worker.py
{ "start": 3167, "end": 9023 }
class ____: def __init__( self, name, env, policy_net, value_net, global_counter, returns_list, discount_factor=0.99, max_global_steps=None): self.name = name self.env = env self.global_policy_net = policy_net self.global_value_net = value_net ...
Worker
python
PyCQA__pylint
tests/functional/t/typing_generic.py
{ "start": 502, "end": 591 }
class ____(ABC, Generic[Anything]): def a_method(self) -> None: print("hello")
A
python
apache__airflow
task-sdk/src/airflow/sdk/bases/decorator.py
{ "start": 26209, "end": 28543 }
class ____(Protocol): """Type declaration for ``task_decorator_factory`` return type.""" @overload def __call__( # type: ignore[misc] self, python_callable: Callable[FParams, FReturn], ) -> Task[FParams, FReturn]: """For the "bare decorator" ``@task`` case.""" @overload ...
TaskDecorator
python
pyca__cryptography
src/cryptography/fernet.py
{ "start": 596, "end": 661 }
class ____(Exception): pass _MAX_CLOCK_SKEW = 60
InvalidToken
python
getsentry__sentry
src/sentry/testutils/cases.py
{ "start": 101722, "end": 102015 }
class ____(SCIMTestCase): provider = ACTIVE_DIRECTORY_PROVIDER_NAME @pytest.fixture(autouse=True) def _use_dummy_provider_for_ad_provider(self) -> Generator[None]: with mock.patch.object(auth.manager, "get", return_value=DummyProvider()): yield
SCIMAzureTestCase
python
great-expectations__great_expectations
tests/scripts/test_public_api_report.py
{ "start": 27557, "end": 28705 }
class ____: def test_generate_printable_definitions(self, public_api_report: PublicAPIReport): expected: List[str] = [ "File: sample_with_definitions_python_file_string.py Name: ExampleClass", "File: sample_with_definitions_python_file_string.py Name: example_classmethod", ...
TestPublicAPIReport
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 18555, "end": 18945 }
class ____(sgqlc.types.Enum): """ See source code for more info. """ __schema__ = graphql_schema __choices__ = ( "SAML_EXTERNAL_IDENTITY_MISSING", "SAML_SSO_ENFORCEMENT_REQUIRES_EXTERNAL_IDENTITY", "TWO_FACTOR_ACCOUNT_RECOVERY", "TWO_FACTOR_REQUIREMENT_NON_COMPLIANCE...
OrgRemoveMemberAuditEntryReason
python
django__django
tests/admin_views/models.py
{ "start": 21565, "end": 21690 }
class ____(models.Model): title = models.CharField(max_length=100) def __str__(self): return self.title
Report
python
getsentry__sentry
src/sentry/api/endpoints/organization_trace_item_attributes.py
{ "start": 16446, "end": 26151 }
class ____(BaseSpanFieldValuesAutocompletionExecutor): def __init__( self, organization: Organization, snuba_params: SnubaParams, key: str, query: str | None, limit: int, offset: int, definitions: ColumnDefinitions, ): super().__init__(orga...
TraceItemAttributeValuesAutocompletionExecutor
python
sympy__sympy
doc/ext/numpydoc.py
{ "start": 5300, "end": 6196 }
class ____(ManglingDomainBase, CDomain): name = 'np-c' directive_mangling_map = { 'function': 'function', 'member': 'attribute', 'macro': 'function', 'type': 'class', 'var': 'object', } def wrap_mangling_directive(base_directive, objtype): class directive(base_d...
NumpyCDomain
python
pytorch__pytorch
torch/_inductor/ir.py
{ "start": 272689, "end": 295313 }
class ____(ExternKernelAlloc): """ A class that represents a fallback kernel for handling operators that are not directly support by inductor. It currently supports functional ops, view ops, inplace aten ops, and mutating ops that are auto-functionalizable. """ def __init__( self, ...
FallbackKernel
python
pyparsing__pyparsing
tests/test_unit.py
{ "start": 402077, "end": 404520 }
class ____(unittest.TestCase): def test_loads_markdown_file(self): # Mock the file read to simulate the Markdown content mock_content = "## Test Best Practices\n- Example guideline" mock_file = mock_open(read_data=mock_content) with patch("importlib.resources.files") as mock_files: ...
TestShowBestPractices
python
apache__airflow
providers/amazon/src/airflow/providers/amazon/aws/operators/glue.py
{ "start": 12947, "end": 16670 }
class ____(AwsBaseOperator[GlueDataQualityHook]): """ Creates a data quality ruleset with DQDL rules applied to a specified Glue table. .. seealso:: For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:GlueDataQualityOperator` :param name: A ...
GlueDataQualityOperator
python
TheAlgorithms__Python
graphs/edmonds_karp_multiple_source_and_sink.py
{ "start": 2542, "end": 2939 }
class ____(FlowNetworkAlgorithmExecutor): def __init__(self, flow_network): super().__init__(flow_network) # use this to save your result self.maximum_flow = -1 def get_maximum_flow(self): if not self.executed: raise Exception("You should execute algorithm before usi...
MaximumFlowAlgorithmExecutor
python
huggingface__transformers
src/transformers/models/ovis2/image_processing_ovis2.py
{ "start": 7685, "end": 28908 }
class ____(BaseImageProcessor): r""" Constructs a Ovis2 image processor. Args: do_resize (`bool`, *optional*, defaults to `True`): Whether to resize the image's (height, width) dimensions to the specified `size`. Can be overridden by the `do_resize` parameter in the `preproc...
Ovis2ImageProcessor
python
scikit-learn__scikit-learn
sklearn/model_selection/_split.py
{ "start": 17865, "end": 23712 }
class ____(GroupsConsumerMixin, _BaseKFold): """K-fold iterator variant with non-overlapping groups. Each group will appear exactly once in the test set across all folds (the number of distinct groups has to be at least equal to the number of folds). The folds are approximately balanced in the sense t...
GroupKFold
python
kamyu104__LeetCode-Solutions
Python/maximum-good-subtree-score.py
{ "start": 2115, "end": 3263 }
class ____(object): def goodSubtreeSum(self, vals, par): """ :type vals: List[int] :type par: List[int] :rtype: int """ MOD = 10**9+7 def get_mask(x): mask = 0 while x: x, d = divmod(x, 10) if mask&(1<<d)...
Solution2
python
xlwings__xlwings
xlwings/constants.py
{ "start": 123827, "end": 123965 }
class ____: xlDays = 0 # from enum XlTimeUnit xlMonths = 1 # from enum XlTimeUnit xlYears = 2 # from enum XlTimeUnit
TimeUnit
python
getsentry__sentry
tests/sentry/workflow_engine/migration_helpers/test_migrate_alert_rule.py
{ "start": 57022, "end": 58801 }
class ____(BaseMetricAlertMigrationTest): """ Tests for get_resolve_threshold(), which calculates the resolution threshold for an alert rule if none is explicitly specified. """ def setUp(self) -> None: self.metric_alert = self.create_alert_rule() self.alert_rule_trigger = self.crea...
CalculateResolveThresholdHelperTest
python
google__pytype
pytype/pyi/parser_test.py
{ "start": 18442, "end": 21422 }
class ____(parser_test_base.ParserTestBase): def test_callable_parameters(self): self.check(""" from typing import Callable x: Callable[[int, str], bool]""") self.check( """ from typing import Callable x = ... # type: Callable[..., bool]""", """ from typing im...
HomogeneousTypeTest
python
apache__airflow
providers/amazon/src/airflow/providers/amazon/aws/hooks/redshift_data.py
{ "start": 1538, "end": 1671 }
class ____: """Describes the output of a query execution.""" statement_id: str session_id: str | None
QueryExecutionOutput
python
falconry__falcon
tests/test_httperror.py
{ "start": 5065, "end": 5218 }
class ____: def on_get(self, req, resp): raise falcon.HTTPMethodNotAllowed(['PUT'], description='Not Allowed')
MethodNotAllowedResourceWithBody
python
Textualize__textual
docs/examples/widgets/rich_log.py
{ "start": 964, "end": 1744 }
class ____(App): def compose(self) -> ComposeResult: yield RichLog(highlight=True, markup=True) def on_ready(self) -> None: """Called when the DOM is ready.""" text_log = self.query_one(RichLog) text_log.write(Syntax(CODE, "python", indent_guides=True)) rows = iter(cs...
RichLogApp
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 656656, "end": 657042 }
class ____(sgqlc.types.Type): """An edge in a connection.""" __schema__ = github_schema __field_names__ = ("cursor", "node") cursor = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name="cursor") """A cursor for use in pagination.""" node = sgqlc.types.Field("Environment", graphql_nam...
EnvironmentEdge
python
google__jax
jax/_src/pallas/core.py
{ "start": 21234, "end": 27556 }
class ____: """An internal canonicalized version of BlockSpec. See the `check_invariants` method for precise specification. """ # TODO(apaszke,sharadmv): Replace mapped dims in block_shape with a transform. # After all, it's just indexing out singleton dimensions. block_shape: tuple[BlockDim, ...] transf...
BlockMapping
python
gevent__gevent
src/greentest/3.9/test_ssl.py
{ "start": 208833, "end": 221112 }
class ____(unittest.TestCase): """Verify behavior of close sockets with received data before to the handshake. """ class SingleConnectionTestServerThread(threading.Thread): def __init__(self, *, name, call_after_accept, timeout=None): self.call_after_accept = call_after_accept ...
TestPreHandshakeClose
python
milvus-io__pymilvus
pymilvus/client/types.py
{ "start": 40927, "end": 40983 }
class ____(SegmentInfo): mem_size: int
LoadedSegmentInfo
python
tensorflow__tensorflow
tensorflow/python/keras/initializers/initializers_v2.py
{ "start": 9665, "end": 11658 }
class ____(Initializer): """Initializer that generates tensors with a normal distribution. Also available via the shortcut function `tf.keras.initializers.random_normal`. Examples: >>> # Standalone usage: >>> initializer = tf.keras.initializers.RandomNormal(mean=0., stddev=1.) >>> values = initializer(...
RandomNormal
python
huggingface__transformers
src/transformers/models/rag/modeling_rag.py
{ "start": 37484, "end": 59939 }
class ____(RagPreTrainedModel): def __init__( self, config: Optional[PreTrainedConfig] = None, question_encoder: Optional[PreTrainedModel] = None, generator: Optional[PreTrainedModel] = None, retriever: Optional[RagRetriever] = None, **kwargs, ): r""" ...
RagSequenceForGeneration
python
getsentry__sentry
src/sentry/seer/sentry_data_models.py
{ "start": 1914, "end": 2161 }
class ____(BaseModel): profile_id: str transaction_name: str | None execution_tree: list[ExecutionTreeNode] project_id: int start_ts: float | None = None end_ts: float | None = None is_continuous: bool = False
ProfileData
python
readthedocs__readthedocs.org
readthedocs/projects/views/private.py
{ "start": 28762, "end": 29434 }
class ____(ProjectRedirectsMixin, GenericModelView): """ Insert a redirect in a specific position. This is done by changing the position of the redirect, after saving the redirect, all other positions are updated automatically. """ http_method_names = ["post"] def post(self, request, ...
ProjectRedirectsInsert
python
fastapi__sqlmodel
docs_src/tutorial/connect/select/tutorial003.py
{ "start": 254, "end": 2188 }
class ____(SQLModel, table=True): id: Optional[int] = Field(default=None, primary_key=True) name: str = Field(index=True) secret_name: str age: Optional[int] = Field(default=None, index=True) team_id: Optional[int] = Field(default=None, foreign_key="team.id") sqlite_file_name = "database.db" sqli...
Hero
python
scipy__scipy
scipy/optimize/_shgo_lib/_vertex.py
{ "start": 4530, "end": 5006 }
class ____(VertexBase): """ Add homology properties of a scalar field f: R^n --> R^m associated with the geometry built from the VertexBase class. """ def __init__(self, x, sfield=None, vfield=None, field_args=(), vfield_args=(), g_cons=None, g_cons_args=(), nn=Non...
VertexVectorField
python
plotly__plotly.py
_plotly_utils/png.py
{ "start": 10825, "end": 42784 }
class ____: """ PNG encoder in pure Python. """ def __init__( self, width=None, height=None, size=None, greyscale=Default, alpha=False, bitdepth=8, palette=None, transparent=None, background=None, gamma=None, ...
Writer
python
django__django
django/http/response.py
{ "start": 18828, "end": 22160 }
class ____(StreamingHttpResponse): """ A streaming HTTP response class optimized for files. """ block_size = 4096 def __init__(self, *args, as_attachment=False, filename="", **kwargs): self.as_attachment = as_attachment self.filename = filename self._no_explicit_content_typ...
FileResponse
python
huggingface__transformers
src/transformers/models/mistral3/modeling_mistral3.py
{ "start": 8511, "end": 16071 }
class ____(Mistral3PreTrainedModel): _checkpoint_conversion_mapping = { r"^language_model.model": "language_model", } def __init__(self, config: Mistral3Config): super().__init__(config) self.vision_tower = AutoModel.from_config(config.vision_config) self.multi_modal_projec...
Mistral3Model
python
agronholm__apscheduler
src/apscheduler/eventbrokers/asyncpg.py
{ "start": 792, "end": 6381 }
class ____(BaseExternalEventBroker): """ An asynchronous, asyncpg_ based event broker that uses a PostgreSQL server to broadcast events using its ``NOTIFY`` mechanism. .. _asyncpg: https://pypi.org/project/asyncpg/ :param dsn: a libpq connection string (e.g. ``postgres://user:pass@host:por...
AsyncpgEventBroker
python
jazzband__django-pipeline
tests/tests/test_glob.py
{ "start": 271, "end": 3621 }
class ____(TestCase): def normpath(self, *parts): return os.path.normpath(os.path.join(*parts)) def mktemp(self, *parts): filename = self.normpath(*parts) base, file = os.path.split(filename) base = os.path.join(self.storage.location, base) if not os.path.exists(base): ...
GlobTest
python
allegroai__clearml
clearml/backend_api/services/v2_20/projects.py
{ "start": 142506, "end": 144829 }
class ____(Response): """ Response of projects.merge endpoint. :param moved_entities: The number of tasks and models moved from the merged project into the destination :type moved_entities: int :param moved_projects: The number of child projects moved from the merged project into th...
MergeResponse
python
pandas-dev__pandas
pandas/tests/io/parser/conftest.py
{ "start": 2058, "end": 2163 }
class ____(BaseParser): engine = "c" float_precision_choices = [None, "high", "round_trip"]
CParser
python
walkccc__LeetCode
solutions/447. Number of Boomerangs/447.py
{ "start": 0, "end": 301 }
class ____: def numberOfBoomerangs(self, points: list[list[int]]) -> int: ans = 0 for x1, y1 in points: count = collections.Counter() for x2, y2 in points: ans += 2 * count[(x1 - x2)**2 + (y1 - y2)**2] count[(x1 - x2)**2 + (y1 - y2)**2] += 1 return ans
Solution
python
walkccc__LeetCode
solutions/2807. Insert Greatest Common Divisors in Linked List/2807.py
{ "start": 0, "end": 289 }
class ____: def insertGreatestCommonDivisors( self, head: ListNode | None ) -> ListNode | None: curr = head while curr.next: inserted = ListNode(math.gcd(curr.val, curr.next.val), curr.next) curr.next = inserted curr = inserted.next return head
Solution
python
kevin1024__vcrpy
vcr/config.py
{ "start": 393, "end": 11014 }
class ____: @staticmethod def is_test_method(method_name, function): return method_name.startswith("test") and isinstance(function, types.FunctionType) @staticmethod def ensure_suffix(suffix): def ensure(path): if not path.endswith(suffix): return path + suff...
VCR
python
wandb__wandb
wandb/automations/events.py
{ "start": 3465, "end": 3938 }
class ____(GQLBase): # from: RunMetricFilter event_type: Annotated[ Literal[EventType.RUN_METRIC_ZSCORE], Field(exclude=True, repr=False), ] = EventType.RUN_METRIC_ZSCORE zscore_filter: MetricZScoreFilter @model_validator(mode="before") @classmethod def _nest_inner_filter(cls,...
_WrappedMetricZScoreFilter
python
python-attrs__attrs
bench/test_benchmarks.py
{ "start": 2499, "end": 2968 }
class ____: a: int = 0 b: Ellipsis = ... c: str = "foo" d: tuple[str] = "bar" e: complex = complex() def test_asdict_atomic(): """ Benchmark atomic-only instances. """ c = AtomicFields() ad = attrs.asdict for _ in range(ROUNDS): ad(c) def test_astuple_atomic(): ...
AtomicFields
python
apache__airflow
providers/apache/spark/src/airflow/providers/apache/spark/hooks/spark_sql.py
{ "start": 1193, "end": 8269 }
class ____(BaseHook): """ This hook is a wrapper around the spark-sql binary; requires the "spark-sql" binary to be in the PATH. :param sql: The SQL query to execute :param conf: arbitrary Spark configuration property :param conn_id: connection_id string :param total_executor_cores: (Standalone...
SparkSqlHook
python
sqlalchemy__sqlalchemy
test/ext/test_orderinglist.py
{ "start": 13951, "end": 14078 }
class ____: def __init__(self, value): self.value = value def __index__(self): return self.value
MockIndex
python
walkccc__LeetCode
solutions/3291. Minimum Number of Valid Strings to Form Target I/3291.py
{ "start": 0, "end": 1047 }
class ____: def minValidStrings(self, words: list[str], target: str) -> int: ans = 0 unmatchedPrefix = len(target) lpsList = [self._getLPS(word + '#' + target) for word in words] while unmatchedPrefix > 0: # Greedily choose the word that has the longest suffix match with the # remaining u...
Solution
python
getsentry__sentry
tests/apidocs/endpoints/events/test_project_event_details.py
{ "start": 136, "end": 917 }
class ____(APIDocsTestCase): endpoint = "sentry-api-0-project-event-details" def setUp(self) -> None: self.create_event("a") event = self.create_event("b") self.create_event("c") self.create_event("d", fingerprint=["group-2"]) self.url = reverse( self.endpo...
ProjectEventDetailsDocs
python
dask__dask
dask/dataframe/dask_expr/_groupby.py
{ "start": 16692, "end": 16750 }
class ____(SingleAggregation): groupby_chunk = M.max
Max
python
huggingface__transformers
tests/models/hgnet_v2/test_modeling_hgnet_v2.py
{ "start": 6417, "end": 9744 }
class ____(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): """ Here we also overwrite some tests of test_modeling_common.py, as TextNet does not use input_ids, inputs_embeds, attention_mask and seq_length. """ all_model_classes = (HGNetV2ForImageClassification, HGNetV2Backbone) if is_tor...
HGNetV2ForImageClassificationTest
python
walkccc__LeetCode
solutions/2003. Smallest Missing Genetic Value in Each Subtree/2003.py
{ "start": 0, "end": 947 }
class ____: def smallestMissingValueSubtree( self, parents: list[int], nums: list[int], ) -> list[int]: n = len(parents) ans = [1] * n tree = [[] for _ in range(n)] seen = set() minMiss = 1 for i in range(1, n): tree[parents[i]].append(i) def getNode(nums: list[...
Solution
python
xlwings__xlwings
xlwings/constants.py
{ "start": 102357, "end": 103453 }
class ____: xlRDIAll = 99 # from enum XlRemoveDocInfoType xlRDIComments = 1 # from enum XlRemoveDocInfoType xlRDIContentType = 16 # from enum XlRemoveDocInfoType xlRDIDefinedNameComments = 18 # from enum XlRemoveDocInfoType xlRDIDocumentManagementPolicy = 15 # from enum XlRemoveDocInfoType ...
RemoveDocInfoType
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/orm/unitofwork.py
{ "start": 19433, "end": 20973 }
class ____(_IterateMappersMixin, _PostSortRec): __slots__ = "dependency_processor", "isdelete", "fromparent", "sort_key" def __init__(self, uow, dependency_processor, isdelete, fromparent): self.dependency_processor = dependency_processor self.sort_key = ( "ProcessAll", ...
_ProcessAll
python
TheAlgorithms__Python
scheduling/job_sequence_with_deadline.py
{ "start": 704, "end": 1895 }
class ____: task_id: int deadline: int reward: int def max_tasks(tasks_info: list[tuple[int, int]]) -> list[int]: """ Create a list of Task objects that are sorted so the highest rewards come first. Return a list of those task ids that can be completed before i becomes too high. >>> max_ta...
Task
python
scrapy__scrapy
tests/test_downloadermiddleware_httpauth.py
{ "start": 267, "end": 378 }
class ____(Spider): http_user = "foo" http_pass = "bar" http_auth_domain = "example.com"
DomainSpider
python
apache__avro
lang/py/avro/test/test_io.py
{ "start": 20076, "end": 27082 }
class ____(unittest.TestCase): def test_decimal_bytes_small_scale(self) -> None: """Avro should raise an AvroTypeException when attempting to write a decimal with a larger exponent than the schema's scale.""" datum = decimal.Decimal("3.1415") _, _, exp = datum.as_tuple() scale = -1 *...
TestMisc
python
django__django
tests/admin_changelist/admin.py
{ "start": 1001, "end": 1175 }
class ____(admin.ModelAdmin): list_filter = ["child__name"] search_fields = ["child__name", "child__age"] list_select_related = ["child"]
ParentAdminTwoSearchFields