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 | pypa__pip | src/pip/_internal/commands/lock.py | {
"start": 636,
"end": 5870
} | class ____(RequirementCommand):
"""
EXPERIMENTAL - Lock packages and their dependencies from:
- PyPI (and other indexes) using requirement specifiers.
- VCS project urls.
- Local project directories.
- Local or remote source archives.
pip also supports locking from "requirements files", wh... | LockCommand |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 93781,
"end": 94362
} | class ____(sgqlc.types.Enum):
"""The possible states that can be requested when creating a check
run.
Enumeration Choices:
* `COMPLETED`: The check suite or run has been completed.
* `IN_PROGRESS`: The check suite or run is in progress.
* `PENDING`: The check suite or run is in pending state.
... | RequestableCheckStatusState |
python | plotly__plotly.py | plotly/graph_objs/icicle/marker/colorbar/_title.py | {
"start": 233,
"end": 4013
} | class ____(_BaseTraceHierarchyType):
_parent_path_str = "icicle.marker.colorbar"
_path_str = "icicle.marker.colorbar.title"
_valid_props = {"font", "side", "text"}
@property
def font(self):
"""
Sets this color bar's title font.
The 'font' property is an instance of Font
... | Title |
python | ray-project__ray | rllib/algorithms/impala/tests/test_impala.py | {
"start": 247,
"end": 2550
} | class ____(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
ray.init()
@classmethod
def tearDownClass(cls) -> None:
ray.shutdown()
def test_impala_minibatch_size_check(self):
config = (
impala.IMPALAConfig()
.environment("CartPole-v1")
... | TestIMPALA |
python | Lightning-AI__lightning | tests/tests_pytorch/models/test_hparams.py | {
"start": 10653,
"end": 10862
} | class ____(SubClassBoringModel):
def __init__(self, *args, my_loss=torch.nn.CrossEntropyLoss(), **kwargs):
super().__init__(*args, **kwargs)
self.save_hyperparameters()
| AggSubClassBoringModel |
python | sqlalchemy__sqlalchemy | test/orm/inheritance/test_relationship.py | {
"start": 1631,
"end": 1889
} | class ____(ComparableEntity):
pass
def _aliased_join_warning(arg):
return testing.expect_warnings(
r"An alias is being generated automatically against joined entity "
r"Mapper\[%s\] due to overlapping tables" % (arg,),
)
| Paperwork |
python | apache__airflow | providers/google/tests/unit/google/cloud/operators/test_cloud_memorystore.py | {
"start": 15891,
"end": 17053
} | class ____:
@mock.patch("airflow.providers.google.cloud.operators.cloud_memorystore.CloudMemorystoreMemcachedHook")
def test_assert_valid_hook_call(self, mock_hook):
mock_hook.return_value.create_instance.return_value = cloud_memcache.Instance()
task = CloudMemorystoreMemcachedCreateInstanceOper... | TestCloudMemorystoreMemcachedCreateInstanceOperator |
python | coleifer__peewee | tests/psycopg3_ext.py | {
"start": 14138,
"end": 15926
} | class ____(BaseBinaryJsonFieldTestCase, ModelTestCase):
M = BJson
N = Normal
database = db
requires = [BJson, Normal]
def test_remove_data(self):
BJson.delete().execute() # Clear out db.
BJson.create(data={
'k1': 'v1',
'k2': 'v2',
'k3': {'x1': 'z... | TestPsycopg3BinaryJsonField |
python | PyCQA__pylint | tests/functional/i/invalid/invalid_getnewargs/invalid_getnewargs_ex_returned.py | {
"start": 2257,
"end": 2465
} | class ____:
""" __getnewargs_ex__ returns node which does not have 'value' in AST """
def __getnewargs_ex__(self): # [invalid-getnewargs-ex-returned]
return lambda: (1, 2)
| SixthBadGetNewArgsEx |
python | boto__boto3 | boto3/docs/base.py | {
"start": 604,
"end": 1496
} | class ____:
def __init__(self, resource):
self._resource = resource
self._client = self._resource.meta.client
self._resource_model = self._resource.meta.resource_model
self._service_model = self._client.meta.service_model
self._resource_name = self._resource.meta.resource_mod... | BaseDocumenter |
python | pypa__setuptools | setuptools/_vendor/jaraco/collections/__init__.py | {
"start": 25548,
"end": 26640
} | class ____(RangeMap):
"""
Given parameters suitable for a dict representing keys
and a weighted proportion, return a RangeMap representing
spans of values proportial to the weights:
>>> even = WeightedLookup(a=1, b=1)
[0, 1) -> a
[1, 2) -> b
>>> lk = WeightedLookup(a=1, b=2)
[0, ... | WeightedLookup |
python | django__django | tests/db_functions/text/test_sha256.py | {
"start": 228,
"end": 1838
} | class ____(TestCase):
@classmethod
def setUpTestData(cls):
Author.objects.bulk_create(
[
Author(alias="John Smith"),
Author(alias="Jordan Élena"),
Author(alias="皇帝"),
Author(alias=""),
Author(alias=None),
... | SHA256Tests |
python | kamyu104__LeetCode-Solutions | Python/determine-whether-matrix-can-be-obtained-by-rotation.py | {
"start": 33,
"end": 621
} | class ____(object):
def findRotation(self, mat, target):
"""
:type mat: List[List[int]]
:type target: List[List[int]]
:rtype: bool
"""
checks = [lambda i, j: mat[i][j] == target[i][j],
lambda i, j: mat[i][j] == target[j][-1-i],
lamb... | Solution |
python | ray-project__ray | python/ray/data/_internal/execution/operators/input_data_buffer.py | {
"start": 250,
"end": 3671
} | class ____(PhysicalOperator):
"""Defines the input data for the operator DAG.
For example, this may hold cached blocks from a previous Dataset execution, or
the arguments for read tasks.
"""
def __init__(
self,
data_context: DataContext,
input_data: Optional[List[RefBundle]... | InputDataBuffer |
python | qdrant__qdrant-client | qdrant_client/http/models/models.py | {
"start": 12338,
"end": 12592
} | class ____(BaseModel):
"""
State of existence of a collection, true = exists, false = does not exist
"""
exists: bool = Field(..., description="State of existence of a collection, true = exists, false = does not exist")
| CollectionExistence |
python | allegroai__clearml | clearml/backend_api/services/v2_9/auth.py | {
"start": 4311,
"end": 4961
} | class ____(Request):
"""
Creates a new set of credentials for the authenticated user.
New key/secret is returned.
Note: Secret will never be returned in any other API call.
If a secret is lost or compromised, the key should be r... | CreateCredentialsRequest |
python | django__django | tests/model_formsets/models.py | {
"start": 2683,
"end": 2913
} | class ____(models.Model):
owner = models.OneToOneField(Owner, models.CASCADE, primary_key=True)
age = models.PositiveIntegerField()
def __str__(self):
return "%s is %d" % (self.owner.name, self.age)
| OwnerProfile |
python | PyCQA__pycodestyle | tests/test_blank_lines.py | {
"start": 3258,
"end": 3663
} | class ____(object):
pass
""")
self.assertEqual([
'E303:6:1', # some_function
'E303:15:1', # SomeFarClass
], result)
def test_method_more_blank_lines(self):
"""
It will trigger an error when more than 1 blank line is found
before method definitio... | AFarEnoughClass |
python | sympy__sympy | sympy/core/rules.py | {
"start": 28,
"end": 1496
} | class ____:
"""
Immutable mapping that can be used as a generic transformation rule.
Parameters
==========
transform : callable
Computes the value corresponding to any key.
filter : callable, optional
If supplied, specifies which objects are in the mapping.
Examples
=... | Transform |
python | ray-project__ray | rllib/examples/evaluation/evaluation_parallel_to_training.py | {
"start": 4478,
"end": 11661
} | class ____(RLlibCallback):
def on_train_result(
self,
*,
algorithm: Algorithm,
metrics_logger: Optional[MetricsLogger] = None,
result: ResultDict,
**kwargs,
):
# The eval results can be found inside the main `result` dict
# (old API stack: "evaluat... | AssertEvalCallback |
python | google__pytype | pytype/tests/test_recovery2.py | {
"start": 1329,
"end": 2175
} | class ____(test_base.BaseTest):
"""Tests for recovering after errors(python3 only)."""
def test_bad_call_parameter(self):
ty = self.Infer(
"""
def f():
return "%s" % chr("foo")
""",
report_errors=False,
)
self.assertTypesMatchPytd(
ty,
"""
... | RecoveryTestsPython3 |
python | PrefectHQ__prefect | src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py | {
"start": 363426,
"end": 364448
} | class ____(sgqlc.types.Interface):
"""
See source code for more info.
"""
__schema__ = graphql_schema
__field_names__ = ("labels",)
labels = sgqlc.types.Field(
LabelConnection,
graphql_name="labels",
args=sgqlc.types.ArgDict(
(
(
... | Labelable |
python | joke2k__faker | faker/providers/lorem/el_GR/__init__.py | {
"start": 68,
"end": 7458
} | class ____(LoremProvider):
"""Implement lorem provider for ``el_GR`` locale."""
common_words = (
"άρα",
"ένα",
"ένας",
"έξι",
"έτσι",
"έχω",
"ήδη",
"ίδιο",
"αν",
"ανά",
"από",
"ας",
"για",
"δε",
... | Provider |
python | getsentry__sentry | src/sentry/monitors/validators.py | {
"start": 4519,
"end": 10435
} | class ____(serializers.Serializer):
schedule_type = serializers.ChoiceField(
choices=list(zip(SCHEDULE_TYPES.keys(), SCHEDULE_TYPES.keys())),
help_text='Currently supports "crontab" or "interval"',
# The schedule_type IS required when the `type` is not part of the
# `schedule` object... | ConfigValidator |
python | run-llama__llama_index | llama-index-core/llama_index/core/ingestion/transformations.py | {
"start": 1264,
"end": 1778
} | class ____(BaseModel):
"""A description for a category of transformation within a pipeline."""
name: str = Field(description="Unique name of the type of transformation")
description: str = Field(description="Description for the type of transformation")
input_type: TransformationIOType = Field(
... | TransformationCategory |
python | run-llama__llama_index | llama-index-core/llama_index/core/node_parser/text/langchain.py | {
"start": 482,
"end": 1495
} | class ____(TextSplitter):
"""
Basic wrapper around langchain's text splitter.
TODO: Figure out how to make this metadata aware.
"""
_lc_splitter: "LC_TextSplitter" = PrivateAttr()
def __init__(
self,
lc_splitter: "LC_TextSplitter",
callback_manager: Optional[CallbackMa... | LangchainNodeParser |
python | fastapi__sqlmodel | docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial002.py | {
"start": 338,
"end": 3385
} | 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", ondelete="SET NULL"
)
... | Hero |
python | astropy__astropy | astropy/utils/masked/tests/test_function_helpers.py | {
"start": 22709,
"end": 25408
} | class ____(MaskedArraySetup):
def check(self, function, *args, method=None, **kwargs):
if method is None:
method = function.__name__
o = function(self.ma, *args, **kwargs)
x = getattr(self.ma, method)(*args, **kwargs)
assert_masked_equal(o, x)
def test_max(self):
... | TestMethodLikes |
python | django__django | tests/migrations/test_migrations_manual_porting/0002_second.py | {
"start": 81,
"end": 280
} | class ____(migrations.Migration):
dependencies = [
("migrations", "0001_initial"),
]
operations = [
migrations.RunPython(forwards, migrations.RunPython.noop),
]
| Migration |
python | encode__django-rest-framework | tests/test_metadata.py | {
"start": 12114,
"end": 14951
} | class ____(TestCase):
def test_read_only_primary_key_related_field(self):
"""
On generic views OPTIONS should return an 'actions' key with metadata
on the fields that may be supplied to PUT and POST requests. It should
not fail when a read_only PrimaryKeyRelatedField is present
... | TestModelSerializerMetadata |
python | jmcnamara__XlsxWriter | xlsxwriter/test/comparison/test_chart_theme03.py | {
"start": 350,
"end": 2146
} | class ____(ExcelComparisonTest):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.set_filename("chart_theme03.xlsx")
def test_create_file(self):
"""Test the creation of an XlsxWriter file with chart formatting."""
workbook = Wo... | TestCompareXLSXFiles |
python | Lightning-AI__lightning | examples/pytorch/basics/backbone_image_classifier.py | {
"start": 1262,
"end": 1751
} | class ____(torch.nn.Module):
"""
>>> Backbone() # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
Backbone(
(l1): Linear(...)
(l2): Linear(...)
)
"""
def __init__(self, hidden_dim=128):
super().__init__()
self.l1 = torch.nn.Linear(28 * 28, hidden_dim)
self.l2 = tor... | Backbone |
python | huggingface__transformers | tests/models/speech_to_text/test_modeling_speech_to_text.py | {
"start": 26274,
"end": 28611
} | class ____(unittest.TestCase):
@classmethod
def setUpClass(cls):
model_name = "facebook/s2t-small-librispeech-asr"
cls.model = Speech2TextForConditionalGeneration.from_pretrained(model_name, use_safetensors=False)
cls.processor = Speech2TextProcessor.from_pretrained(model_name)
#... | Speech2TextModelIntegrationTests |
python | ray-project__ray | python/ray/dashboard/modules/tests/test_head.py | {
"start": 531,
"end": 3243
} | class ____(dashboard_utils.DashboardHeadModule):
def __init__(self, config: dashboard_utils.DashboardHeadModuleConfig):
super().__init__(config)
@staticmethod
def is_minimal_module():
return False
@routes.get("/test/route_get")
async def route_get(self, req) -> aiohttp.web.Response... | TestHead |
python | sphinx-doc__sphinx | sphinx/errors.py | {
"start": 2567,
"end": 2882
} | class ____(SphinxError):
"""Sphinx parallel build error."""
category = 'Sphinx parallel build error'
def __init__(self, message: str, traceback: str) -> None:
self.message = message
self.traceback = traceback
def __str__(self) -> str:
return self.message
| SphinxParallelError |
python | kubernetes-client__python | kubernetes/client/api/internal_apiserver_api.py | {
"start": 543,
"end": 5208
} | 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
... | InternalApiserverApi |
python | sqlalchemy__sqlalchemy | test/dialect/mysql/test_types.py | {
"start": 17136,
"end": 26913
} | class ____(fixtures.TestBase, AssertsExecutionResults):
__dialect__ = mysql.dialect()
__only_on__ = "mysql", "mariadb"
__backend__ = True
# fixed in mysql-connector as of 2.0.1,
# see https://bugs.mysql.com/bug.php?id=73266
@testing.requires.literal_float_coercion
def test_precision_float_... | TypeRoundTripTest |
python | django__django | tests/model_regress/models.py | {
"start": 932,
"end": 1065
} | class ____(models.Model):
id = models.PositiveIntegerField(primary_key=True)
name = models.CharField(max_length=200)
| Department |
python | apache__airflow | providers/google/tests/unit/google/cloud/operators/test_dlp.py | {
"start": 26847,
"end": 27661
} | class ____:
@mock.patch("airflow.providers.google.cloud.operators.dlp.CloudDLPHook")
def test_update_job_trigger(self, mock_hook):
mock_hook.return_value.update_job_trigger.return_value = JobTrigger()
operator = CloudDLPUpdateJobTriggerOperator(job_trigger_id=TRIGGER_ID, task_id="id")
op... | TestCloudDLPUpdateJobTriggerOperator |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/protocol37.py | {
"start": 129,
"end": 248
} | class ____(type):
def __iter__(cls) -> Iterator[str]:
yield "a"
yield "b"
yield "c"
| StyleMeta |
python | zarr-developers__zarr-python | src/zarr/codecs/numcodecs/_codecs.py | {
"start": 11409,
"end": 11478
} | class ____(_NumcodecsChecksumCodec, codec_name="crc32"):
pass
| CRC32 |
python | pytest-dev__pytest | src/_pytest/mark/structures.py | {
"start": 2288,
"end": 8239
} | class ____(NamedTuple):
"""A set of values for a set of parameters along with associated marks and
an optional ID for the set.
Examples::
pytest.param(1, 2, 3)
# ParameterSet(values=(1, 2, 3), marks=(), id=None)
pytest.param("hello", id="greeting")
# ParameterSet(values=("... | ParameterSet |
python | giampaolo__psutil | tests/test_unicode.py | {
"start": 3887,
"end": 4569
} | class ____(PsutilTestCase):
funky_suffix = None
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.skip_tests = False
cls.funky_name = None
if cls.funky_suffix is not None:
if not try_unicode(cls.funky_suffix):
cls.skip_tests = True
... | BaseUnicodeTest |
python | PrefectHQ__prefect | src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py | {
"start": 715266,
"end": 725956
} | class ____(sgqlc.types.Type, Node, GitObject, Subscribable, UniformResourceLocatable):
"""
See source code for more info.
"""
__schema__ = graphql_schema
__field_names__ = (
"additions",
"associated_pull_requests",
"author",
"authored_by_committer",
"authored... | Commit |
python | allegroai__clearml | clearml/backend_api/services/v2_13/tasks.py | {
"start": 148045,
"end": 148908
} | class ____(Response):
"""
Response of tasks.create endpoint.
:param id: ID of the task
:type id: str
"""
_service = "tasks"
_action = "create"
_version = "2.13"
_schema = {
"definitions": {},
"properties": {"id": {"description": "ID of the task", "type": ["string", ... | CreateResponse |
python | huggingface__transformers | src/transformers/models/mbart/modeling_mbart.py | {
"start": 11272,
"end": 13972
} | class ____(GradientCheckpointingLayer):
def __init__(self, config: MBartConfig):
super().__init__()
self.embed_dim = config.d_model
self.self_attn = MBartAttention(
embed_dim=self.embed_dim,
num_heads=config.encoder_attention_heads,
dropout=config.attenti... | MBartEncoderLayer |
python | numba__numba | numba/core/target_extension.py | {
"start": 3819,
"end": 3880
} | class ____(Generic):
"""Mark the target as CPU.
"""
| CPU |
python | doocs__leetcode | solution/1400-1499/1467.Probability of a Two Boxes Having The Same Number of Distinct Balls/Solution.py | {
"start": 0,
"end": 587
} | class ____:
def getProbability(self, balls: List[int]) -> float:
@cache
def dfs(i: int, j: int, diff: int) -> float:
if i >= k:
return 1 if j == 0 and diff == 0 else 0
if j < 0:
return 0
ans = 0
for x in range(balls[i] +... | Solution |
python | huggingface__transformers | tests/models/tapas/test_modeling_tapas.py | {
"start": 36118,
"end": 43693
} | class ____(unittest.TestCase):
def _prepare_tables(self):
"""Prepares two tables, both with three distinct rows.
The first table has two columns:
1.0, 2.0 | 3.0
2.0, 0.0 | 1.0
1.0, 3.0 | 4.0
The second table has three columns:
1.0 | 2.0 | 3.0
2.0 | 0.0... | TapasUtilitiesTest |
python | dagster-io__dagster | python_modules/libraries/dagster-shared/dagster_shared/check/decorator.py | {
"start": 326,
"end": 3619
} | class ____(ABC):
"""Output of the @checked decorator, this class holds a reference to the decorated function
and upon first invocation compiles a wrapping function that performs run time type checks on
annotated inputs.
This class is not directly instantiated, but instead dynamic subclasses are created... | CheckedFnWrapper |
python | getsentry__sentry | src/sentry/codecov/enums.py | {
"start": 284,
"end": 464
} | class ____(Enum):
FLAKY_TESTS = "FLAKY_TESTS"
FAILED_TESTS = "FAILED_TESTS"
SLOWEST_TESTS = "SLOWEST_TESTS"
SKIPPED_TESTS = "SKIPPED_TESTS"
| TestResultsFilterParameter |
python | allegroai__clearml | clearml/backend_api/services/v2_23/auth.py | {
"start": 8914,
"end": 10544
} | class ____(Request):
"""
Updates the label of the existing credentials for the authenticated user.
:param access_key: Existing credentials key
:type access_key: str
:param label: New credentials label
:type label: str
"""
_service = "auth"
_action = "edit_credentials"
_version ... | EditCredentialsRequest |
python | plotly__plotly.py | plotly/graph_objs/isosurface/caps/_z.py | {
"start": 233,
"end": 4043
} | class ____(_BaseTraceHierarchyType):
_parent_path_str = "isosurface.caps"
_path_str = "isosurface.caps.z"
_valid_props = {"fill", "show"}
@property
def fill(self):
"""
Sets the fill ratio of the `caps`. The default fill value of
the `caps` is 1 meaning that they are entirely... | Z |
python | jazzband__prettytable | tests/test_sections.py | {
"start": 86,
"end": 1674
} | class ____:
EXPECTED_RESULT = """
┌──────────┬──────────┬──────────┐
│ Field 1 │ Field 2 │ Field 3 │
├──────────┼──────────┼──────────┤
│ value 4 │ value 5 │ value 6 │
│ value 7 │ value 8 │ value 9 │
├──────────┼──────────┼──────────┤
│ value 10 │ value 11 │ value 12 │
└──────────┴──────────┴──────────┘
""... | TestRowEndSection |
python | python-excel__xlwt | xlwt/BIFFRecords.py | {
"start": 36438,
"end": 38199
} | class ____(BiffRecord):
"""
STYLE record for user-defined cell styles, BIFF3-BIFF8:
Offset Size Contents
0 2 Bit Mask Contents
11-0 0FFFH Index to style XF record
15 8000H Always 0 for user-defined styles
2 var. BIFF... | StyleRecord |
python | airbytehq__airbyte | airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/generate_erd/pipeline.py | {
"start": 1099,
"end": 4793
} | class ____(Step):
context: ConnectorContext
title = "Generate DBML file"
def __init__(self, context: PipelineContext, skip_relationship_generation: bool) -> None:
super().__init__(context)
self._skip_relationship_generation = skip_relationship_generation
async def _run(self, connector... | GenerateDbml |
python | walkccc__LeetCode | solutions/3069. Distribute Elements Into Two Arrays I/3069.py | {
"start": 0,
"end": 272
} | class ____:
def resultArray(self, nums: list[int]) -> list[int]:
arr1 = [nums[0]]
arr2 = [nums[1]]
for i in range(2, len(nums)):
if arr1[-1] > arr2[-1]:
arr1.append(nums[i])
else:
arr2.append(nums[i])
return arr1 + arr2
| Solution |
python | crytic__slither | slither/detectors/assembly/shift_parameter_mixup.py | {
"start": 408,
"end": 2858
} | class ____(AbstractDetector):
"""
Check for cases where a return(a,b) is used in an assembly function that also returns two variables
"""
ARGUMENT = "incorrect-shift"
HELP = "The order of parameters in a shift instruction is incorrect."
IMPACT = DetectorClassification.HIGH
CONFIDENCE = Dete... | ShiftParameterMixup |
python | numba__numba | numba/tests/test_extending.py | {
"start": 44012,
"end": 46082
} | class ____(unittest.TestCase):
@unittest.skipIf(sc is None, "Only run if SciPy >= 0.19 is installed")
def test_getting_function(self):
addr = get_cython_function_address(
"scipy.special.cython_special", "j0"
)
functype = ctypes.CFUNCTYPE(ctypes.c_double, ctypes.c_double)
... | TestImportCythonFunction |
python | scipy__scipy | scipy/integrate/_ivp/lsoda.py | {
"start": 9752,
"end": 10162
} | class ____(DenseOutput):
def __init__(self, t_old, t, h, order, yh):
super().__init__(t_old, t)
self.h = h
self.yh = yh
self.p = np.arange(order + 1)
def _call_impl(self, t):
if t.ndim == 0:
x = ((t - self.t) / self.h) ** self.p
else:
x = ... | LsodaDenseOutput |
python | dask__dask | dask/dataframe/dask_expr/_reductions.py | {
"start": 39023,
"end": 39608
} | class ____(Reduction):
_parameters = ["frame", "b", "split_every"]
_defaults = {"b": 16, "split_every": None}
reduction_chunk = hyperloglog.compute_hll_array
reduction_combine = hyperloglog.reduce_state
reduction_aggregate = hyperloglog.estimate_count
@functools.cached_property
def _meta(se... | NuniqueApprox |
python | dagster-io__dagster | python_modules/dagster/dagster/_core/execution/context/metadata_logging.py | {
"start": 225,
"end": 315
} | class ____:
output_name: str
mapping_key: Optional[str]
@record
| OutputMetadataHandle |
python | charliermarsh__ruff | crates/ruff_linter/resources/test/fixtures/refurb/FURB180.py | {
"start": 485,
"end": 587
} | class ____(type):
def __new__(cls, *args, **kwargs):
return super().__new__(cls, *args)
| Meta |
python | getsentry__sentry | src/sentry/workflow_engine/utils/scopedstats.py | {
"start": 2526,
"end": 6049
} | class ____:
"""Records statistics during context blocks. Use with record() context manager."""
__slots__ = ("_data", "_has_recorded")
def __init__(self) -> None:
self._data: dict[str, dict[tuple[tuple[str, str | bool], ...], int | float]] = defaultdict(
lambda: defaultdict(int)
... | Recorder |
python | huggingface__transformers | src/transformers/models/evolla/modular_evolla.py | {
"start": 5706,
"end": 5762
} | class ____(EsmSelfOutput):
pass
| EvollaSaProtSelfOutput |
python | charliermarsh__ruff | crates/ruff_linter/resources/test/fixtures/flake8_async/ASYNC230.py | {
"start": 872,
"end": 1069
} | class ____:
def open(self):
pass
async def func():
Foo().open() # OK
async def func():
def open():
pass
open() # OK
def func():
Path("foo").open() # OK
| Foo |
python | huggingface__transformers | src/transformers/models/olmoe/modeling_olmoe.py | {
"start": 20329,
"end": 27085
} | class ____(OlmoePreTrainedModel):
def __init__(self, config: OlmoeConfig):
super().__init__(config)
self.padding_idx = config.pad_token_id
self.vocab_size = config.vocab_size
self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx)
self.layers... | OlmoeModel |
python | buildout__buildout | src/zc/buildout/buildout.py | {
"start": 2038,
"end": 2383
} | class ____(zc.buildout.UserError, KeyError):
"""A required section is missing.
"""
def __str__(self):
return "The referenced section, %r, was not defined." % self.args[0]
def _annotate_section(section, source):
for key in section:
section[key] = SectionKey(section[key], source)
re... | MissingSection |
python | kamyu104__LeetCode-Solutions | Python/maximum-alternating-sum-of-squares.py | {
"start": 1505,
"end": 1751
} | class ____(object):
def maxAlternatingSum(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
arr = sorted(x**2 for x in nums)
return sum(arr)-2*sum(arr[i] for i in xrange(len(arr)//2))
| Solution2 |
python | xlwings__xlwings | xlwings/base_classes.py | {
"start": 4701,
"end": 5137
} | class ____:
@property
def api(self):
raise NotImplementedError()
@property
def active(self):
raise NotImplementedError()
def __call__(self, name_or_index):
raise NotImplementedError()
def __len__(self):
raise NotImplementedError()
def __iter__(self):
... | Sheets |
python | EpistasisLab__tpot | tpot/builtin_modules/arithmetictransformer.py | {
"start": 14710,
"end": 15340
} | class ____(TransformerMixin, BaseEstimator):
def __init__(self, n):
"""
A transformer that returns an array of n.
"""
self.n = n
def fit(self, X, y=None):
return self
def transform(self, X):
transformed_X = np.array(self.transform_helper(np.array(X)))
... | NTransformer |
python | dagster-io__dagster | examples/assets_dbt_python/assets_dbt_python/assets/dbt.py | {
"start": 247,
"end": 1073
} | class ____(DagsterDbtTranslator):
def get_asset_key(self, dbt_resource_props: Mapping[str, Any]) -> AssetKey:
asset_key = super().get_asset_key(dbt_resource_props)
if dbt_resource_props["resource_type"] == "model":
asset_key = asset_key.with_prefix(["duckdb", "dbt_schema"])
if d... | CustomDagsterDbtTranslator |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 555174,
"end": 555517
} | class ____(sgqlc.types.Type):
"""Autogenerated return type of DeleteIssueComment"""
__schema__ = github_schema
__field_names__ = ("client_mutation_id",)
client_mutation_id = sgqlc.types.Field(String, graphql_name="clientMutationId")
"""A unique identifier for the client performing the mutation."""
... | DeleteIssueCommentPayload |
python | sqlalchemy__sqlalchemy | test/orm/inheritance/test_basic.py | {
"start": 60152,
"end": 62554
} | class ____(fixtures.MappedTest):
@classmethod
def define_tables(cls, metadata):
Table(
"a",
metadata,
Column(
"id", Integer, primary_key=True, test_needs_autoincrement=True
),
)
Table("b", metadata, Column("id", Integer, pri... | JoinedNoFKSortingTest |
python | astropy__astropy | astropy/modeling/tests/test_constraints.py | {
"start": 720,
"end": 3849
} | class ____:
def setup_class(self):
self.g1 = models.Gaussian1D(10, 14.9, stddev=0.3)
self.g2 = models.Gaussian1D(10, 13, stddev=0.4)
self.x = np.arange(10, 20, 0.1)
self.y1 = self.g1(self.x)
self.y2 = self.g2(self.x)
rsn = default_rng(1234567890)
self.n = rsn.... | TestNonLinearConstraints |
python | huggingface__transformers | examples/pytorch/language-modeling/run_fim.py | {
"start": 6244,
"end": 36187
} | class ____:
"""
Arguments pertaining to what data we are going to input our model for training and eval.
"""
dataset_name: Optional[str] = field(
default=None, metadata={"help": "The name of the dataset to use (via the datasets library)."}
)
dataset_config_name: Optional[str] = field(
... | DataTrainingArguments |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 966355,
"end": 967129
} | class ____(sgqlc.types.relay.Connection):
"""The connection type for SecurityVulnerability."""
__schema__ = github_schema
__field_names__ = ("edges", "nodes", "page_info", "total_count")
edges = sgqlc.types.Field(sgqlc.types.list_of("SecurityVulnerabilityEdge"), graphql_name="edges")
"""A list of e... | SecurityVulnerabilityConnection |
python | jupyterlab__jupyterlab | jupyterlab/extensions/manager.py | {
"start": 6245,
"end": 6518
} | class ____:
"""Extensions cache
Attributes:
cache: Extension list per page
last_page: Last available page result
"""
cache: dict[int, Optional[dict[str, ExtensionPackage]]] = field(default_factory=dict)
last_page: int = 1
| ExtensionsCache |
python | pypa__warehouse | tests/unit/admin/views/test_organizations.py | {
"start": 38873,
"end": 41265
} | class ____:
@freeze_time("2024-01-15")
def test_validate_success(self):
form_data = MultiDict(
{
"seat_limit": "25",
"expires": (date.today() + timedelta(days=365)).isoformat(),
}
)
form = views.ManualActivationForm(formdata=form_da... | TestManualActivationForm |
python | kennethreitz__tablib | src/tablib/formats/_xlsx.py | {
"start": 308,
"end": 4490
} | class ____:
title = 'xlsx'
extensions = ('xlsx',)
@classmethod
def detect(cls, stream):
"""Returns True if given stream is a readable excel file."""
try:
# No need to fully load the file, it should be enough to be able to
# read the manifest.
reader =... | XLSXFormat |
python | spyder-ide__spyder | spyder/plugins/variableexplorer/widgets/texteditor.py | {
"start": 1125,
"end": 1186
} | class ____:
Copy = 'copy_section'
| TextEditorToolbarSections |
python | scrapy__scrapy | scrapy/commands/settings.py | {
"start": 114,
"end": 1986
} | class ____(ScrapyCommand):
requires_crawler_process = False
default_settings = {"LOG_ENABLED": False}
def syntax(self) -> str:
return "[options]"
def short_desc(self) -> str:
return "Get settings values"
def add_options(self, parser: argparse.ArgumentParser) -> None:
super... | Command |
python | airbytehq__airbyte | airbyte-ci/connectors/ci_credentials/ci_credentials/models.py | {
"start": 298,
"end": 1715
} | class ____:
connector_name: str
configuration_file_name: str
value: str
@property
def name(self) -> str:
return self.generate_secret_name(self.connector_name, self.configuration_file_name)
@staticmethod
def generate_secret_name(connector_name: str, configuration_file_name: str) -> ... | Secret |
python | weaviate__weaviate-python-client | weaviate/collections/classes/config.py | {
"start": 63626,
"end": 63990
} | class ____(_ConfigBase):
distance_metric: VectorDistances
hnsw: Optional[VectorIndexConfigHNSW]
flat: Optional[VectorIndexConfigFlat]
threshold: Optional[int]
@staticmethod
def vector_index_type() -> str:
return VectorIndexType.DYNAMIC.value
VectorIndexConfigDynamic = _VectorIndexConf... | _VectorIndexConfigDynamic |
python | run-llama__llama_index | llama-index-integrations/tools/llama-index-tools-notion/llama_index/tools/notion/base.py | {
"start": 494,
"end": 754
} | class ____(BaseModel):
"""Notion search data schema."""
query: str
direction: Optional[str] = None
timestamp: Optional[str] = None
value: Optional[str] = None
property: Optional[str] = None
page_size: int = 100
| NotionSearchDataSchema |
python | realpython__materials | python-langgraph/chains/escalation_check.py | {
"start": 134,
"end": 914
} | class ____(BaseModel):
needs_escalation: bool = Field(
description="""Whether the notice requires escalation according
to specified criteria"""
)
escalation_prompt = ChatPromptTemplate.from_messages(
[
(
"system",
"""
Determine whether the follow... | EscalationCheck |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 92897,
"end": 93281
} | class ____(sgqlc.types.Enum):
"""The possible scopes of an alert's dependency.
Enumeration Choices:
* `DEVELOPMENT`: A dependency that is only used in development
* `RUNTIME`: A dependency that is leveraged during application
runtime
"""
__schema__ = github_schema
__choices__ = ("DE... | RepositoryVulnerabilityAlertDependencyScope |
python | spyder-ide__spyder | spyder/plugins/statusbar/widgets/tests/test_status.py | {
"start": 472,
"end": 1045
} | class ____(QMainWindow):
pass
@pytest.fixture
def status_bar(qtbot):
"""Set up StatusBarWidget."""
window = MainWindowMock()
plugin = StatusBar(parent=window, configuration=CONF)
plugin.remove_status_widgets()
plugin.initialize()
qtbot.addWidget(window)
window.resize(640, 480)
win... | MainWindowMock |
python | openai__openai-python | src/openai/resources/conversations/items.py | {
"start": 11525,
"end": 21967
} | class ____(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncItemsWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.gith... | AsyncItems |
python | django__django | tests/admin_views/admin.py | {
"start": 16026,
"end": 16291
} | class ____(forms.ModelForm):
model = FieldOverridePost
class Meta:
help_texts = {
"posted": "Overridden help text for the date",
}
labels = {
"public": "Overridden public label",
}
| FieldOverridePostForm |
python | anthropics__anthropic-sdk-python | src/anthropic/types/beta/messages/beta_message_batch_individual_response.py | {
"start": 235,
"end": 828
} | class ____(BaseModel):
custom_id: str
"""Developer-provided ID created for each request in a Message Batch.
Useful for matching results to requests, as results may be given out of request
order.
Must be unique for each request within the Message Batch.
"""
result: BetaMessageBatchResult
... | BetaMessageBatchIndividualResponse |
python | getsentry__sentry-python | sentry_sdk/tracing_utils.py | {
"start": 11670,
"end": 18103
} | class ____:
"""
The PropagationContext represents the data of a trace in Sentry.
"""
__slots__ = (
"_trace_id",
"_span_id",
"parent_span_id",
"parent_sampled",
"baggage",
)
def __init__(
self,
trace_id=None, # type: Optional[str]
... | PropagationContext |
python | getsentry__sentry | src/sentry/dynamic_sampling/rules/utils.py | {
"start": 3280,
"end": 3393
} | class ____(TypedDict):
samplingValue: SamplingValue
type: str
condition: RuleCondition
id: int
| Rule |
python | google__jax | tests/dynamic_api_test.py | {
"start": 36955,
"end": 48836
} | class ____(jtu.JaxTestCase):
def test_jit_basic(self):
@jax.jit
def f(i):
return jnp.sum(jnp.ones(i, dtype='float32'))
self.assertAllClose(f(3), jnp.array(3., dtype='float32'), check_dtypes=True)
def test_jit_basic_2(self):
count = 0
@jax.jit(abstracted_axes=('n',))
def f(x):
n... | DynamicShapeExecutionTest |
python | plotly__plotly.py | plotly/graph_objs/scattergl/_line.py | {
"start": 233,
"end": 4250
} | class ____(_BaseTraceHierarchyType):
_parent_path_str = "scattergl"
_path_str = "scattergl.line"
_valid_props = {"color", "dash", "shape", "width"}
@property
def color(self):
"""
Sets the line color.
The 'color' property is a color and may be specified as:
- A hex... | Line |
python | redis__redis-py | redis/_parsers/commands.py | {
"start": 1282,
"end": 3073
} | class ____:
def _get_pubsub_keys(self, *args):
"""
Get the keys from pubsub command.
Although PubSub commands have predetermined key locations, they are not
supported in the 'COMMAND's output, so the key positions are hardcoded
in this method
"""
if len(args) ... | AbstractCommandsParser |
python | wandb__wandb | wandb/sdk/artifacts/_generated/artifact_by_id.py | {
"start": 221,
"end": 324
} | class ____(GQLResult):
artifact: Optional[ArtifactFragment]
ArtifactByID.model_rebuild()
| ArtifactByID |
python | has2k1__plotnine | plotnine/scales/scale_color.py | {
"start": 620,
"end": 1039
} | class ____(
scale_continuous[Literal["legend", "colorbar"] | None],
):
"""
Base class for all continuous color scales
"""
_aesthetics = ["color"]
_: KW_ONLY
guide: Literal["legend", "colorbar"] | None = "colorbar"
na_value: str = "#7F7F7F"
"""
Color of missing values.
"""
... | _scale_color_continuous |
python | networkx__networkx | networkx/algorithms/planarity.py | {
"start": 25509,
"end": 49887
} | class ____(nx.DiGraph):
"""Represents a planar graph with its planar embedding.
The planar embedding is given by a `combinatorial embedding
<https://en.wikipedia.org/wiki/Graph_embedding#Combinatorial_embedding>`_.
.. note:: `check_planarity` is the preferred way to check if a graph is planar.
**... | PlanarEmbedding |
python | pytorch__pytorch | torch/_inductor/codegen/mps_device_op_overrides.py | {
"start": 106,
"end": 671
} | class ____(DeviceOpOverrides):
def device_guard(self, device_idx: int) -> str:
assert device_idx == 0
return "torch._ops.contextlib.nullcontext()"
def set_device(self, device_idx: int) -> str:
assert device_idx == 0
return "pass # MPS set device"
def kernel_driver(self) ->... | MPSDeviceOpOverrides |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.