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 | psf__black | tests/data/cases/comments9.py | {
"start": 1978,
"end": 3160
} | class ____:
# First method has no empty lines between bare class def.
# More comments.
def first_method(self):
pass
# Regression test for https://github.com/psf/black/issues/3454.
def foo():
pass
# Trailing comment that belongs to this function
@decorator1
@decorator2 # fmt: skip
def ba... | MyClass |
python | encode__django-rest-framework | tests/models.py | {
"start": 649,
"end": 739
} | class ____(RESTFrameworkModel):
name = models.CharField(max_length=100)
| ManyToManyTarget |
python | altair-viz__altair | altair/vegalite/v6/schema/core.py | {
"start": 1216936,
"end": 1223242
} | class ____(Spec, NonNormalizedSpec):
"""
ConcatSpecGenericSpec schema wrapper.
Base interface for a generalized concatenation specification.
Parameters
----------
concat : Sequence[dict, :class:`Spec`, :class:`FacetSpec`, :class:`LayerSpec`, :class:`RepeatSpec`, :class:`FacetedUnitSpec`, :clas... | ConcatSpecGenericSpec |
python | pypa__warehouse | tests/unit/accounts/test_core.py | {
"start": 936,
"end": 1750
} | class ____:
def test_with_user_context_no_macaroon(self, db_request):
user = UserFactory.create()
user_ctx = UserContext(user, None)
request = pretend.stub(identity=user_ctx)
assert accounts._user(request) is user
def test_with_user_token_context_macaroon(self, db_request):
... | TestUser |
python | jazzband__django-model-utils | tests/models.py | {
"start": 10577,
"end": 10740
} | class ____(models.Model):
NAMED_STATUS = Choices((0, "no", "No"), (1, "yes", "Yes"))
status = StatusField(choices_name='NAMED_STATUS')
| StatusFieldChoicesName |
python | getsentry__sentry | tests/sentry/seer/autofix/test_autofix.py | {
"start": 49602,
"end": 52232
} | class ____(TestCase):
def setUp(self) -> None:
super().setUp()
self.organization = self.create_organization()
self.project = self.create_project(organization=self.organization)
self.trace_id = "1234567890abcdef1234567890abcdef"
self.now = before_now(minutes=0)
@patch("se... | TestGetLogsForEvent |
python | pyca__cryptography | tests/x509/test_x509.py | {
"start": 5222,
"end": 20964
} | class ____:
def test_load_pem_crl(self, backend):
crl = _load_cert(
os.path.join("x509", "custom", "crl_all_reasons.pem"),
x509.load_pem_x509_crl,
)
assert isinstance(crl, x509.CertificateRevocationList)
fingerprint = binascii.hexlify(crl.fingerprint(hashes.S... | TestCertificateRevocationList |
python | Textualize__textual | tests/toggles/test_radioset.py | {
"start": 131,
"end": 5209
} | class ____(App[None]):
def __init__(self):
super().__init__()
self.events_received = []
def compose(self) -> ComposeResult:
with RadioSet(id="from_buttons"):
yield RadioButton(id="clickme")
yield RadioButton()
yield RadioButton(value=True)
yie... | RadioSetApp |
python | pytorch__pytorch | torch/_inductor/fx_passes/micro_pipeline_tp.py | {
"start": 15766,
"end": 40174
} | class ____(_Matmul):
A_scale_node: torch.fx.Node
B_scale_node: torch.fx.Node
bias_node: torch.fx.Node | None
result_scale_node: torch.fx.Node | None
out_dtype: torch.dtype | None
use_fast_accum: bool
pre_mm_reshape: torch.fx.Node | None
post_mm_reshape: torch.fx.Node | None
def __po... | _ScaledMatmul |
python | apache__airflow | providers/apache/cassandra/tests/unit/apache/cassandra/hooks/test_cassandra.py | {
"start": 1820,
"end": 9023
} | class ____:
def test_init_with_valid_connection(self, mock_cassandra_hook):
assert isinstance(mock_cassandra_hook.cluster, Cluster)
assert mock_cassandra_hook.cluster.contact_points == ["127.0.0.1", "127.0.0.2"]
assert mock_cassandra_hook.cluster.port == 9042
assert isinstance(mock_c... | TestCassandraHook |
python | PyCQA__pylint | tests/functional/f/first_arg.py | {
"start": 79,
"end": 441
} | class ____:
# C0202, classmethod
def __new__(something): # [bad-classmethod-argument]
pass
# C0202, classmethod
def class1(cls):
pass
class1 = classmethod(class1) # [no-classmethod-decorator]
def class2(other): # [bad-classmethod-argument]
pass
class2 = classmeth... | Obj |
python | tensorflow__tensorflow | tensorflow/python/kernel_tests/metrics_test.py | {
"start": 120903,
"end": 124320
} | class ____(test.TestCase):
def setUp(self):
ops.reset_default_graph()
@test_util.run_deprecated_v1
def testVars(self):
metrics.mean_relative_error(
predictions=array_ops.ones((10, 1)),
labels=array_ops.ones((10, 1)),
normalizer=array_ops.ones((10, 1)))
_assert_metric_variable... | MeanRelativeErrorTest |
python | catalyst-team__catalyst | catalyst/contrib/optimizers/adamp.py | {
"start": 104,
"end": 6320
} | class ____(Optimizer):
"""Implements AdamP algorithm.
The original Adam algorithm was proposed in
`Adam: A Method for Stochastic Optimization`_.
The AdamP variant was proposed in
`Slowing Down the Weight Norm Increase in Momentum-based Optimizers`_.
Arguments:
params: iterable of param... | AdamP |
python | dagster-io__dagster | python_modules/libraries/dagster-datahub/dagster_datahub/resources.py | {
"start": 2993,
"end": 3310
} | class ____(Config):
bootstrap: str = Field(description="Kafka Boostrap Servers. Comma delimited")
schema_registry_url: str = Field(description="Schema Registry Location.")
schema_registry_config: dict[str, Any] = Field(
default={}, description="Extra Schema Registry Config."
)
| DatahubConnection |
python | getsentry__sentry | tests/sentry/tasks/test_post_process.py | {
"start": 13795,
"end": 20220
} | class ____(BasePostProgressGroupMixin):
@patch("sentry.rules.processing.processor.RuleProcessor")
def test_rule_processor_backwards_compat(self, mock_processor: MagicMock) -> None:
event = self.create_event(data={}, project_id=self.project.id)
mock_callback = Mock()
mock_futures = [Mock... | RuleProcessorTestMixin |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 1257505,
"end": 1257726
} | class ____(sgqlc.types.Type, TeamAuditEntryData):
"""Metadata for a team membership for org.restore_member actions"""
__schema__ = github_schema
__field_names__ = ()
| OrgRestoreMemberMembershipTeamAuditEntryData |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/streams.py | {
"start": 8158,
"end": 11361
} | class ____(FBMarketingStream):
"""See: https://developers.facebook.com/docs/marketing-api/reference/ad-account"""
use_batch = False
def __init__(self, **kwargs):
super().__init__(**kwargs)
self._fields_dict = {}
def get_task_permissions(self, account_id: str) -> Set[str]:
"""h... | AdAccount |
python | qdrant__qdrant-client | qdrant_client/http/models/models.py | {
"start": 85878,
"end": 86038
} | class ____(BaseModel, extra="forbid"):
id: "ExtendedPointId" = Field(..., description="")
vector: "VectorStruct" = Field(..., description="")
| PointVectors |
python | apache__airflow | task-sdk/src/airflow/sdk/api/datamodels/_generated.py | {
"start": 6254,
"end": 6762
} | class ____(BaseModel):
"""
Schema for updating TaskInstance to 'RUNNING' state with minimal required fields.
"""
model_config = ConfigDict(
extra="forbid",
)
state: Annotated[Literal["running"] | None, Field(title="State")] = "running"
hostname: Annotated[str, Field(title="Hostname"... | TIEnterRunningPayload |
python | huggingface__transformers | src/transformers/models/luke/modeling_luke.py | {
"start": 24680,
"end": 26109
} | class ____(nn.Module):
def __init__(self, config):
super().__init__()
self.self = LukeSelfAttention(config)
self.output = LukeSelfOutput(config)
def forward(
self,
word_hidden_states,
entity_hidden_states,
attention_mask=None,
output_attentions=Fa... | LukeAttention |
python | huggingface__transformers | src/transformers/models/instructblip/modeling_instructblip.py | {
"start": 30384,
"end": 37480
} | class ____(InstructBlipPreTrainedModel):
"""
Querying Transformer (Q-Former), used in InstructBLIP. Slightly modified from BLIP-2 as it also takes the
instruction as input.
"""
_supports_attention_backend = False # adds position on attn weights before last matmul
_supports_flash_attn = False
... | InstructBlipQFormerModel |
python | bokeh__bokeh | src/bokeh/models/graphs.py | {
"start": 3389,
"end": 3666
} | class ____(GraphCoordinates):
'''
Node coordinate expression obtained from ``LayoutProvider``
'''
# explicit __init__ to support Init signatures
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)
| NodeCoordinates |
python | doocs__leetcode | solution/2400-2499/2475.Number of Unequal Triplets in Array/Solution.py | {
"start": 0,
"end": 375
} | class ____:
def unequalTriplets(self, nums: List[int]) -> int:
n = len(nums)
ans = 0
for i in range(n):
for j in range(i + 1, n):
for k in range(j + 1, n):
ans += (
nums[i] != nums[j] and nums[j] != nums[k] and nums[i] !... | Solution |
python | pytorch__pytorch | benchmarks/dynamo/pr_time_benchmarks/check_results.py | {
"start": 133,
"end": 264
} | class ____:
benchmark_name: str
metric_name: str
expected_value: int
noise_margin: float
@dataclass
| ExpectedFileEntry |
python | PyCQA__pylint | tests/pyreverse/functional/class_diagrams/property_decorator/property_decorator.py | {
"start": 24,
"end": 461
} | class ____:
"""Test class for property decorators with annotated return type"""
def __init__(self):
self._x = 0
@property
def x(self) -> int:
"""This is a getter for x"""
return self._x
@x.setter
def x(self, value):
"""This is a setter for x"""
self._x =... | AnnotatedPropertyTest |
python | kamyu104__LeetCode-Solutions | Python/binary-tree-level-order-traversal-ii.py | {
"start": 154,
"end": 773
} | class ____(object):
def levelOrderBottom(self, root):
"""
:type root: TreeNode
:rtype: List[List[int]]
"""
if root is None:
return []
result, current = [], [root]
while current:
next_level, vals = [], []
for node in current... | Solution |
python | pytorch__pytorch | test/mobile/model_test/builtin_ops.py | {
"start": 2295,
"end": 2978
} | class ____(torch.nn.Module):
def forward(self):
s = "abcde"
# list
l = ["1", "2", "test"]
l.reverse()
l.reverse()
l[1] = "3"
l.extend(["4"])
# str dict
d = {"key": 1}
d.clear()
d.update({"key": 0})
if "key" in d:
... | TSCollectionOpsModule |
python | apache__airflow | airflow-core/src/airflow/api_fastapi/core_api/datamodels/ui/common.py | {
"start": 1127,
"end": 1249
} | class ____(BaseModel):
"""Base Edge serializer for responses."""
source_id: str
target_id: str
| BaseEdgeResponse |
python | doocs__leetcode | solution/1200-1299/1258.Synonymous Sentences/Solution.py | {
"start": 0,
"end": 542
} | class ____:
def __init__(self, n):
self.p = list(range(n))
self.size = [1] * n
def find(self, x):
if self.p[x] != x:
self.p[x] = self.find(self.p[x])
return self.p[x]
def union(self, a, b):
pa, pb = self.find(a), self.find(b)
if pa != pb:
... | UnionFind |
python | falconry__falcon | tests/test_httpstatus.py | {
"start": 6397,
"end": 7037
} | class ____:
def on_get(self, req, res):
res.data = b'foo'
http_status = HTTPStatus(745)
assert http_status.status_code == 745
raise http_status
def on_post(self, req, res):
res.media = {'a': 1}
http_status = HTTPStatus(falcon.HTTP_725)
assert http_status.... | NoBodyResource |
python | great-expectations__great_expectations | great_expectations/datasource/fluent/invalid_datasource.py | {
"start": 1297,
"end": 3688
} | class ____(DataAsset):
"""
A DataAsset that is invalid.
The DataAsset itself may be valid, but it is classified as invalid because its parent Datasource or sibling assets are invalid.
""" # noqa: E501 # FIXME CoP
type: str = "invalid"
name: str = "invalid"
class Config:
extra = "i... | InvalidAsset |
python | doocs__leetcode | solution/1700-1799/1704.Determine if String Halves Are Alike/Solution.py | {
"start": 0,
"end": 252
} | class ____:
def halvesAreAlike(self, s: str) -> bool:
cnt, n = 0, len(s) >> 1
vowels = set('aeiouAEIOU')
for i in range(n):
cnt += s[i] in vowels
cnt -= s[i + n] in vowels
return cnt == 0
| Solution |
python | pytorch__pytorch | torch/fx/passes/split_utils.py | {
"start": 1178,
"end": 11679
} | class ____:
"""
A component serves as a container for a subgraph we want to create afterwards.
"""
graph: torch.fx.Graph
order: int
name: str
# Stores the placeholder nodes in `graph`.
input_placeholders: list = field(default_factory=list)
# Store the nodes in original graph that ... | Component |
python | huggingface__transformers | templates/adding_a_new_example_script/{{cookiecutter.directory_name}}/run_{{cookiecutter.example_shortcut}}.py | {
"start": 4965,
"end": 37545
} | 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 | getsentry__sentry | src/sentry/integrations/msteams/card_builder/block.py | {
"start": 1696,
"end": 1783
} | class ____(TypedDict):
type: Literal["ActionSet"]
actions: list[Action]
| ActionSet |
python | apache__airflow | providers/amazon/src/airflow/providers/amazon/aws/waiters/base_waiter.py | {
"start": 969,
"end": 1910
} | class ____:
"""
Used to create custom Boto3 Waiters.
For more details, see airflow/providers/amazon/aws/waiters/README.md
"""
def __init__(self, client: boto3.client, model_config: dict, deferrable: bool = False) -> None:
self.model = WaiterModel(model_config)
self.client = client
... | BaseBotoWaiter |
python | huggingface__transformers | src/transformers/modeling_utils.py | {
"start": 33404,
"end": 33467
} | class ____(Enum):
inputs = 0
outputs = 1
| PipelineParallel |
python | coleifer__peewee | tests/regressions.py | {
"start": 24695,
"end": 25475
} | class ____(TestModel):
upc = CharField(primary_key=True)
product_id = CharField()
color = CharField()
class Meta:
constraints = [SQL('FOREIGN KEY (product_id, color) REFERENCES '
'product(id, color)')]
@hybrid_property
def product(self):
if not hasattr... | Sku |
python | kamyu104__LeetCode-Solutions | Python/maximum-value-of-k-coins-from-piles.py | {
"start": 90,
"end": 642
} | class ____(object):
def maxValueOfCoins(self, piles, k):
"""
:type piles: List[List[int]]
:type k: int
:rtype: int
"""
dp = [0]
for pile in piles:
new_dp = [0]*min(len(dp)+len(pile), k+1)
for i in xrange(len(dp)):
curr =... | Solution |
python | django__django | django/template/defaulttags.py | {
"start": 14332,
"end": 14500
} | class ____(Node):
def __init__(self, node):
self.node = node
def render(self, context):
self.node.reset(context)
return ""
| ResetCycleNode |
python | xlwings__xlwings | xlwings/constants.py | {
"start": 118437,
"end": 120961
} | class ____:
xlBlankRow = 19 # from enum XlTableStyleElementType
xlColumnStripe1 = 7 # from enum XlTableStyleElementType
xlColumnStripe2 = 8 # from enum XlTableStyleElementType
xlColumnSubheading1 = 20 # from enum XlTableStyleElementType
xlColumnSubheading2 = 21 # from enum XlTableStyleElementTy... | TableStyleElementType |
python | PyCQA__pylint | tests/functional/g/generic_alias/generic_alias_collections.py | {
"start": 2503,
"end": 2547
} | class ____(abc.ABC):
pass
| CustomAbstractCls1 |
python | wandb__wandb | wandb/sdk/artifacts/_generated/artifact_type.py | {
"start": 513,
"end": 696
} | class ____(GQLResult):
name: str
ArtifactType.model_rebuild()
ArtifactTypeProject.model_rebuild()
ArtifactTypeProjectArtifact.model_rebuild()
| ArtifactTypeProjectArtifactArtifactType |
python | hyperopt__hyperopt | hyperopt/tests/test_base.py | {
"start": 4153,
"end": 7051
} | class ____(unittest.TestCase):
def setUp(self):
self.trials = Trials()
def test_valid(self):
trials = self.trials
f = trials.insert_trial_doc
fine = ok_trial("ID", 1, 2, 3)
# --original runs fine
f(fine)
# -- take out each mandatory root key
def... | TestTrials |
python | sqlalchemy__sqlalchemy | lib/sqlalchemy/dialects/postgresql/pg8000.py | {
"start": 4685,
"end": 4746
} | class ____(_PGNumericCommon, sqltypes.Float):
pass
| _PGFloat |
python | aimacode__aima-python | ipyviews.py | {
"start": 2617,
"end": 5574
} | class ____:
""" View for grid world. Uses XYEnviornment in agents.py as model.
world: an instance of XYEnviornment.
block_size: size of individual blocks in pixes.
default_fill: color of blocks. A hex value or name should be passed.
"""
def __init__(self, world, block_size=30, defau... | GridWorldView |
python | ethereum__web3.py | web3/contract/async_contract.py | {
"start": 19466,
"end": 20428
} | class ____(BaseContractConstructor):
# mypy types
w3: "AsyncWeb3[Any]"
@combomethod
async def transact(self, transaction: TxParams | None = None) -> HexBytes:
return await self.w3.eth.send_transaction(self._get_transaction(transaction))
@combomethod
async def build_transaction(self, tr... | AsyncContractConstructor |
python | pallets__itsdangerous | tests/test_itsdangerous/test_signer.py | {
"start": 406,
"end": 3435
} | class ____:
@pytest.fixture()
def signer_factory(self):
return partial(Signer, secret_key="secret-key")
@pytest.fixture()
def signer(self, signer_factory):
return signer_factory()
def test_signer(self, signer):
signed = signer.sign("my string")
assert isinstance(sig... | TestSigner |
python | gevent__gevent | src/gevent/_ffi/watcher.py | {
"start": 18568,
"end": 19382
} | class ____(object):
# hack for libuv which doesn't extend watcher
_CALL_SUPER_INIT = True
def __init__(self, loop, pid, trace=0, ref=True):
if not loop.default:
raise TypeError('child watchers are only available on the default loop')
loop.install_sigchld()
self._pid = p... | ChildMixin |
python | fastapi__sqlmodel | docs_src/tutorial/create_db_and_table/tutorial003_py310.py | {
"start": 62,
"end": 572
} | class ____(SQLModel, table=True): # (3)!
id: int | None = Field(default=None, primary_key=True) # (4)!
name: str # (5)!
secret_name: str # (6)!
age: int | None = None # (7)!
sqlite_file_name = "database.db" # (8)!
sqlite_url = f"sqlite:///{sqlite_file_name}" # (9)!
engine = create_engine(sqlit... | Hero |
python | pytorch__pytorch | test/dynamo/test_debug_utils.py | {
"start": 2938,
"end": 7342
} | class ____(TestCase):
def test_aot_graph_parser(self, device):
def forward(
self,
primals_1: "f32[1001, 6]",
primals_2: "f32[1001]",
primals_3: "f32[1001, 64]",
primals_4: "f32[4190]",
primals_5: "f32[4190]",
primals_6: "f32... | TestDebugUtilsDevice |
python | pytorch__pytorch | test/distributed/checkpoint/e2e/test_e2e_save_and_load.py | {
"start": 2001,
"end": 2534
} | class ____(torch.nn.Module):
def __init__(self) -> None:
super().__init__()
torch.manual_seed(0)
self.net1 = nn.Linear(8, 16)
self.net2 = nn.Linear(16, 32)
self.net3 = nn.Linear(32, 64)
self.net4 = nn.Linear(64, 8)
def forward(self, x):
x = F.relu(self.ne... | TestDummyModel |
python | pytorch__pytorch | torch/fx/experimental/unification/multipledispatch/conflict.py | {
"start": 280,
"end": 4210
} | class ____(Warning):
pass
def supercedes(a, b):
"""A is consistent and strictly more specific than B"""
if len(a) < len(b):
# only case is if a is empty and b is variadic
return not a and len(b) == 1 and isvariadic(b[-1])
elif len(a) == len(b):
return all(map(issubclass, a, b))... | AmbiguityWarning |
python | django__django | tests/admin_registration/tests.py | {
"start": 366,
"end": 454
} | class ____(admin.ModelAdmin):
list_display = ["name"]
save_on_top = True
| NameAdmin |
python | django__django | tests/model_inheritance/models.py | {
"start": 1484,
"end": 1570
} | class ____(Attachment):
url = models.URLField()
#
# Multi-table inheritance
#
| Link |
python | spyder-ide__spyder | spyder/api/plugins/enum.py | {
"start": 195,
"end": 1352
} | class ____:
"""
Convenience class for accessing Spyder internal plugins.
"""
All = "all" # Wildcard to populate REQUIRES with all available plugins
Appearance = 'appearance'
Application = 'application'
Completions = 'completions'
Console = 'internal_console'
Debugger = 'debugger'
... | Plugins |
python | django__django | tests/staticfiles_tests/test_storage.py | {
"start": 28107,
"end": 28510
} | class ____(storage.ManifestStaticFilesStorage):
support_js_module_import_aggregation = True
@override_settings(
STORAGES={
**settings.STORAGES,
STATICFILES_STORAGE_ALIAS: {
"BACKEND": (
"staticfiles_tests.test_storage."
"JSModuleImportAggregationMani... | JSModuleImportAggregationManifestStorage |
python | readthedocs__readthedocs.org | readthedocs/rtd_tests/tests/test_notifications.py | {
"start": 2536,
"end": 3427
} | class ____(TestCase):
@mock.patch("readthedocs.notifications.email.send_email")
def test_email_backend(self, send_email):
class TestNotification(EmailNotification):
name = "foo"
subject = "This is {{ foo.id }}"
context_object_name = "foo"
build = fixture.get(... | NotificationBackendTests |
python | zarr-developers__zarr-python | src/zarr/core/metadata/v2.py | {
"start": 1270,
"end": 1595
} | class ____(TypedDict):
"""
A typed dictionary model for Zarr format 2 metadata.
"""
zarr_format: Literal[2]
attributes: dict[str, JSON]
# Union of acceptable types for v2 compressors
CompressorLikev2: TypeAlias = dict[str, JSON] | Numcodec | None
@dataclass(frozen=True, kw_only=True)
| ArrayV2MetadataDict |
python | dagster-io__dagster | python_modules/libraries/dagster-airbyte/dagster_airbyte/managed/types.py | {
"start": 7902,
"end": 11195
} | class ____:
"""A user-defined Airbyte connection, pairing an Airbyte source and destination and configuring
which streams to sync.
Args:
name (str): The display name of the connection.
source (AirbyteSource): The source to sync from.
destination (AirbyteDestination): The destination... | AirbyteConnection |
python | run-llama__llama_index | llama-index-integrations/llms/llama-index-llms-bedrock/tests/test_bedrock.py | {
"start": 1615,
"end": 12140
} | class ____:
def __init__(self, expected_prompt: str):
self.expected_prompt = expected_prompt
def mock_stream_completion_with_retry(
self, request_body: str, *args: Any, **kwargs: Any
) -> dict:
assert json.loads(request_body) == {
"inputText": self.expected_prompt,
... | MockStreamCompletionWithRetry |
python | psf__black | src/black/handle_ipynb_magics.py | {
"start": 10670,
"end": 10944
} | class ____:
name: str
params: str | None
body: str
@property
def header(self) -> str:
if self.params:
return f"%%{self.name} {self.params}"
return f"%%{self.name}"
# ast.NodeVisitor + dataclass = breakage under mypyc.
| CellMagic |
python | pypa__pip | src/pip/_internal/index/sources.py | {
"start": 1365,
"end": 2930
} | class ____:
"""Scans directory and caches results"""
def __init__(self, path: str) -> None:
self._path = path
self._page_candidates: list[str] = []
self._project_name_to_urls: dict[str, list[str]] = defaultdict(list)
self._scanned_directory = False
def _scan_directory(self)... | _FlatDirectoryToUrls |
python | charliermarsh__ruff | crates/ruff_linter/resources/test/fixtures/pylint/eq_without_hash.py | {
"start": 1293,
"end": 1395
} | class ____:
match ...:
case int():
def __eq__(self, other): ...
| MaybeEqMatchCase |
python | scrapy__scrapy | scrapy/contracts/__init__.py | {
"start": 566,
"end": 3324
} | class ____:
"""Abstract class for contracts"""
request_cls: type[Request] | None = None
name: str
def __init__(self, method: Callable, *args: Any):
self.testcase_pre = _create_testcase(method, f"@{self.name} pre-hook")
self.testcase_post = _create_testcase(method, f"@{self.name} post-h... | Contract |
python | pypa__pipenv | pipenv/patched/pip/_vendor/distlib/locators.py | {
"start": 41483,
"end": 51026
} | class ____(object):
"""
Locate dependencies for distributions.
"""
def __init__(self, locator=None):
"""
Initialise an instance, using the specified locator
to locate distributions.
"""
self.locator = locator or default_locator
self.scheme = get_scheme(se... | DependencyFinder |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-jira/integration_tests/fixtures/data_generator/streams.py | {
"start": 4400,
"end": 6041
} | class ____(IssueComments, GeneratorMixin):
"""
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comments/#api-rest-api-3-issue-issueidorkey-comment-post
"""
def generate(self):
issues_stream = Issues(authenticator=self._session.auth, domain=self._domain)
for i... | IssueCommentsGenerator |
python | Textualize__rich | rich/styled.py | {
"start": 225,
"end": 1234
} | class ____:
"""Apply a style to a renderable.
Args:
renderable (RenderableType): Any renderable.
style (StyleType): A style to apply across the entire renderable.
"""
def __init__(self, renderable: "RenderableType", style: "StyleType") -> None:
self.renderable = renderable
... | Styled |
python | getsentry__sentry-python | sentry_sdk/integrations/langchain.py | {
"start": 5824,
"end": 6045
} | class ____:
span = None # type: Span
children = [] # type: List[WatchedSpan]
is_pipeline = False # type: bool
def __init__(self, span):
# type: (Span) -> None
self.span = span
| WatchedSpan |
python | qdrant__qdrant-client | qdrant_client/http/models/models.py | {
"start": 140887,
"end": 140975
} | class ____(BaseModel):
cancelled: str = Field(..., description="")
| TrackerStatusOneOf1 |
python | doocs__leetcode | solution/1000-1099/1065.Index Pairs of a String/Solution2.py | {
"start": 0,
"end": 362
} | class ____:
def __init__(self):
self.children = [None] * 26
self.is_end = False
def insert(self, word):
node = self
for c in word:
idx = ord(c) - ord('a')
if node.children[idx] is None:
node.children[idx] = Trie()
node = node.c... | Trie |
python | ray-project__ray | ci/ray_ci/doc/test_update_cache_env.py | {
"start": 234,
"end": 2674
} | class ____:
def __init__(self, srcdir: str, doctreedir: str, project: Project, all_docs: dict):
self.srcdir = "srcdir"
self.doctreedir = "doctreedir"
self.project = Project(
"srcdir",
{".rst": "restructuredtext", ".md": "myst-nb", ".ipynb": "myst-nb"},
)
... | FakeBuildEnv |
python | PyCQA__pylint | tests/functional/a/abstract/abstract_class_instantiated.py | {
"start": 1335,
"end": 1435
} | class ____(Structure):
def keys(self):
return iter([1, 2, 3])
__iter__ = keys
| Iterator |
python | spack__spack | var/spack/test_repos/spack_repo/builtin_mock/packages/mvapich2/package.py | {
"start": 216,
"end": 558
} | class ____(Package):
homepage = "http://www.homepage.org"
url = "http://www.someurl"
version("1.5", md5="9c5d5d4fe1e17dd12153f40bc5b6dbc0")
variant(
"file_systems",
description="List of the ROMIO file systems to activate",
values=auto_or_any_combination_of("lustre", "gpfs", "nf... | Mvapich2 |
python | dagster-io__dagster | python_modules/libraries/dagster-airflow/dagster_airflow/links/dagster_link.py | {
"start": 337,
"end": 1086
} | class ____(BaseOperatorLink):
name = "Dagster Cloud" # type: ignore # (airflow 1 compat)
def get_link(self, operator, dttm): # pyright: ignore[reportIncompatibleMethodOverride]
ti = TaskInstance(task=operator, execution_date=dttm)
run_id = ti.xcom_pull(task_ids=operator.task_id, key="run_id"... | DagsterLink |
python | realpython__materials | wordcount/tests/realpython/models.py | {
"start": 718,
"end": 2169
} | class ____:
item: Item
status: TestStatus
exception: RealPythonAssertionError | None
@cached_property
def id(self) -> str:
return self.item.nodeid
@cached_property
def function(self) -> Function | None:
if hasattr(self.item, "function"):
return self.item.functio... | Test |
python | google__python-fire | fire/trace.py | {
"start": 1550,
"end": 8251
} | class ____:
"""A FireTrace represents the steps taken during a single Fire execution.
A FireTrace consists of a sequence of FireTraceElement objects. Each element
represents an action taken by Fire during a single Fire execution. An action
may be instantiating a class, calling a routine, or accessing a propert... | FireTrace |
python | openai__openai-python | src/openai/types/responses/function_shell_tool.py | {
"start": 194,
"end": 311
} | class ____(BaseModel):
type: Literal["shell"]
"""The type of the shell tool. Always `shell`."""
| FunctionShellTool |
python | huggingface__transformers | tests/models/metaclip_2/test_modeling_metaclip_2.py | {
"start": 5837,
"end": 7743
} | class ____(ModelTesterMixin):
"""
Subclass of ModelTesterMixin with methods specific to testing MetaClip2 models.
The SDPA equivalence test is overridden here because MetaClip2 models may have test/vision/text+vision inputs,
different output logits, and are not supposed to be used or tested with padding... | MetaClip2ModelTesterMixin |
python | nedbat__coveragepy | coverage/html.py | {
"start": 2922,
"end": 7277
} | class ____:
"""Generate structured data to be turned into HTML reports."""
EMPTY = "(empty)"
def __init__(self, cov: Coverage) -> None:
self.coverage = cov
self.config = self.coverage.config
self.data = self.coverage.get_data()
self.has_arcs = self.data.has_arcs()
i... | HtmlDataGeneration |
python | eventlet__eventlet | tests/patcher_test.py | {
"start": 9510,
"end": 12062
} | class ____(ProcessBase):
def test_orig_thread(self):
new_mod = """import eventlet
eventlet.monkey_patch()
from eventlet import patcher
import threading
_threading = patcher.original('threading')
def test():
print(repr(threading.currentThread()))
t = _threading.Thread(target=test)
t.start()
t.join()
prin... | Threading |
python | getsentry__sentry | tests/sentry/db/postgres/schema/safe_migrations/integration/test_migrations.py | {
"start": 11758,
"end": 12351
} | class ____(BaseSafeMigrationTest):
app = "good_flow_delete_simple_app"
migrate_from = "0001"
migrate_to = "0003"
def test(self) -> None:
self._run_migration(self.app, "0001_initial")
assert f"{self.app}_testtable" in connection.introspection.table_names()
self._run_migration(sel... | DeletionModelGoodDeleteSimple |
python | kennethreitz__tablib | src/tablib/packages/dbfpy/utils.py | {
"start": 3922,
"end": 4835
} | class ____:
"""Value returned from DBF records when field validation fails
The value is not equal to anything except for itself
and equal to all empty values: None, 0, empty string etc.
In other words, invalid value is equal to None and not equal
to None at the same time.
This value yields ze... | _InvalidValue |
python | getsentry__sentry | tests/sentry/core/endpoints/test_organization_member_team_details.py | {
"start": 7320,
"end": 10744
} | class ____(OrganizationMemberTeamTestBase):
method = "post"
def test_member_can_join_team(self) -> None:
self.login_as(self.member)
self.get_success_response(
self.org.slug, self.member.id, self.team.slug, status_code=status.HTTP_201_CREATED
)
assert OrganizationMem... | CreateWithOpenMembershipTest |
python | ethereum__web3.py | web3/net.py | {
"start": 205,
"end": 837
} | class ____(Module):
_listening: Method[Callable[[], bool]] = Method(
RPC.net_listening,
mungers=[default_root_munger],
)
_peer_count: Method[Callable[[], int]] = Method(
RPC.net_peerCount,
mungers=[default_root_munger],
)
_version: Method[Callable[[], str]] = Method... | Net |
python | h5py__h5py | h5py/tests/test_dtype.py | {
"start": 12022,
"end": 13115
} | class ____(TestCase):
def test_vlen_utf8(self):
dt = h5py.string_dtype()
string_info = h5py.check_string_dtype(dt)
assert string_info.encoding == 'utf-8'
assert string_info.length is None
assert h5py.check_vlen_dtype(dt) is str
def test_vlen_ascii(self):
dt = h5... | TestStrings |
python | sqlalchemy__sqlalchemy | test/orm/test_mapper.py | {
"start": 74094,
"end": 81171
} | class ____(fixtures.MappedTest):
"""Tests the contract for user classes."""
@classmethod
def define_tables(cls, metadata):
Table(
"ht1",
metadata,
Column(
"id", Integer, primary_key=True, test_needs_autoincrement=True
),
Co... | RequirementsTest |
python | numpy__numpy | numpy/linalg/_linalg.py | {
"start": 2312,
"end": 2563
} | class ____(NamedTuple):
U: NDArray[Any]
S: NDArray[Any]
Vh: NDArray[Any]
array_function_dispatch = functools.partial(
overrides.array_function_dispatch, module='numpy.linalg'
)
fortran_int = intc
@set_module('numpy.linalg')
| SVDResult |
python | dagster-io__dagster | docs/sphinx/_ext/dagster-sphinx/dagster_sphinx/configurable.py | {
"start": 4657,
"end": 6468
} | class ____(DataDocumenter):
objtype = "configurable"
directivetype = "data"
@classmethod
def can_document_member( # pyright: ignore[reportIncompatibleMethodOverride]
cls, member: Any, _membername: str, _isattr: bool, _parent: Any
) -> bool:
return isinstance(member, ConfigurableDef... | ConfigurableDocumenter |
python | spyder-ide__spyder | spyder/plugins/completion/providers/languageserver/conftabs/advanced.py | {
"start": 597,
"end": 9079
} | class ____(SpyderPreferencesTab):
"""PyLS advanced configuration tab."""
TITLE = _('Advanced')
def __init__(self, parent):
super().__init__(parent)
lsp_advanced_group = QGroupBox(_(
'Python Language Server configuration'))
advanced_label = QLabel(
_("<b>War... | AdvancedConfigTab |
python | yaml__pyyaml | lib/yaml/loader.py | {
"start": 864,
"end": 1180
} | class ____(Reader, Scanner, Parser, Composer, SafeConstructor, Resolver):
def __init__(self, stream):
Reader.__init__(self, stream)
Scanner.__init__(self)
Parser.__init__(self)
Composer.__init__(self)
SafeConstructor.__init__(self)
Resolver.__init__(self)
| SafeLoader |
python | django__django | tests/admin_changelist/models.py | {
"start": 1545,
"end": 1672
} | class ____(models.Model):
name = models.CharField(max_length=30)
group = models.ForeignKey(Group, models.CASCADE)
| Concert |
python | tensorflow__tensorflow | tensorflow/python/training/experimental/mixed_precision_test.py | {
"start": 1579,
"end": 8614
} | class ____(test.TestCase, parameterized.TestCase):
IGNORE_PERF_VAR = 'TF_AUTO_MIXED_PRECISION_GRAPH_REWRITE_IGNORE_PERFORMANCE'
def setUp(self):
super(MixedPrecisionTest, self).setUp()
# Enable the tests to be run on pre-Volta GPUs by telling the grappler pass
# to ignore performance and always transf... | MixedPrecisionTest |
python | protocolbuffers__protobuf | python/google/protobuf/json_format.py | {
"start": 1863,
"end": 1931
} | class ____(Error):
"""Thrown in case of parsing error."""
| ParseError |
python | automl__auto-sklearn | autosklearn/estimators.py | {
"start": 58229,
"end": 63301
} | class ____(AutoSklearnEstimator, ClassifierMixin):
"""This class implements the classification task."""
def fit(self, X, y, X_test=None, y_test=None, feat_type=None, dataset_name=None):
"""Fit *auto-sklearn* to given training set (X, y).
Fit both optimizes the machine learning models and build... | AutoSklearnClassifier |
python | pypa__warehouse | tests/unit/manage/views/test_teams.py | {
"start": 23812,
"end": 30645
} | class ____:
@pytest.fixture
def organization(self, _enable_organizations, pyramid_user):
organization = OrganizationFactory.create()
OrganizationRoleFactory.create(
organization=organization,
user=pyramid_user,
role_name=OrganizationRoleType.Owner,
)
... | TestChangeTeamProjectRole |
python | facelessuser__pymdown-extensions | pymdownx/magiclink.py | {
"start": 34224,
"end": 35225
} | class ____(_MagiclinkShorthandPattern):
"""Convert @user/repo to links."""
ANCESTOR_EXCLUDES = ('a',)
def handleMatch(self, m, data):
"""Handle email link patterns."""
text = m.group('mention')[1:]
parts = text.split(':')
if len(parts) > 1:
provider = parts[0]
... | MagiclinkRepositoryPattern |
python | pytorch__pytorch | benchmarks/dynamo/pr_time_benchmarks/benchmarks/aotdispatcher_partitioner2.py | {
"start": 69,
"end": 1384
} | class ____(BenchmarkBase):
def __init__(self):
super().__init__(
category="aotdispatcher_partitioner",
backend="aot_eager_decomp_partition",
device="cpu",
)
def name(self):
return f"{self.category()}_{self.device()}2"
def description(self):
... | Benchmark |
python | readthedocs__readthedocs.org | readthedocs/search/views.py | {
"start": 1260,
"end": 5734
} | class ____(TemplateView):
"""
Global search enabled for logged out users and anyone using the dashboard.
Query params:
- q: search term
- type: type of document to search (project or file)
- language: project language to filter by (only valid if type is project)
"""
http_method_names ... | GlobalSearchView |
python | plotly__plotly.py | plotly/graph_objs/scatterpolar/_textfont.py | {
"start": 233,
"end": 17129
} | class ____(_BaseTraceHierarchyType):
_parent_path_str = "scatterpolar"
_path_str = "scatterpolar.textfont"
_valid_props = {
"color",
"colorsrc",
"family",
"familysrc",
"lineposition",
"linepositionsrc",
"shadow",
"shadowsrc",
"size",
... | Textfont |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.