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 | PrefectHQ__prefect | src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py | {
"start": 337010,
"end": 337359
} | 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("EnterpriseServerUserAccount", graphql_name="node")
... | EnterpriseServerUserAccountEdge |
python | faif__python-patterns | patterns/other/blackboard.py | {
"start": 444,
"end": 929
} | class ____(ABC):
"""Abstract class for experts in the blackboard system."""
@abstractmethod
def __init__(self, blackboard) -> None:
self.blackboard = blackboard
@property
@abstractmethod
def is_eager_to_contribute(self) -> int:
raise NotImplementedError("Must provide implementa... | AbstractExpert |
python | getsentry__sentry | tests/sentry/issues/endpoints/test_project_codeowners_details.py | {
"start": 492,
"end": 8876
} | class ____(APITestCase):
def setUp(self) -> None:
self.user = self.create_user("admin@sentry.io", is_superuser=True)
self.login_as(user=self.user)
self.team = self.create_team(
organization=self.organization, slug="tiger-team", members=[self.user]
)
self.projec... | ProjectCodeOwnersDetailsEndpointTestCase |
python | OmkarPathak__pygorithm | pygorithm/data_structures/graph.py | {
"start": 10919,
"end": 13072
} | class ____(object):
"""CheckCycleUndirectedGraph
Class to check cycle in undirected graph
"""
def __init__(self):
self.graph = {}
self.count = 0
def print_graph(self):
"""
for printing the contents of the graph
"""
for i in self.graph:
... | CheckCycleUndirectedGraph |
python | PrefectHQ__prefect | tests/server/orchestration/api/test_artifacts.py | {
"start": 6745,
"end": 17943
} | class ____:
async def test_read_artifacts(self, artifacts, client):
response = await client.post("/artifacts/filter")
assert response.status_code == status.HTTP_200_OK
assert len(response.json()) == len(artifacts)
assert {r["key"] for r in response.json()} == {a["key"] for a in arti... | TestReadArtifacts |
python | doocs__leetcode | solution/2900-2999/2932.Maximum Strong Pair XOR I/Solution.py | {
"start": 0,
"end": 157
} | class ____:
def maximumStrongPairXor(self, nums: List[int]) -> int:
return max(x ^ y for x in nums for y in nums if abs(x - y) <= min(x, y))
| Solution |
python | pytorch__pytorch | torch/fx/passes/utils/matcher_with_name_node_map_utils.py | {
"start": 1504,
"end": 4241
} | class ____(SubgraphMatcher):
"""Extends SubgraphMatcher to support querying the matched subgraph nodes through node name,
this requires pattern to have specific format (returning and additional dictionary at the output,
that has node name as key, and the node in the pattern graph as value, see Example for m... | SubgraphMatcherWithNameNodeMap |
python | getsentry__sentry | src/sentry/api/serializers/models/team.py | {
"start": 12197,
"end": 12363
} | class ____(OrganizationTeamSCIMSerializerRequired, total=False):
members: list[SCIMTeamMemberListItem]
@dataclasses.dataclass
| OrganizationTeamSCIMSerializerResponse |
python | jmcnamara__XlsxWriter | xlsxwriter/test/vml/test_write_anchor.py | {
"start": 289,
"end": 786
} | class ____(unittest.TestCase):
"""
Test the Vml _write_anchor() method.
"""
def setUp(self):
self.fh = StringIO()
self.vml = Vml()
self.vml._set_filehandle(self.fh)
def test_write_anchor(self):
"""Test the _write_anchor() method"""
self.vml._write_anchor([... | TestWriteXAnchor |
python | apache__airflow | providers/google/src/airflow/providers/google/cloud/operators/vertex_ai/generative_model.py | {
"start": 4590,
"end": 8474
} | class ____(GoogleCloudBaseOperator):
"""
Use the Vertex AI Gemini Pro foundation model to generate content.
:param project_id: Required. The ID of the Google Cloud project that the
service belongs to (templated).
:param location: Required. The ID of the Google Cloud location that the
se... | GenerativeModelGenerateContentOperator |
python | fastapi__sqlmodel | docs_src/tutorial/many_to_many/tutorial001_py310.py | {
"start": 77,
"end": 295
} | class ____(SQLModel, table=True):
team_id: int | None = Field(default=None, foreign_key="team.id", primary_key=True)
hero_id: int | None = Field(default=None, foreign_key="hero.id", primary_key=True)
| HeroTeamLink |
python | django__django | tests/forms_tests/tests/tests.py | {
"start": 19343,
"end": 19404
} | class ____(EmptyLabelTestCase):
pass
| Jinja2EmptyLabelTestCase |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-jira/components.py | {
"start": 572,
"end": 1097
} | class ____(DpathExtractor):
"""
A custom record extractor is needed to handle cases when records are represented as list of strings insted of dictionaries.
Example:
-> ["label 1", "label 2", ..., "label n"]
<- [{"label": "label 1"}, {"label": "label 2"}, ..., {"label": "label n"}]
"""
... | LabelsRecordExtractor |
python | pytorch__pytorch | torch/_inductor/ir.py | {
"start": 87392,
"end": 87440
} | class ____(Scan):
pass
@ir_dataclass
| SplitScan |
python | ansible__ansible | hacking/azp/incidental.py | {
"start": 13140,
"end": 16777
} | class ____:
def __init__(self, path, source, coverage_data, coverage_points):
self.path = path
self.lines = source.decode().splitlines()
self.coverage_data = coverage_data
self.coverage_points = coverage_points
self.github_url = coverage_data.github_base_url + path
i... | SourceFile |
python | spack__spack | lib/spack/spack/solver/core.py | {
"start": 1714,
"end": 2896
} | class ____(AspObject):
"""A term in the ASP logic program"""
__slots__ = ["name", "args"]
def __init__(self, name: str, args: Optional[Tuple[Any, ...]] = None) -> None:
self.name = name
self.args = () if args is None else tuple(args)
def _cmp_key(self) -> Tuple[str, Optional[Tuple[Any... | AspFunction |
python | mlflow__mlflow | mlflow/genai/judges/builtin_judges.py | {
"start": 189,
"end": 322
} | class ____(BuiltInScorer, Judge):
"""
Base class for built-in AI judge scorers that use LLMs for evaluation.
"""
| BuiltinJudge |
python | h5py__h5py | h5py/tests/test_group.py | {
"start": 23410,
"end": 24754
} | class ____(TestCase):
"""
Feature: The .visit and .visititems methods allow iterative access to
group and subgroup members
"""
def setUp(self):
self.f = File(self.mktemp(), 'w')
self.groups = [
'grp1', 'grp1/sg1', 'grp1/sg2', 'grp2', 'grp2/sg1', 'grp2/sg1/ssg1'
... | TestVisit |
python | euske__pdfminer | pdfminer/psparser.py | {
"start": 276,
"end": 367
} | class ____(PSException):
pass
## Basic PostScript Types
##
## PSObject
##
| PSValueError |
python | fastai__fastai | fastai/layers.py | {
"start": 14378,
"end": 15499
} | class ____(Module):
def __init__(self, n_in:int, ks=1, sym=False):
self.sym,self.n_in = sym,n_in
self.conv = _conv1d_spect(n_in, n_in, ks, padding=ks//2, bias=False)
self.gamma = nn.Parameter(tensor([0.]))
def forward(self,x):
if self.sym:
c = self.conv.weight.view(s... | SimpleSelfAttention |
python | google__pytype | pytype/typegraph/cfg_utils.py | {
"start": 8754,
"end": 10569
} | class ____(PredecessorNode, Protocol):
id: int
_OrderableNode = TypeVar("_OrderableNode", bound=OrderableNode)
def order_nodes(nodes: Sequence[_OrderableNode]) -> list[_OrderableNode]:
"""Build an ancestors first traversal of CFG nodes.
This guarantees that at least one predecessor of a block is scheduled be... | OrderableNode |
python | run-llama__llama_index | llama-index-integrations/vector_stores/llama-index-vector-stores-openGauss/llama_index/vector_stores/openGauss/base.py | {
"start": 350,
"end": 4755
} | class ____(NamedTuple):
node_id: str
text: str
metadata: dict
similarity: float
PGType = Literal[
"text",
"int",
"integer",
"numeric",
"float",
"double precision",
"boolean",
"date",
"timestamp",
"uuid",
]
def get_data_model(
base: Type,
index_name: st... | DBEmbeddingRow |
python | django-haystack__django-haystack | test_haystack/test_app_loading.py | {
"start": 152,
"end": 2074
} | class ____(TestCase):
def test_load_apps(self):
apps = app_loading.haystack_load_apps()
self.assertIsInstance(apps, (list, GeneratorType))
self.assertIn("hierarchal_app_django", apps)
self.assertNotIn(
"test_app_without_models",
apps,
msg="haysta... | AppLoadingTests |
python | getsentry__sentry | src/sentry/replays/lib/storage.py | {
"start": 867,
"end": 2171
} | class ____:
project_id: int
replay_id: str
segment_id: int
retention_days: int | None
date_added: datetime | None = None
file_id: int | None = None
file: File | None = None
def make_recording_filename(segment: RecordingSegmentStorageMeta) -> str:
return _make_recording_filename(
... | RecordingSegmentStorageMeta |
python | walkccc__LeetCode | solutions/34. Find First and Last Position of Element in Sorted Array/34.py | {
"start": 0,
"end": 237
} | class ____:
def searchRange(self, nums: list[int], target: int) -> list[int]:
l = bisect_left(nums, target)
if l == len(nums) or nums[l] != target:
return -1, -1
r = bisect_right(nums, target) - 1
return l, r
| Solution |
python | facebook__pyre-check | client/error.py | {
"start": 686,
"end": 771
} | class ____(Exception):
pass
@dataclasses.dataclass(frozen=True)
| ErrorParsingFailure |
python | kamyu104__LeetCode-Solutions | Python/minimum-sum-of-values-by-dividing-array.py | {
"start": 2219,
"end": 4546
} | class ____(object):
def minimumValueSum(self, nums, andValues):
"""
:type nums: List[int]
:type andValues: List[int]
:rtype: int
"""
INF = float("inf")
# RMQ - Sparse Table
# Template: https://github.com/kamyu104/GoogleCodeJam-Farewell-Rounds/blob/main... | Solution2 |
python | great-expectations__great_expectations | contrib/experimental/great_expectations_experimental/expectations/expect_column_values_number_of_decimal_places_to_equal.py | {
"start": 632,
"end": 2298
} | class ____(ColumnMapMetricProvider):
"""
Computes number of decimal places of values in column through string conversion. In the case of an integer, the
value automatically passes.
"""
# This is the id string that will be used to reference your metric.
# Please see {some doc} for information on... | ColumnValuesDecimalPlacesEquals |
python | jazzband__django-oauth-toolkit | tests/test_authorization_code.py | {
"start": 79018,
"end": 81334
} | class ____(BaseTest):
@classmethod
def setUpTestData(cls):
super().setUpTestData()
cls.application.algorithm = Application.RS256_ALGORITHM
cls.application.save()
def test_id_token_resource_access_allowed(self):
self.client.login(username="test_user", password="123456")
... | TestOIDCAuthorizationCodeProtectedResource |
python | doocs__leetcode | lcof2/剑指 Offer II 008. 和大于等于 target 的最短子数组/Solution.py | {
"start": 0,
"end": 340
} | class ____:
def minSubArrayLen(self, target: int, nums: List[int]) -> int:
ans = inf
s = i = 0
for j, x in enumerate(nums):
s += x
while s >= target:
ans = min(ans, j - i + 1)
s -= nums[i]
i += 1
return 0 if ans ... | Solution |
python | getsentry__sentry | src/sentry/utils/services.py | {
"start": 14414,
"end": 18521
} | class ____(Delegator, Service):
"""\
The backends are provided as mapping of backend name to configuration
parameters:
'redis': {
'path': 'sentry.tsdb.redis.RedisTSDB',
'executor': {
'path': 'sentry.utils.services.ThreadedExecutor',
'options':... | ServiceDelegator |
python | google__jax | jax/_src/core.py | {
"start": 48965,
"end": 57911
} | class ____:
__slots__ = ['prev', 'axis_names']
def __init__(self, axis_names: AxisName | None):
self.axis_names = axis_names
def __enter__(self):
self.prev = trace_ctx.axis_env
if self.axis_names is not None:
trace_ctx.set_axis_env(self.prev.add_explicit_mesh_axis_names(
self.axis_na... | AddExplicitMeshAxisNamesContextManager |
python | pypa__setuptools | setuptools/_distutils/command/install_lib.py | {
"start": 369,
"end": 8588
} | class ____(Command):
description = "install all Python modules (extensions and pure Python)"
# The byte-compilation options are a tad confusing. Here are the
# possible scenarios:
# 1) no compilation at all (--no-compile --no-optimize)
# 2) compile .pyc only (--compile --no-optimize; default)
... | install_lib |
python | RaRe-Technologies__gensim | gensim/similarities/docsim.py | {
"start": 3869,
"end": 8988
} | class ____(utils.SaveLoad):
"""A proxy that represents a single shard instance within :class:`~gensim.similarity.docsim.Similarity` index.
Basically just wraps :class:`~gensim.similarities.docsim.MatrixSimilarity`,
:class:`~gensim.similarities.docsim.SparseMatrixSimilarity`, etc, so that it mmaps from disk... | Shard |
python | jazzband__django-waffle | waffle/tests/test_waffle.py | {
"start": 32394,
"end": 33570
} | class ____(TestCase):
databases = DATABASES
def test_is_active_for_user_respects_everyone_on(self):
"""
Test flag.is_active_for_user returns truthy value when everyone is set to True overriding all other settings.
"""
flag = waffle.get_waffle_flag_model().objects.create(
... | WaffleFlagEveryoneSettingTests |
python | getsentry__sentry | src/sentry/monitors/migrations/0008_fix_processing_error_keys.py | {
"start": 2473,
"end": 2588
} | class ____(TypedDict):
id: str
checkin: Any
errors: Sequence[Any]
@dataclass()
| CheckinProcessingErrorData |
python | huggingface__transformers | tests/models/glpn/test_image_processing_glpn.py | {
"start": 3586,
"end": 9909
} | class ____(ImageProcessingTestMixin, unittest.TestCase):
image_processing_class = GLPNImageProcessor if is_vision_available() else None
fast_image_processing_class = GLPNImageProcessorFast if is_torchvision_available() else None
def setUp(self):
super().setUp()
self.image_processor_tester =... | GLPNImageProcessingTest |
python | huggingface__transformers | src/transformers/models/roc_bert/modeling_roc_bert.py | {
"start": 18723,
"end": 19419
} | class ____(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.intermediate_size, config.hidden_size)
self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
self.dropout = nn.Dropout(config.hidden_dropout_prob)
def forwa... | RoCBertOutput |
python | dagster-io__dagster | python_modules/dagster-graphql/dagster_graphql/schema/roots/mutation.py | {
"start": 25693,
"end": 26002
} | class ____(graphene.Union):
"""The output from reloading the workspace."""
class Meta:
types = (
GrapheneWorkspace,
GrapheneUnauthorizedError,
GraphenePythonError,
)
name = "ReloadWorkspaceMutationResult"
| GrapheneReloadWorkspaceMutationResult |
python | wandb__wandb | wandb/sdk/lib/run_moment.py | {
"start": 133,
"end": 2419
} | class ____:
"""A moment in a run.
Defines a branching point in a finished run to fork or resume from.
A run moment is identified by a run ID and a metric value.
Currently, only the metric '_step' is supported.
"""
run: str
"""run ID"""
value: Union[int, float]
"""Value of the metr... | RunMoment |
python | Delgan__loguru | loguru/_colorizer.py | {
"start": 10733,
"end": 11590
} | class ____:
def __init__(self, tokens, messages_color_tokens):
self._tokens = tokens
self._messages_color_tokens = messages_color_tokens
def strip(self):
return AnsiParser.strip(self._tokens)
def colorize(self, ansi_level):
return AnsiParser.colorize(self._tokens, ansi_leve... | ColoredFormat |
python | vyperlang__vyper | tests/hevm.py | {
"start": 734,
"end": 4846
} | class ____:
num_calldataloads = 0
visited: set
def __init__(self):
self.visited = set()
def _prep_hevm_venom_ctx(ctx, verbose=False):
visitor = _FunctionVisitor()
_prep_hevm_venom_fn(ctx.entry_function, visitor)
compiler = VenomCompiler(ctx)
asm = compiler.generate_evm_assembly(n... | _FunctionVisitor |
python | apache__airflow | providers/google/src/airflow/providers/google/cloud/operators/dataplex.py | {
"start": 100399,
"end": 103524
} | class ____(DataplexCatalogBaseOperator):
"""
Get an EntryGroup resource.
.. seealso::
For more information on how to use this operator, take a look at the guide:
:ref:`howto/operator:DataplexCatalogGetEntryGroupOperator`
:param entry_group_id: Required. EntryGroup identifier.
:para... | DataplexCatalogGetEntryGroupOperator |
python | apache__airflow | providers/amazon/src/airflow/providers/amazon/aws/hooks/sqs.py | {
"start": 980,
"end": 5413
} | class ____(AwsBaseHook):
"""
Interact with Amazon Simple Queue Service.
Provide thin wrapper around :external+boto3:py:class:`boto3.client("sqs") <SQS.Client>`.
Additional arguments (such as ``aws_conn_id``) may be specified and
are passed down to the underlying AwsBaseHook.
.. seealso::
... | SqsHook |
python | spyder-ide__spyder | spyder/plugins/completion/api.py | {
"start": 3117,
"end": 3189
} | class ____:
CREATED = 1
CHANGED = 2
DELETED = 3
| FileChangeType |
python | pytorch__pytorch | torch/ao/nn/intrinsic/modules/fused.py | {
"start": 4107,
"end": 4815
} | class ____(_FusedModule):
r"""This is a sequential container which calls the Conv 1d, Batch Norm 1d, and ReLU modules.
During quantization this will be replaced with the corresponding fused module."""
def __init__(self, conv, bn, relu):
assert (
type_before_parametrizations(conv) == Con... | ConvBnReLU1d |
python | numba__numba | numba/tests/test_boundscheck.py | {
"start": 3048,
"end": 4064
} | class ____(SerialMixin, TestCase):
@unittest.skipIf(not cuda.is_available(), "NO CUDA")
@TestCase.run_test_in_subprocess(envvars={'NUMBA_BOUNDSCHECK': '1'})
def test_no_cuda_boundscheck(self):
self.assertTrue(config.BOUNDSCHECK)
with self.assertRaises(NotImplementedError):
@cuda.... | TestNoCudaBoundsCheck |
python | google__jax | jax/_src/errors.py | {
"start": 14296,
"end": 18225
} | class ____(ConcretizationTypeError):
"""
This error occurs when a traced value in JAX is used in a context where a
boolean value is expected (see :ref:`faq-different-kinds-of-jax-values`
for more on what a Tracer is).
The boolean cast may be an explicit (e.g. ``bool(x)``) or implicit, through use of
contro... | TracerBoolConversionError |
python | eth-brownie__brownie | brownie/_gui/tooltip.py | {
"start": 43,
"end": 975
} | class ____(tk.Toplevel):
def __init__(self, widget, text=None, textvariable=None):
super().__init__(widget._root())
label = tk.Label(self, text=text, textvariable=textvariable, font=(None, 10))
label.pack()
self.wm_overrideredirect(True)
self.withdraw()
self.kill = Fa... | ToolTip |
python | doocs__leetcode | solution/0800-0899/0888.Fair Candy Swap/Solution.py | {
"start": 0,
"end": 280
} | class ____:
def fairCandySwap(self, aliceSizes: List[int], bobSizes: List[int]) -> List[int]:
diff = (sum(aliceSizes) - sum(bobSizes)) >> 1
s = set(bobSizes)
for a in aliceSizes:
if (b := (a - diff)) in s:
return [a, b]
| Solution |
python | protocolbuffers__protobuf | python/google/protobuf/internal/descriptor_database_test.py | {
"start": 732,
"end": 5233
} | class ____(unittest.TestCase):
def testAdd(self):
db = descriptor_database.DescriptorDatabase()
file_desc_proto = descriptor_pb2.FileDescriptorProto.FromString(
factory_test2_pb2.DESCRIPTOR.serialized_pb)
file_desc_proto2 = descriptor_pb2.FileDescriptorProto.FromString(
no_package_pb2.DES... | DescriptorDatabaseTest |
python | bokeh__bokeh | tests/unit/bokeh/core/property/test_datetime.py | {
"start": 4721,
"end": 6331
} | class ____:
def test_valid(self) -> None:
prop = bcpd.Time()
assert prop.is_valid(datetime.time(19, 34, 57))
assert prop.is_valid("19:34:57")
def test_invalid(self) -> None:
prop = bcpd.Time()
assert not prop.is_valid(None)
assert not prop.is_valid(datetime.datet... | Test_Time |
python | jazzband__django-oauth-toolkit | tests/test_hybrid.py | {
"start": 47729,
"end": 52095
} | class ____(BaseTest):
def test_resource_access_allowed(self):
self.client.login(username="hy_test_user", password="123456")
# retrieve a valid authorization code
authcode_data = {
"client_id": self.application.client_id,
"state": "random_state_string",
"s... | TestHybridProtectedResource |
python | matplotlib__matplotlib | lib/matplotlib/backends/backend_gtk3.py | {
"start": 11899,
"end": 15979
} | class ____(_NavigationToolbar2GTK, Gtk.Toolbar):
def __init__(self, canvas):
GObject.GObject.__init__(self)
self.set_style(Gtk.ToolbarStyle.ICONS)
self._gtk_ids = {}
for text, tooltip_text, image_file, callback in self.toolitems:
if text is None:
self.in... | NavigationToolbar2GTK3 |
python | wandb__wandb | wandb/vendor/pygments/lexer.py | {
"start": 10730,
"end": 12557
} | class ____(object):
"""
Special singleton used for indicating the caller class.
Used by ``using``.
"""
this = _This()
def using(_other, **kwargs):
"""
Callback that processes the match with a different lexer.
The keyword arguments are forwarded to the lexer, except `state` which
is ha... | _This |
python | mkdocs__mkdocs | mkdocs/structure/pages.py | {
"start": 22091,
"end": 22168
} | class ____(enum.IntEnum):
RELATIVE_TO_DOCS = -1
| _AbsoluteLinksValidationValue |
python | pytest-dev__pytest-xdist | src/xdist/workermanage.py | {
"start": 7402,
"end": 9662
} | class ____(execnet.RSync):
"""RSyncer that filters out common files."""
PathLike = Union[str, "os.PathLike[str]"]
def __init__(
self,
sourcedir: PathLike,
*,
ignores: Sequence[PathLike] | None = None,
verbose: bool = True,
) -> None:
if ignores is None:
... | HostRSync |
python | pytorch__pytorch | torch/jit/_recursive.py | {
"start": 15545,
"end": 42294
} | class ____:
type_store: dict[type[Module], list[torch._C.ConcreteModuleType]]
methods_compiled: set[torch._C.ConcreteModuleType]
def __init__(self) -> None:
# Python module type => List[ConcreteModuleType)]
self.type_store = {}
# ConcreteTypes that have had their methods already com... | ConcreteTypeStore |
python | apache__airflow | airflow-core/src/airflow/task/priority_strategy.py | {
"start": 3687,
"end": 5906
} | class ____(PriorityWeightStrategy):
"""Priority weight strategy that uses the sum of the priority weights of all upstream tasks."""
def get_weight(self, ti: TaskInstance):
if TYPE_CHECKING:
assert ti.task
dag = ti.task.get_dag()
if dag is None:
return ti.task.pri... | _UpstreamPriorityWeightStrategy |
python | great-expectations__great_expectations | contrib/experimental/great_expectations_experimental/expectations/expect_column_values_to_be_valid_github_username.py | {
"start": 1898,
"end": 3953
} | class ____(ColumnMapExpectation):
"""Expect column values to be valid github users."""
# These examples will be shown in the public gallery.
# They will also be executed as unit tests for your Expectation.
examples = [
{
"data": {
"valid_users": ["github", "git", "gr... | ExpectColumnValuesToBeValidGithubUsername |
python | apache__airflow | providers/google/src/airflow/providers/google/cloud/links/vertex_ai.py | {
"start": 6413,
"end": 6655
} | class ____(BaseGoogleLink):
"""Helper class for constructing Vertex AI PipelineJobList link."""
name = "Pipeline Job List"
key = "pipeline_job_list_conf"
format_str = VERTEX_AI_PIPELINE_JOB_LIST_LINK
| VertexAIPipelineJobListLink |
python | spack__spack | lib/spack/spack/repo.py | {
"start": 77867,
"end": 77962
} | class ____(spack.error.SpackError):
"""Superclass for repository-related errors."""
| RepoError |
python | spack__spack | var/spack/test_repos/spack_repo/builtin_mock/packages/non_existing_conditional_dep/package.py | {
"start": 216,
"end": 451
} | class ____(Package):
"""Simple package with no source and one dependency"""
homepage = "http://www.example.com"
version("2.0")
version("1.0")
depends_on("dep-with-variants@999", when="@2.0")
| NonExistingConditionalDep |
python | pytorch__pytorch | torch/_inductor/cudagraph_utils.py | {
"start": 966,
"end": 1460
} | class ____:
"""
A serializable version of torch.fx.Node that contains information
pertinent to placeholder stack traces. We use these in logging and error messages
related to cudagraphs, and will cache these results.
"""
name: str
stack_trace: Optional[str]
# This field is recursive, bu... | PlaceholderInfo |
python | coleifer__peewee | playhouse/sqlite_udf.py | {
"start": 7609,
"end": 8138
} | class ____(_datetime_heap_agg):
def finalize(self):
dtp = min_diff = None
while self.heap:
if min_diff is None:
if dtp is None:
dtp = heapq.heappop(self.heap)
continue
dt = heapq.heappop(self.heap)
diff = dt ... | mintdiff |
python | wandb__wandb | tools/perf/scripts/bench_run_log.py | {
"start": 326,
"end": 759
} | class ____:
"""A simple timer class to measure execution time."""
def __init__(self):
self.start_time = None
def __enter__(self):
self.start()
return self
def __exit__(self, exc_type, exc_value, traceback):
self.stop()
def start(self):
self.start_time = da... | Timer |
python | pydata__xarray | xarray/tests/test_plot.py | {
"start": 79918,
"end": 84172
} | class ____(Common2dMixin, PlotTestCase):
plotfunc = staticmethod(xplt.surface)
subplot_kws = {"projection": "3d"}
@pytest.mark.xfail(
reason=(
"Failing inside matplotlib. Should probably be fixed upstream because "
"other plot functions can handle it. "
"Remove t... | TestSurface |
python | vyperlang__vyper | vyper/builtins/functions.py | {
"start": 31638,
"end": 35569
} | class ____(BuiltinFunctionT):
_id = "as_wei_value"
_inputs = [("value", (IntegerT.any(), DecimalT())), ("unit", StringT.any())]
_return_type = UINT256_T
wei_denoms = {
("wei",): 1,
("femtoether", "kwei", "babbage"): 10**3,
("picoether", "mwei", "lovelace"): 10**6,
("nano... | AsWeiValue |
python | getsentry__sentry | tests/sentry/integrations/api/serializers/test_external_actor.py | {
"start": 425,
"end": 7397
} | class ____(TestCase):
def setUp(self) -> None:
self.user = self.create_user()
self.organization = self.create_organization(owner=self.user)
self.integration, self.org_integration = self.create_provider_integration_for(
self.organization,
self.user,
provide... | ExternalActorSerializerTest |
python | kamyu104__LeetCode-Solutions | Python/ways-to-split-array-into-good-subarrays.py | {
"start": 45,
"end": 470
} | class ____(object):
def numberOfGoodSubarraySplits(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
MOD = 10**9+7
result, prev = 1, -1
for i in xrange(len(nums)):
if nums[i] != 1:
continue
if prev != -1:
... | Solution |
python | squidfunk__mkdocs-material | material/plugins/tags/structure/tag/options.py | {
"start": 1478,
"end": 3916
} | class ____(BaseConfigOption[Set[Tag]]):
"""
Setting for a set of tags.
This setting describes a set of tags, and is used to validate the actual
tags as defined in the front matter of pages, as well as for filters that
are used to include or exclude pages from a listing and to check if a tag
is ... | TagSet |
python | joke2k__faker | faker/providers/person/it_IT/__init__.py | {
"start": 44,
"end": 32681
} | class ____(PersonProvider):
formats_male = (
"{{first_name_male}} {{last_name}}",
"{{first_name_male}} {{last_name}}",
"{{first_name_male}} {{last_name}}",
"{{first_name_male}} {{last_name}}",
"{{first_name_male}} {{last_name}}-{{last_name}}",
"{{prefix_male}} {{first... | Provider |
python | numba__numba | numba/core/types/iterators.py | {
"start": 1029,
"end": 1771
} | class ____(SimpleIteratorType):
"""
Type class for Numba-compiled generator objects.
"""
def __init__(self, gen_func, yield_type, arg_types, state_types,
has_finalizer):
self.gen_func = gen_func
self.arg_types = tuple(arg_types)
self.state_types = tuple(state_ty... | Generator |
python | cython__cython | tests/run/test_templatelib.py | {
"start": 631,
"end": 3364
} | class ____:
def assertInterpolationEqual(self, i, exp):
"""Test Interpolation equality.
The *i* argument must be an Interpolation instance.
The *exp* argument must be a tuple of the form
(value, expression, conversion, format_spec) where the final three
items may be omitted... | TStringBaseCase |
python | sqlalchemy__sqlalchemy | lib/sqlalchemy/pool/impl.py | {
"start": 10433,
"end": 14795
} | class ____(Pool):
"""A Pool that maintains one connection per thread.
Maintains one connection per each thread, never moving a connection to a
thread other than the one which it was created in.
.. warning:: the :class:`.SingletonThreadPool` will call ``.close()``
on arbitrary connections that ... | SingletonThreadPool |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/methodOverride1.py | {
"start": 3490,
"end": 8985
} | class ____(ParentClass):
# This should generate an error because the type of 'a' doesn't match.
def my_method1(self, a: str):
return 1
# This should generate an error because it's missing a param named 'b'.
def my_method2(self, a: int):
return 1
# This should generate an error beca... | ChildClass |
python | chroma-core__chroma | chromadb/quota/__init__.py | {
"start": 632,
"end": 1817
} | class ____(Component):
"""
Exposes hooks to enforce quotas.
"""
def __init__(self, system: System) -> None:
super().__init__(system)
@abstractmethod
def set_context(self, context: Dict[str, Any]) -> None:
"""
Sets the context for a given request.
"""
pas... | QuotaEnforcer |
python | getsentry__sentry | src/sentry/rules/filters/issue_category.py | {
"start": 582,
"end": 2009
} | class ____(EventFilter):
id = "sentry.rules.filters.issue_category.IssueCategoryFilter"
form_fields = {"value": {"type": "choice", "choices": list(CATEGORY_CHOICES.items())}}
rule_type = "filter/event"
label = "The issue's category is equal to {value}"
prompt = "The issue's category is ..."
def... | IssueCategoryFilter |
python | charliermarsh__ruff | crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC004_10.py | {
"start": 141,
"end": 185
} | class ____:
x: List
def f():
x: Dict
| C |
python | apache__airflow | providers/weaviate/src/airflow/providers/weaviate/hooks/weaviate.py | {
"start": 2970,
"end": 44413
} | class ____(BaseHook):
"""
Interact with Weaviate database to store vectors. This hook uses the 'conn_id'.
:param conn_id: The connection id to use when connecting to Weaviate. <howto/connection:weaviate>
"""
conn_name_attr = "conn_id"
default_conn_name = "weaviate_default"
conn_type = "wea... | WeaviateHook |
python | pola-rs__polars | py-polars/src/polars/series/binary.py | {
"start": 364,
"end": 6241
} | class ____:
"""Series.bin namespace."""
_accessor = "bin"
def __init__(self, series: Series) -> None:
self._s: PySeries = series._s
def contains(self, literal: IntoExpr) -> Series:
r"""
Check if binaries in Series contain a binary substring.
Parameters
-------... | BinaryNameSpace |
python | huggingface__transformers | tests/models/data2vec/test_modeling_data2vec_text.py | {
"start": 1649,
"end": 13981
} | class ____:
def __init__(
self,
parent,
batch_size=13,
seq_length=7,
is_training=True,
use_input_mask=True,
use_token_type_ids=True,
use_labels=True,
vocab_size=99,
hidden_size=32,
num_hidden_layers=2,
num_attention_head... | Data2VecTextModelTester |
python | networkx__networkx | networkx/algorithms/tests/test_summarization.py | {
"start": 11804,
"end": 14331
} | class ____(AbstractSNAP):
def build_original_graph(self):
nodes = {
"A": {"color": "Red"},
"B": {"color": "Red"},
"C": {"color": "Red"},
"D": {"color": "Red"},
"E": {"color": "Blue"},
"F": {"color": "Blue"},
"G": {"color": "... | TestSNAPUndirected |
python | tensorflow__tensorflow | tensorflow/python/framework/convert_to_constants.py | {
"start": 22410,
"end": 22761
} | class ____(_FunctionCaller):
"""Specialization of _Node to If-like operations."""
def __init__(self, node, function, enclosing_graph):
super(_If, self).__init__(
node,
function,
enclosing_graph,
first_function_input=1,
type_attribute="Tin",
function_attributes=["... | _If |
python | numba__numba | numba/core/typing/npydecl.py | {
"start": 7336,
"end": 9295
} | class ____(Numpy_rules_ufunc):
_op_map = {
operator.add: "add",
operator.sub: "subtract",
operator.mul: "multiply",
operator.truediv: "true_divide",
operator.floordiv: "floor_divide",
operator.mod: "remainder",
operator.pow: "power",
operator.lshift: "... | NumpyRulesArrayOperator |
python | getsentry__sentry | src/sentry/auth_v2/endpoints/base.py | {
"start": 567,
"end": 644
} | class ____(Endpoint):
permission_classes = (AuthV2Permission,)
| AuthV2Endpoint |
python | catalyst-team__catalyst | catalyst/contrib/layers/common.py | {
"start": 137,
"end": 488
} | class ____(nn.Module):
"""Flattens the input. Does not affect the batch size.
@TODO: Docs (add `Example`). Contribution is welcome.
"""
def __init__(self):
"""@TODO: Docs. Contribution is welcome."""
super().__init__()
def forward(self, x):
"""Forward call."""
retu... | Flatten |
python | sqlalchemy__sqlalchemy | lib/sqlalchemy/dialects/postgresql/psycopg.py | {
"start": 8087,
"end": 8135
} | class ____(JSONPathType):
pass
| _PGJSONPathType |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/dataclassTransform1.py | {
"start": 707,
"end": 779
} | class ____:
id: int
name: str
@create_model(frozen=True)
| Customer1 |
python | pytorch__pytorch | torch/_inductor/codegen/memory_planning.py | {
"start": 18593,
"end": 19723
} | class ____(PoolMemoryPlanningLine):
"""Similar to AllocationLine, but takes memory from a pool"""
is_first_pool_usage: bool = False
def codegen(self, code: IndentedBuffer):
allocation = self.group.allocation
assert allocation and allocation.pool
pool = allocation.pool
name ... | AllocFromPoolLine |
python | kamyu104__LeetCode-Solutions | Python/divisor-game.py | {
"start": 36,
"end": 650
} | class ____(object):
def divisorGame(self, n):
"""
:type n: int
:rtype: bool
"""
# 1. if we get an even, we can choose x = 1
# to make the opponent always get an odd
# 2. if the opponent gets an odd, he can only choose x = 1 or other odds
# and we... | Solution |
python | pyinstaller__pyinstaller | bootloader/waflib/Tools/javaw.py | {
"start": 6583,
"end": 6883
} | class ____(Task.Task):
def split_argfile(self, cmd):
inline = [cmd[0]]
infile = []
for x in cmd[1:]:
if x.startswith('-J'):
inline.append(x)
else:
infile.append(self.quote_flag(x))
return (inline, infile)
| JTask |
python | pydata__xarray | xarray/tests/test_datatree.py | {
"start": 85600,
"end": 85904
} | class ____:
@pytest.mark.xfail(reason="__array_ufunc__ not implemented yet")
def test_tree(self, create_test_datatree):
dt = create_test_datatree()
expected = create_test_datatree(modify=np.sin)
result_tree = np.sin(dt)
assert_equal(result_tree, expected)
| TestUFuncs |
python | getsentry__sentry | src/sentry/workflow_engine/models/data_source_detector.py | {
"start": 187,
"end": 791
} | class ____(DefaultFieldsModel):
"""
Lookup table that maps a DataSource to a Detector. This is used to determine which detectors are available for a given data source.
"""
__relocation_scope__ = RelocationScope.Organization
data_source = FlexibleForeignKey("workflow_engine.DataSource")
detecto... | DataSourceDetector |
python | optuna__optuna | optuna/terminator/improvement/evaluator.py | {
"start": 3561,
"end": 7976
} | class ____(BaseImprovementEvaluator):
"""An error evaluator for upper bound on the regret with high-probability confidence.
This evaluator evaluates the regret of current best solution, which defined as the difference
between the objective value of the best solution and of the global optimum. To be specifi... | RegretBoundEvaluator |
python | facebookresearch__faiss | tests/test_factory.py | {
"start": 8028,
"end": 8278
} | class ____(unittest.TestCase):
def test_itq_transform(self):
codec = faiss.index_factory(16, "ITQ8,LSHt")
itqt = faiss.downcast_VectorTransform(codec.chain.at(0))
itqt.pca_then_itq
# tests after re-factoring
| TestVTDowncast |
python | Textualize__textual | docs/examples/guide/widgets/tooltip01.py | {
"start": 214,
"end": 546
} | class ____(App):
CSS = """
Screen {
align: center middle;
}
"""
def compose(self) -> ComposeResult:
yield Button("Click me", variant="success")
def on_mount(self) -> None:
self.query_one(Button).tooltip = TEXT
if __name__ == "__main__":
app = TooltipApp()
app.... | TooltipApp |
python | plotly__plotly.py | plotly/graph_objs/layout/annotation/_font.py | {
"start": 235,
"end": 9888
} | class ____(_BaseLayoutHierarchyType):
_parent_path_str = "layout.annotation"
_path_str = "layout.annotation.font"
_valid_props = {
"color",
"family",
"lineposition",
"shadow",
"size",
"style",
"textcase",
"variant",
"weight",
}
... | Font |
python | jmcnamara__XlsxWriter | xlsxwriter/test/comparison/test_comment12.py | {
"start": 315,
"end": 987
} | class ____(ExcelComparisonTest):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.set_filename("comment12.xlsx")
def test_create_file(self):
"""Test the creation of a simple XlsxWriter file with comments."""
workbook = Workboo... | TestCompareXLSXFiles |
python | spack__spack | var/spack/test_repos/spack_repo/builtin_mock/packages/hg_top_level/package.py | {
"start": 217,
"end": 416
} | class ____(Package):
"""Test package that does fetching with mercurial."""
homepage = "http://www.hg-fetch-example.com"
hg = "https://example.com/some/hg/repo"
version("1.0")
| HgTopLevel |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.