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
tensorflow__tensorflow
tensorflow/python/client/session.py
{ "start": 15800, "end": 16770 }
class ____(_FetchMapper): """Fetch mapper for dicts.""" def __init__(self, fetches): """Creates a _DictFetchMapper. Args: fetches: Dict of fetches. """ self._fetch_type = type(fetches) if isinstance(fetches, collections.defaultdict): self._type_ctor = functools.partial(collections....
_DictFetchMapper
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/ruff/RUF012.py
{ "start": 2430, "end": 2477 }
class ____(SQLModel): id: int name: str
L
python
getsentry__sentry
tests/snuba/api/endpoints/test_organization_trace_item_attributes.py
{ "start": 34631, "end": 36721 }
class ____( OrganizationTraceItemAttributeValuesEndpointBaseTest, OurLogTestCase ): item_type = SupportedTraceItemType.LOGS feature_flags = {"organizations:ourlogs-enabled": True} def test_no_feature(self) -> None: response = self.do_request(features={}, key="test.attribute") assert res...
OrganizationTraceItemAttributeValuesEndpointLogsTest
python
Textualize__textual
docs/examples/styles/border.py
{ "start": 64, "end": 384 }
class ____(App): CSS_PATH = "border.tcss" def compose(self): yield Label("My border is solid red", id="label1") yield Label("My border is dashed green", id="label2") yield Label("My border is tall blue", id="label3") if __name__ == "__main__": app = BorderApp() app.run()
BorderApp
python
dask__dask
dask/dataframe/dask_expr/_reductions.py
{ "start": 8881, "end": 11822 }
class ____(Expr): """Tree-reduction component of `ApplyConcatApply` This class is used within `ApplyConcatApply._lower`. See Also -------- ApplyConcatApply """ _parameters = [ "frame", "kind", "_meta", "combine", "aggregate", "combine_kwargs...
TreeReduce
python
celery__celery
t/unit/concurrency/test_prefork.py
{ "start": 3597, "end": 3887 }
class ____: @patch('celery.concurrency.prefork.signals') def test_process_destructor(self, signals): mp.process_destructor(13, -3) signals.worker_process_shutdown.send.assert_called_with( sender=None, pid=13, exitcode=-3, )
test_process_destructor
python
celery__celery
celery/bin/amqp.py
{ "start": 450, "end": 10023 }
class ____: def __init__(self, cli_context): self.cli_context = cli_context self.connection = self.cli_context.app.connection() self.channel = None self.reconnect() @property def app(self): return self.cli_context.app def respond(self, retval): if isinst...
AMQPContext
python
django__django
tests/auth_tests/test_management.py
{ "start": 9905, "end": 11147 }
class ____(TestCase): databases = {"default", "other"} @mock.patch.object(changepassword.Command, "_get_pass", return_value="not qwerty") def test_that_changepassword_command_with_database_option_uses_given_db( self, mock_get_pass ): """ changepassword --database should operate ...
MultiDBChangepasswordManagementCommandTestCase
python
getsentry__sentry
tests/sentry/models/test_pullrequest.py
{ "start": 609, "end": 2894 }
class ____(TestCase): def test_resolve_in_commit(self) -> None: group = self.create_group() repo = Repository.objects.create(name="example", organization_id=group.organization.id) commit = Commit.objects.create( key=sha1(uuid4().hex.encode("utf-8")).hexdigest(), rep...
FindReferencedGroupsTest
python
huggingface__transformers
src/transformers/models/blt/modeling_blt.py
{ "start": 28596, "end": 32400 }
class ____(BltPreTrainedModel): config: BltGlobalTransformerConfig _can_record_outputs = { "global_attentions": OutputRecorder(BltSelfAttention, index=1, layer_name="global_transformer"), } def __init__(self, config: BltGlobalTransformerConfig): super().__init__(config) self.con...
BltGlobalTransformer
python
plotly__plotly.py
plotly/graph_objs/splom/hoverlabel/_font.py
{ "start": 233, "end": 17133 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "splom.hoverlabel" _path_str = "splom.hoverlabel.font" _valid_props = { "color", "colorsrc", "family", "familysrc", "lineposition", "linepositionsrc", "shadow", "shadowsrc", "size"...
Font
python
getsentry__sentry
src/sentry/api/serializers/models/organization.py
{ "start": 18478, "end": 18627 }
class ____(TypedDict): user: UserSerializerResponse | UserSerializerResponseSelf | None @register(OrganizationOnboardingTask)
_OnboardingTasksAttrs
python
pandas-dev__pandas
pandas/tests/dtypes/test_inference.py
{ "start": 13049, "end": 34634 }
class ____: @pytest.mark.parametrize( "arr", [ np.array(list("abc"), dtype="S1"), np.array(list("abc"), dtype="S1").astype(object), [b"a", np.nan, b"c"], ], ) def test_infer_dtype_bytes(self, arr): result = lib.infer_dtype(arr, skipna=True)...
TestInference
python
pytorch__pytorch
torch/profiler/_utils.py
{ "start": 1273, "end": 2766 }
class ____: def __init__(self, event) -> None: self.event = event def __hash__(self): return hash(self.event.id) def __eq__(self, other): return self.event.id == other.event.id def __repr__(self) -> str: return f"{self.event.name}" def intervals_overlap(self, inte...
EventKey
python
kamyu104__LeetCode-Solutions
Python/maximum-number-of-achievable-transfer-requests.py
{ "start": 739, "end": 1387 }
class ____(object): def maximumRequests(self, n, requests): """ :type n: int :type requests: List[List[int]] :rtype: int """ def evaluate(n, requests, mask): change = [0]*n base, count = 1, 0 for i in xrange(len(requests)): ...
Solution2
python
jazzband__prettytable
tests/test_html.py
{ "start": 127, "end": 869 }
class ____: def test_html_and_back(self, city_data: PrettyTable) -> None: html_string = city_data.get_html_string() new_table = from_html(html_string)[0] assert new_table.get_string() == city_data.get_string() def test_html_one_and_back(self, city_data: PrettyTable) -> None: htm...
TestHtmlConstructor
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_object_position14.py
{ "start": 315, "end": 911 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("object_position14.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file with image(s).""" workbook =...
TestCompareXLSXFiles
python
gevent__gevent
src/greentest/3.10/test_smtpd.py
{ "start": 5907, "end": 6583 }
class ____(unittest.TestCase): def setUp(self): smtpd.socket = asyncore.socket = mock_socket def tearDown(self): asyncore.close_all() asyncore.socket = smtpd.socket = socket @unittest.skipUnless(socket_helper.IPV6_ENABLED, "IPv6 not enabled") def test_socket_uses_IPv6(self): ...
TestFamilyDetection
python
pypa__warehouse
tests/unit/email/test_init.py
{ "start": 106027, "end": 109288 }
class ____: @pytest.fixture def _team(self, pyramid_user): self.user = UserFactory.create() EmailFactory.create(user=self.user, verified=True) self.submitter = pyramid_user self.organization_name = "exampleorganization" self.team_name = "Example Team" @pytest.mark.us...
TestTeamMemberEmails
python
encode__django-rest-framework
tests/test_prefetch_related.py
{ "start": 217, "end": 362 }
class ____(serializers.ModelSerializer): class Meta: model = User fields = ('id', 'username', 'email', 'groups')
UserSerializer
python
getsentry__sentry
src/sentry/rules/conditions/event_attribute.py
{ "start": 2652, "end": 2910 }
class ____(forms.Form): attribute = forms.ChoiceField(choices=[(a, a) for a in ATTR_CHOICES.keys()]) match = forms.ChoiceField(choices=list(MATCH_CHOICES.items())) value = forms.CharField(widget=forms.TextInput(), required=False)
EventAttributeForm
python
altair-viz__altair
altair/vegalite/v6/schema/core.py
{ "start": 16031, "end": 53067 }
class ____(AnyMarkConfig): """ AreaConfig schema wrapper. Parameters ---------- align : dict, :class:`Align`, :class:`ExprRef`, Literal['left', 'center', 'right'] The horizontal alignment of the text or ranged marks (area, bar, image, rect, rule). One of ``"left"``, ``"right"``, ``"...
AreaConfig
python
streamlit__streamlit
lib/setup.py
{ "start": 4944, "end": 8176 }
class ____(install): """Custom command to verify that the git tag matches our version.""" description = "verify that the git tag matches our version" def run(self): tag = os.getenv("TAG") if tag != VERSION: info = f"Git tag: {tag} does not match the version of this app: {VERSI...
VerifyVersionCommand
python
ray-project__ray
rllib/connectors/learner/compute_returns_to_go.py
{ "start": 267, "end": 2337 }
class ____(ConnectorV2): """Learner ConnectorV2 piece computing discounted returns to go till end of episode. This ConnectorV2: - Operates on a list of Episode objects (single- or multi-agent). - Should be used only in the Learner pipeline as a preparation for an upcoming loss computation that requ...
ComputeReturnsToGo
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/protocol35.py
{ "start": 452, "end": 549 }
class ____: y: A y: P1 = A(3) # This should generate an error. x: P2 = B(A(3)) z: P1 = A(3)
B
python
jazzband__django-oauth-toolkit
oauth2_provider/generators.py
{ "start": 671, "end": 1310 }
class ____(BaseHashGenerator): def hash(self): length = oauth2_settings.CLIENT_SECRET_GENERATOR_LENGTH chars = UNICODE_ASCII_CHARACTER_SET return oauthlib_generate_client_id(length=length, chars=chars) def generate_client_id(): """ Generate a suitable client id """ client_i...
ClientSecretGenerator
python
readthedocs__readthedocs.org
readthedocs/projects/migrations/0074_backport_indexes.py
{ "start": 149, "end": 785 }
class ____(migrations.Migration): safe = Safe.after_deploy() dependencies = [ ("projects", "0073_remove_protected_privacy_level"), ] operations = [ migrations.AlterField( model_name="project", name="modified_date", field=models.DateTimeField(auto_now=...
Migration
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 462599, "end": 463350 }
class ____(sgqlc.types.Type): """Autogenerated return type of AddComment""" __schema__ = github_schema __field_names__ = ("client_mutation_id", "comment_edge", "subject", "timeline_edge") client_mutation_id = sgqlc.types.Field(String, graphql_name="clientMutationId") """A unique identifier for the ...
AddCommentPayload
python
spack__spack
lib/spack/spack/util/s3.py
{ "start": 5843, "end": 6099 }
class ____(urllib.request.BaseHandler): def s3_open(self, req): orig_url = req.get_full_url() url, headers, stream = _s3_open(orig_url, method=req.get_method()) return urllib.response.addinfourl(stream, headers, url)
UrllibS3Handler
python
huggingface__transformers
src/transformers/models/ernie/modular_ernie.py
{ "start": 22063, "end": 25546 }
class ____(BertForNextSentencePrediction): @can_return_tuple @auto_docstring def forward( self, input_ids: Optional[torch.Tensor] = None, attention_mask: Optional[torch.Tensor] = None, token_type_ids: Optional[torch.Tensor] = None, task_type_ids: Optional[torch.Tensor...
ErnieForNextSentencePrediction
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/classVar4.py
{ "start": 369, "end": 841 }
class ____(SomeProtocol): y = 0 z = 0 def func1() -> None: # Previously (prior to pyright 1.1.315), this generated an error # because x was not explicitly declared as a ClassVar. This was changed # to match mypy, which treats this as a normal class variable -- one that # can be accessed as bot...
Class
python
getsentry__sentry
src/sentry_plugins/opsgenie/client.py
{ "start": 46, "end": 796 }
class ____(ApiClient): monitoring_tool = "sentry" plugin_name = "opsgenie" allow_redirects = False def __init__(self, api_key, alert_url, recipients=None): self.api_key = api_key self.alert_url = alert_url self.recipients = recipients super().__init__() def build_ur...
OpsGenieApiClient
python
modin-project__modin
modin/utils.py
{ "start": 2445, "end": 31164 }
class ____(Protocol): # noqa: PR01 """Structural type for objects with a ``_to_numpy`` method (note the leading underscore).""" def _to_numpy(self) -> Any: # noqa: GL08 pass MIN_RAY_VERSION = version.parse("2.10.0") MIN_DASK_VERSION = version.parse("2.22.0") MIN_UNIDIST_VERSION = version.parse("0.2...
SupportsPrivateToNumPy
python
pytorch__pytorch
torch/distributions/generalized_pareto.py
{ "start": 259, "end": 5881 }
class ____(Distribution): r""" Creates a Generalized Pareto distribution parameterized by :attr:`loc`, :attr:`scale`, and :attr:`concentration`. The Generalized Pareto distribution is a family of continuous probability distributions on the real line. Special cases include Exponential (when :attr:`loc` ...
GeneralizedPareto
python
lepture__authlib
authlib/oauth1/rfc5849/errors.py
{ "start": 1850, "end": 1948 }
class ____(OAuth1Error): error = "invalid_signature" status_code = 401
InvalidSignatureError
python
pytorch__pytorch
torch/_dynamo/symbolic_convert.py
{ "start": 177750, "end": 190135 }
class ____(InstructionTranslatorBase): @staticmethod def current_tx() -> InstructionTranslator: return tls.current_tx @contextlib.contextmanager def set_current_tx(self) -> Any: prior = getattr(tls, "current_tx", None) tls.current_tx = self try: yield ...
InstructionTranslator
python
django__django
tests/admin_inlines/admin.py
{ "start": 7765, "end": 8227 }
class ____(forms.ModelForm): class Meta: fields = "__all__" model = SomeChildModel widgets = { "position": forms.HiddenInput, } labels = {"readonly_field": "Label from ModelForm.Meta"} help_texts = {"readonly_field": "Help text from ModelForm.Meta"} d...
SomeChildModelForm
python
ray-project__ray
rllib/utils/replay_buffers/multi_agent_mixin_replay_buffer.py
{ "start": 911, "end": 16712 }
class ____(MultiAgentPrioritizedReplayBuffer): """This buffer adds replayed samples to a stream of new experiences. - Any newly added batch (`add()`) is immediately returned upon the next `sample` call (close to on-policy) as well as being moved into the buffer. - Additionally, a certain number of ...
MultiAgentMixInReplayBuffer
python
google__pytype
pytype/abstract/function.py
{ "start": 35320, "end": 48573 }
class ____(_ReturnType): """A PyTD return type.""" def __init__( self, t: _base.BaseValue, subst: datatypes.AliasingDict[str, cfg.Variable], sources: list[cfg.Binding], ctx: "context.Context", ) -> None: self._type = t self._subst = subst self._sources = sources self...
PyTDReturnType
python
sympy__sympy
sympy/matrices/expressions/permutation.py
{ "start": 196, "end": 4352 }
class ____(MatrixExpr): """A Permutation Matrix Parameters ========== perm : Permutation The permutation the matrix uses. The size of the permutation determines the matrix size. See the documentation of :class:`sympy.combinatorics.permutations.Permutation` for ...
PermutationMatrix
python
PrefectHQ__prefect
src/prefect/_experimental/sla/client.py
{ "start": 269, "end": 1936 }
class ____(BaseClient): def apply_slas_for_deployment( self, deployment_id: "UUID", slas: "list[SlaTypes]" ) -> "SlaMergeResponse": """ Applies service level agreements for a deployment. Performs matching by SLA name. If a SLA with the same name already exists, it will be updated. If a S...
SlaClient
python
doocs__leetcode
solution/0300-0399/0363.Max Sum of Rectangle No Larger Than K/Solution.py
{ "start": 0, "end": 614 }
class ____: def maxSumSubmatrix(self, matrix: List[List[int]], k: int) -> int: m, n = len(matrix), len(matrix[0]) ans = -inf for i in range(m): nums = [0] * n for j in range(i, m): for h in range(n): nums[h] += matrix[j][h] ...
Solution
python
celery__celery
celery/events/snapshot.py
{ "start": 728, "end": 3294 }
class ____: """Record event snapshots.""" timer = None shutter_signal = Signal(name='shutter_signal', providing_args={'state'}) cleanup_signal = Signal(name='cleanup_signal') clear_after = False _tref = None _ctref = None def __init__(self, state, freq=1.0, maxrate=None, ...
Polaroid
python
networkx__networkx
networkx/algorithms/centrality/tests/test_betweenness_centrality.py
{ "start": 24867, "end": 28150 }
class ____: def test_K5(self): """Edge betweenness centrality: K5""" G = nx.complete_graph(5) b = nx.edge_betweenness_centrality(G, weight=None, normalized=False) b_answer = dict.fromkeys(G.edges(), 1) for n in sorted(G.edges()): assert b[n] == pytest.approx(b_ans...
TestEdgeBetweennessCentrality
python
apache__airflow
providers/standard/src/airflow/providers/standard/triggers/hitl.py
{ "start": 2198, "end": 8516 }
class ____(BaseTrigger): """A trigger that checks whether Human-in-the-loop responses are received.""" def __init__( self, *, ti_id: UUID, options: list[str], params: dict[str, dict[str, Any]], defaults: list[str] | None = None, multiple: bool = False, ...
HITLTrigger
python
pytorch__pytorch
torch/_inductor/fx_passes/group_batch_fusion.py
{ "start": 48816, "end": 49028 }
class ____(BatchMathOpsPreGradFusion): def __init__(self, **kwargs): super().__init__(torch.nn.functional.dropout, **kwargs) @register_fusion("batch_aten_tanh", pre_grad=False)
BatchDropoutPreGradFusion
python
huggingface__transformers
src/transformers/models/swin/modeling_swin.py
{ "start": 31163, "end": 35345 }
class ____(nn.Module): def __init__(self, config, grid_size): super().__init__() self.num_layers = len(config.depths) self.config = config dpr = [x.item() for x in torch.linspace(0, config.drop_path_rate, sum(config.depths), device="cpu")] self.layers = nn.ModuleList( ...
SwinEncoder
python
pytorch__pytorch
test/dynamo/cpython/3_13/typinganndata/ann_module3.py
{ "start": 193, "end": 318 }
class ____: def __init__(self, x: int) -> None: self.x: no_such_name = x # This one is OK as proposed by Guido
C_OK
python
scipy__scipy
benchmarks/benchmarks/interpolate.py
{ "start": 281, "end": 1464 }
class ____(Benchmark): unit = "relative increase with repeats" def track_leaks(self): set_mem_rlimit() # Setup temp file, make it fit in memory repeats = [2, 5, 10, 50, 200] peak_mems = [] for repeat in repeats: code = f""" import numpy as np ...
Leaks
python
astropy__astropy
astropy/utils/masked/tests/test_function_helpers.py
{ "start": 64427, "end": 65594 }
class ____: @pytest.mark.parametrize( "one, two", list( itertools.combinations( ( MASKED_SAFE_FUNCTIONS, UNSUPPORTED_FUNCTIONS, set(APPLY_TO_BOTH_FUNCTIONS.keys()), set(DISPATCHED_FUNCTIONS.ke...
TestFunctionHelpersCompleteness
python
django__django
tests/humanize_tests/tests.py
{ "start": 1038, "end": 21088 }
class ____(SimpleTestCase): def humanize_tester( self, test_list, result_list, method, normalize_result_func=escape ): for test_content, result in zip(test_list, result_list): with self.subTest(test_content): t = Template("{%% load humanize %%}{{ test_content|%s }}" %...
HumanizeTests
python
pydata__xarray
xarray/tests/test_plot.py
{ "start": 29722, "end": 32665 }
class ____(PlotTestCase): @pytest.fixture(autouse=True) def setUp(self) -> None: self.darray = DataArray(easy_array((2, 3, 4))) def test_step(self) -> None: hdl = self.darray[0, 0].plot.step() assert "steps" in hdl[0].get_drawstyle() @pytest.mark.parametrize("where", ["pre", "p...
TestPlotStep
python
kubernetes-client__python
kubernetes/client/models/v1_custom_resource_column_definition.py
{ "start": 383, "end": 9655 }
class ____(object): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. """ """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attri...
V1CustomResourceColumnDefinition
python
huggingface__transformers
src/transformers/models/dbrx/modeling_dbrx.py
{ "start": 12962, "end": 14681 }
class ____(nn.Module): def __init__(self, config): super().__init__() self.mlp = DbrxExpertGLU(config) self.hidden_size = config.hidden_size self.ffn_hidden_size = config.ffn_hidden_size self.num_experts = config.moe_num_experts def forward( self, hidden_...
DbrxExperts
python
astropy__astropy
astropy/io/ascii/daophot.py
{ "start": 457, "end": 7283 }
class ____(core.BaseHeader): """ Read the header from a file produced by the IRAF DAOphot routine. """ comment = r"\s*#K" # Regex for extracting the format strings re_format = re.compile(r"%-?(\d+)\.?\d?[sdfg]") re_header_keyword = re.compile( r"[#]K\s+ (?P<name> \w+)\s* = (?P<stuf...
DaophotHeader
python
facebook__pyre-check
client/tests/filesystem_test.py
{ "start": 260, "end": 597 }
class ____(unittest.TestCase): def test_expand_relative_path__globs_are_unchanged(self) -> None: self.assertEqual(expand_relative_path("foo", "bar/*/baz"), "foo/bar/*/baz") self.assertEqual( expand_relative_path("dontcare", "/absolute/path/*/foo"), "/absolute/path/*/foo", ...
FilesystemTest
python
numba__numba
numba/tests/test_dyn_array.py
{ "start": 45129, "end": 49348 }
class ____(MemoryLeakMixin, TestCase): """ Tests for np.concatenate(). """ def _3d_arrays(self): a = np.arange(24).reshape((4, 3, 2)) b = a + 10 c = (b + 10).copy(order='F') d = (c + 10)[::-1] e = (d + 10)[...,::-1] return a, b, c, d, e @contextlib.c...
TestNpConcatenate
python
plotly__plotly.py
plotly/graph_objs/scatterpolargl/_selected.py
{ "start": 233, "end": 3413 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "scatterpolargl" _path_str = "scatterpolargl.selected" _valid_props = {"marker", "textfont"} @property def marker(self): """ The 'marker' property is an instance of Marker that may be specified as: - An instan...
Selected
python
realpython__materials
python-getter-setter/person2.py
{ "start": 0, "end": 205 }
class ____: def __init__(self, name): self._name = name @property def name(self): return self._name @name.setter def name(self, value): self._name = value
Person
python
pypa__packaging
src/packaging/version.py
{ "start": 1522, "end": 4763 }
class ____: __slots__ = () @property def _key(self) -> tuple[Any, ...]: raise NotImplementedError # pragma: no cover def __hash__(self) -> int: return hash(self._key) # Please keep the duplicated `isinstance` check # in the six comparisons hereunder # unless you find a wa...
_BaseVersion
python
spack__spack
lib/spack/spack/vendor/jinja2/nodes.py
{ "start": 13114, "end": 13835 }
class ____(Stmt): """A node that represents the from import tag. It's important to not pass unsafe names to the name attribute. The compiler translates the attribute lookups directly into getattr calls and does *not* use the subscript callback of the interface. As exported variables may not start...
FromImport
python
ray-project__ray
python/ray/air/_internal/device_manager/torch_device_manager.py
{ "start": 67, "end": 1138 }
class ____(ABC): """This class contains the function needed for supporting an acclerator family in Ray AI Library. """ def is_available(self) -> bool: """Validate if device is available.""" ... def get_devices(self) -> List[torch.device]: """Gets the correct torch device co...
TorchDeviceManager
python
pytorch__pytorch
test/distributed/elastic/rendezvous/api_test.py
{ "start": 7155, "end": 7715 }
class ____(RendezvousHandler): def __init__(self, params: RendezvousParameters) -> None: self.params = params def get_backend(self) -> str: return "dummy_backend" def next_rendezvous(self) -> RendezvousInfo: raise NotImplementedError def is_closed(self) -> bool: return...
_DummyRendezvousHandler
python
mlflow__mlflow
mlflow/genai/scorers/registry.py
{ "start": 1180, "end": 3624 }
class ____(metaclass=ABCMeta): """ Abstract class defining the interface for scorer store implementations. This class defines the API interface for scorer operations that can be implemented by different backend stores (e.g., MLflow tracking store, Databricks API). """ @abstractmethod def r...
AbstractScorerStore
python
Textualize__textual
src/textual/containers.py
{ "start": 5382, "end": 5658 }
class ____(ScrollableContainer): """A container with horizontal layout and an automatic scrollbar on the X axis.""" DEFAULT_CSS = """ HorizontalScroll { layout: horizontal; overflow-y: hidden; overflow-x: auto; } """
HorizontalScroll
python
PrefectHQ__prefect
tests/cli/test_flow_run.py
{ "start": 15430, "end": 27316 }
class ____: LOGS_DEFAULT_PAGE_SIZE = 200 async def test_when_num_logs_smaller_than_page_size_then_no_pagination( self, flow_run_factory ): # Given flow_run = await flow_run_factory(num_logs=self.LOGS_DEFAULT_PAGE_SIZE - 1) # When/Then await run_sync_in_worker_thread...
TestFlowRunLogs
python
django__django
tests/auth_tests/test_auth_backends.py
{ "start": 34323, "end": 35018 }
class ____: """ Always raises PermissionDenied in `authenticate`, `has_perm` and `has_module_perms`. """ def authenticate(self, request, username=None, password=None): raise PermissionDenied async def aauthenticate(self, request, username=None, password=None): raise PermissionD...
PermissionDeniedBackend
python
ansible__ansible
lib/ansible/plugins/inventory/generator.py
{ "start": 3933, "end": 6542 }
class ____(BaseInventoryPlugin): """ constructs groups and vars using Jinja2 template expressions """ NAME = 'generator' # implicit trust behavior is already added by the YAML parser invoked by the loader def __init__(self): super(InventoryModule, self).__init__() def verify_file(self, ...
InventoryModule
python
pypa__pip
src/pip/_vendor/platformdirs/api.py
{ "start": 250, "end": 9281 }
class ____(ABC): # noqa: PLR0904 """Abstract base class for platform directories.""" def __init__( # noqa: PLR0913, PLR0917 self, appname: str | None = None, appauthor: str | Literal[False] | None = None, version: str | None = None, roaming: bool = False, # noqa: FBT0...
PlatformDirsABC
python
walkccc__LeetCode
solutions/2225. Find Players With Zero or One Losses/2225.py
{ "start": 0, "end": 444 }
class ____: def findWinners(self, matches: list[list[int]]) -> list[list[int]]: ans = [[] for _ in range(2)] lossesCount = collections.Counter() for winner, loser in matches: if winner not in lossesCount: lossesCount[winner] = 0 lossesCount[loser] += 1 for player, nLosses in loss...
Solution
python
tensorflow__tensorflow
tensorflow/python/ops/nn_grad_test.py
{ "start": 6750, "end": 7943 }
class ____(test.TestCase): @test_util.run_deprecated_v1 def testEluGradGradWRTgrad_ys(self): inputs = constant_op.constant( [[-2, -1, 1, 3], [5, 7, 8, 9]], dtype=dtypes.float32) dummy = constant_op.constant( [[3, 1, -1, -2], [9, 8, 7, 6]], dtype=dtypes.float32) elu = gen_nn_ops.elu(inp...
EluGradOpTest
python
euske__pdfminer
pdfminer/cmapdb.py
{ "start": 2580, "end": 2785 }
class ____(CMapBase): def decode(self, code): n = len(code)//2 if n: return struct.unpack('>%dH' % n, code) else: return () ## UnicodeMap ##
IdentityCMap
python
keras-team__keras
keras/src/ops/linalg.py
{ "start": 5325, "end": 6018 }
class ____(Operation): def call(self, x): return _inv(x) def compute_output_spec(self, x): _assert_2d(x) _assert_square(x) return KerasTensor(x.shape, x.dtype) @keras_export(["keras.ops.inv", "keras.ops.linalg.inv"]) def inv(x): """Computes the inverse of a square tensor. ...
Inv
python
getsentry__sentry
src/sentry/utils/locking/backends/redis.py
{ "start": 328, "end": 1575 }
class ____(LockBackend): def __init__( self, cluster: rb.Cluster | RedisCluster[str] | StrictRedis[str], prefix: str = "l:", uuid: str | None = None, ): if uuid is None: uuid = uuid4().hex self.prefix = prefix self.uuid = uuid self.clus...
BaseRedisLockBackend
python
weaviate__weaviate-python-client
weaviate/collections/classes/config_base.py
{ "start": 175, "end": 493 }
class ____(BaseModel): model_config = ConfigDict(strict=True) def _to_dict(self) -> Dict[str, Any]: ret = cast(dict, self.model_dump(exclude_none=True)) for key, val in ret.items(): if isinstance(val, Enum): ret[key] = val.value return ret
_ConfigCreateModel
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/match1.py
{ "start": 126, "end": 3869 }
class ____: x: int match (1, ): case a1, b1 if True: pass case (a2, b2): pass case [a3, b3]: pass case () | []: pass # This should generate an error because of a missing pattern. case : pass # This should generate an error because it is an i...
Foo
python
pydantic__pydantic
pydantic/v1/networks.py
{ "start": 14732, "end": 15106 }
class ____(MultiHostDsn): allowed_schemes = { 'postgres', 'postgresql', 'postgresql+asyncpg', 'postgresql+pg8000', 'postgresql+psycopg', 'postgresql+psycopg2', 'postgresql+psycopg2cffi', 'postgresql+py-postgresql', 'postgresql+pygresql', } ...
PostgresDsn
python
graphql-python__graphene
graphene/tests/issues/test_1293.py
{ "start": 769, "end": 1066 }
class ____(graphene.ObjectType): set_datetime = SetDatetime.Field() def test_schema_printable_with_default_datetime_value(): schema = graphene.Schema(query=Query, mutation=Mutations) schema_str = print_schema(schema.graphql_schema) assert schema_str, "empty schema printed"
Mutations
python
pytorch__pytorch
torch/_functorch/_aot_autograd/descriptors.py
{ "start": 19445, "end": 19899 }
class ____(DifferentiableAOTInput): """This is similar to ViewBaseAOTInput, but this happens when none of the views were differentiable, so we weren't able to get our hands on the true original view and constructed a synthetic one instead for the sake of autograd. """ base_of: AOTInput def exp...
SyntheticBaseAOTInput
python
pytorch__pytorch
torch/_dynamo/symbolic_convert.py
{ "start": 11206, "end": 13051 }
class ____: # These are the set of string symfloats names (eg. "zf0") that we collect # from the tensorify_python_scalars.py joint fx pass to inform us about # which float inputs we should specialize when we restart analysis. force_specializations: set[str] = set() @classmethod def specialize(c...
TensorifyState
python
pola-rs__polars
py-polars/src/polars/expr/categorical.py
{ "start": 214, "end": 9393 }
class ____: """Namespace for categorical related expressions.""" _accessor = "cat" def __init__(self, expr: Expr) -> None: self._pyexpr = expr._pyexpr def get_categories(self) -> Expr: """ Get the categories stored in this data type. Examples -------- ...
ExprCatNameSpace
python
django__django
tests/model_enums/tests.py
{ "start": 7698, "end": 7883 }
class ____(bytes, models.Choices): FS = b"\x1c", "File Separator" GS = b"\x1d", "Group Separator" RS = b"\x1e", "Record Separator" US = b"\x1f", "Unit Separator"
Separator
python
spack__spack
lib/spack/spack/spec.py
{ "start": 53800, "end": 192040 }
class ____: compiler = DeprecatedCompilerSpec() @staticmethod def default_arch(): """Return an anonymous spec for the default architecture""" s = Spec() s.architecture = ArchSpec.default_arch() return s def __init__(self, spec_like=None, *, external_path=None, external_...
Spec
python
kamyu104__LeetCode-Solutions
Python/best-poker-hand.py
{ "start": 42, "end": 509 }
class ____(object): def bestHand(self, ranks, suits): """ :type ranks: List[int] :type suits: List[str] :rtype: str """ LOOKUP = ["", "High Card", "Pair", "Three of a Kind", "Three of a Kind", "Three of a Kind"] if all(suits[i] == suits[0] for i in xrange(1, l...
Solution
python
numba__numba
numba/core/typing/asnumbatype.py
{ "start": 165, "end": 6061 }
class ____: """ A registry for Python types. It stores a lookup table for simple cases (e.g. ``int``) and a list of functions for more complicated cases (e.g. generics like ``List[int]``). Python types are used in Python type annotations, and in instance checks. Therefore, this registry support...
AsNumbaTypeRegistry
python
dask__dask
dask/dataframe/tseries/resample.py
{ "start": 6784, "end": 6979 }
class ____(ResampleReduction): how = "agg" def _simplify_up(self, parent, dependents): # Disable optimization in `agg`; function may access other columns return
ResampleAgg
python
Lightning-AI__lightning
tests/tests_pytorch/test_cli.py
{ "start": 42639, "end": 43932 }
class ____(BoringModel): def __init__(self, learning_rate, step_size=None, **kwargs): super().__init__() self.save_hyperparameters() self.learning_rate = learning_rate self.step_size = step_size self.kwargs = kwargs def test_lightning_cli_save_hyperparameters_untyped_module...
TestModelSaveHparamsUntyped
python
viewflow__viewflow
viewflow/workflow/base.py
{ "start": 597, "end": 2013 }
class ____: """Represents an edge in the Flow graph. An edge connects two nodes (source and destination) in the flow graph and can have different types (e.g., `next`, `cond_true`, `cond_false`, `default`). Attributes: _src: The source node of the edge. _dst: The destination node of the...
Edge
python
getsentry__sentry
tests/sentry/core/endpoints/scim/test_scim_user_details.py
{ "start": 31911, "end": 32919 }
class ____(unittest.TestCase): def test_parse_filter_conditions_basic(self) -> None: fil = parse_filter_conditions('userName eq "user@sentry.io"') assert fil == "user@sentry.io" # single quotes too fil = parse_filter_conditions("userName eq 'user@sentry.io'") assert fil == "...
SCIMUtilsTests
python
pytorch__pytorch
test/test_jit.py
{ "start": 112016, "end": 114529 }
class ____(JitTestCase): def test_instancing_error(self): @torch.jit.ignore class MyScriptClass: def unscriptable(self): return "a" + 200 class TestModule(torch.nn.Module): def forward(self, x): return MyScriptClass() with s...
TestFrontend
python
ray-project__ray
python/ray/llm/tests/serve/cpu/deployments/llm/vllm/kv_transfer_backends/test_factory.py
{ "start": 2098, "end": 6822 }
class ____: """Test suite for KVConnectorBackendFactory.""" def test_get_backend_class_success(self): """Test successful retrieval of a registered backend class.""" backend_class = KVConnectorBackendFactory.get_backend_class( "LMCacheConnectorV1" ) assert backend_cla...
TestKVConnectorBackendFactory
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_image04.py
{ "start": 315, "end": 841 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("image04.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file with image(s).""" workbook = Workbook(...
TestCompareXLSXFiles
python
huggingface__transformers
src/transformers/convert_slow_tokenizer.py
{ "start": 55486, "end": 57917 }
class ____(SpmConverter): handle_byte_fallback = True def __init__(self, vocab_file=None, *args): self.vocab_file = vocab_file requires_backends(self, "protobuf") Converter.__init__(self, vocab_file) model_pb2 = import_protobuf() m = model_pb2.ModelProto() wit...
ParakeetConverter
python
airbytehq__airbyte
airbyte-integrations/connectors/source-fauna/unit_tests/test_util.py
{ "start": 1354, "end": 2863 }
class ____: def __init__(self, domain: str, port: int, scheme: str, secret: str, collection=CollectionConfig()): self.domain = domain self.port = port self.scheme = scheme self.secret = secret self.collection = collection @staticmethod def localhost(collection=Collec...
FullConfig
python
ethereum__web3.py
web3/types.py
{ "start": 4507, "end": 4628 }
class ____(TypedDict): index: int validator_index: int address: ChecksumAddress amount: Gwei
WithdrawalData
python
gevent__gevent
src/greentest/3.10/test_subprocess.py
{ "start": 1656, "end": 2288 }
class ____(unittest.TestCase): def setUp(self): # Try to minimize the number of children we have so this test # doesn't crash on some buildbots (Alphas in particular). support.reap_children() def tearDown(self): if not mswindows: # subprocess._active is not used on W...
BaseTestCase
python
getsentry__sentry
tests/sentry/api/endpoints/release_thresholds/utils/test_get_new_issue_counts.py
{ "start": 718, "end": 6277 }
class ____(TestCase): def setUp(self) -> None: super().setUp() self.org = self.create_organization() self.project1 = self.create_project(name="foo", organization=self.org) self.project2 = self.create_project(name="bar", organization=self.org) # 2 environments self.nu...
GetNewIssueCountTest
python
pennersr__django-allauth
allauth/socialaccount/providers/stripe/provider.py
{ "start": 583, "end": 1021 }
class ____(OAuth2Provider): id = "stripe" name = "Stripe" account_class = StripeAccount oauth2_adapter_class = StripeOAuth2Adapter def extract_uid(self, data): return data["id"] def extract_common_fields(self, data): return dict(name=data.get("display_name"), email=data.get("em...
StripeProvider
python
pandas-dev__pandas
pandas/tests/extension/base/ops.py
{ "start": 9145, "end": 10631 }
class ____(BaseOpsUtil): def test_invert(self, data): ser = pd.Series(data, name="name") try: [~x for x in data] except TypeError: # scalars don't support invert -> we don't expect the vectorized # operation to succeed with pytest.raises(TypeE...
BaseUnaryOpsTests
python
kamyu104__LeetCode-Solutions
Python/design-an-expression-tree-with-evaluate-function.py
{ "start": 84, "end": 231 }
class ____: __metaclass__ = ABCMeta # define your fields here @abstractmethod def evaluate(self): pass import operator
Node