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 | falconry__falcon | falcon/request.py | {
"start": 2127,
"end": 87019
} | class ____:
"""Represents a client's HTTP request.
Note:
`Request` is not meant to be instantiated directly by responders.
Args:
env (dict): A WSGI environment dict passed in from the server. See
also PEP-3333.
Keyword Arguments:
options (RequestOptions): Set of gl... | Request |
python | pypa__pipenv | pipenv/patched/pip/_internal/resolution/resolvelib/candidates.py | {
"start": 4107,
"end": 9287
} | class ____(Candidate):
"""A candidate backed by an ``InstallRequirement``.
This represents a package request with the target not being already
in the environment, and needs to be fetched and installed. The backing
``InstallRequirement`` is responsible for most of the leg work; this
class exposes ap... | _InstallRequirementBackedCandidate |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/metaclass8.py | {
"start": 141,
"end": 251
} | class ____(type, Generic[T]): ...
# This should generate an error because generic metaclasses are not allowed.
| A |
python | great-expectations__great_expectations | great_expectations/metrics/batch/row_count.py | {
"start": 178,
"end": 298
} | class ____(BatchMetric[BatchRowCountResult]):
"""Count of rows in a table"""
name = "table.row_count"
| BatchRowCount |
python | marshmallow-code__marshmallow | src/marshmallow/fields.py | {
"start": 47534,
"end": 48746
} | class ____(DateTime):
"""A formatted aware datetime string.
:param format: See :class:`DateTime`.
:param default_timezone: Used on deserialization. If `None`, naive
datetimes are rejected. If not `None`, naive datetimes are set this
timezone.
:param kwargs: The same keyword arguments th... | AwareDateTime |
python | coleifer__peewee | tests/sqlite_changelog.py | {
"start": 798,
"end": 973
} | class ____(TestModel):
data = JSONField() # Diff of json?
changelog = ChangeLog(database)
CL = changelog.model
@skip_unless(json_installed(), 'requires sqlite json1')
| CT2 |
python | realpython__materials | asterioids-pygame-project/source_code_step_8/space_rocks/game.py | {
"start": 106,
"end": 3115
} | class ____:
MIN_ASTEROID_DISTANCE = 250
def __init__(self):
self._init_pygame()
self.screen = pygame.display.set_mode((800, 600))
self.background = load_sprite("space", False)
self.clock = pygame.time.Clock()
self.asteroids = []
self.bullets = []
self.sp... | SpaceRocks |
python | PrefectHQ__prefect | src/integrations/prefect-dbt/tests/cloud/test_runs.py | {
"start": 3626,
"end": 7572
} | class ____:
async def test_get_artifact_success(self, dbt_cloud_credentials):
with respx.mock(using="httpx") as respx_mock:
respx_mock.get(
"https://cloud.getdbt.com/api/v2/accounts/123456789/runs/12/artifacts/manifest.json", # noqa
headers={"Authorization": "Bea... | TestDbtCloudGetRunArtifact |
python | facebookresearch__faiss | tests/test_index.py | {
"start": 13603,
"end": 17671
} | class ____(unittest.TestCase):
def run_search_and_reconstruct(self, index, xb, xq, k=10, eps=None):
n, d = xb.shape
assert xq.shape[1] == d
assert index.d == d
D_ref, I_ref = index.search(xq, k)
R_ref = index.reconstruct_n(0, n)
D, I, R = index.search_and_reconstruc... | TestSearchAndReconstruct |
python | PrefectHQ__prefect | src/prefect/client/orchestration/_deployments/client.py | {
"start": 25038,
"end": 48988
} | class ____(BaseAsyncClient):
async def create_deployment(
self,
flow_id: UUID,
name: str,
version: str | None = None,
version_info: "VersionInfo | None" = None,
schedules: list["DeploymentScheduleCreate"] | None = None,
concurrency_limit: int | None = None,
... | DeploymentAsyncClient |
python | matplotlib__matplotlib | lib/matplotlib/dviread.py | {
"start": 32196,
"end": 36855
} | class ____(Dvi):
r"""
A virtual font (\*.vf file) containing subroutines for dvi files.
Parameters
----------
filename : str or path-like
Notes
-----
The virtual font format is a derivative of dvi:
http://mirrors.ctan.org/info/knuth/virtual-fonts
This class reuses some of the m... | Vf |
python | apache__airflow | providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/kube_config.py | {
"start": 1010,
"end": 6191
} | class ____:
"""Configuration for Kubernetes."""
core_section = "core"
kubernetes_section = "kubernetes_executor"
logging_section = "logging"
def __init__(self):
configuration_dict = conf.as_dict(display_sensitive=True)
self.core_configuration = configuration_dict[self.core_section]... | KubeConfig |
python | huggingface__transformers | src/transformers/models/maskformer/convert_maskformer_original_pytorch_checkpoint_to_pytorch.py | {
"start": 5696,
"end": 6450
} | class ____:
def __call__(self, original_config: object) -> MaskFormerImageProcessor:
model = original_config.MODEL
model_input = original_config.INPUT
dataset_catalog = MetadataCatalog.get(original_config.DATASETS.TEST[0])
return MaskFormerImageProcessor(
image_mean=(tor... | OriginalMaskFormerConfigToImageProcessorConverter |
python | dagster-io__dagster | python_modules/dagster/dagster/_grpc/server.py | {
"start": 4772,
"end": 4848
} | class ____(TypedDict):
current_request_count: Optional[int]
| GrpcApiMetrics |
python | squidfunk__mkdocs-material | material/plugins/projects/structure/__init__.py | {
"start": 10548,
"end": 10645
} | class ____(Link):
# Indicate that the link points to a project
is_project = True
| ProjectLink |
python | pandas-dev__pandas | pandas/io/parsers/base_parser.py | {
"start": 1611,
"end": 32900
} | class ____:
class BadLineHandleMethod(Enum):
ERROR = 0
WARN = 1
SKIP = 2
_implicit_index: bool
_first_chunk: bool
keep_default_na: bool
dayfirst: bool
cache_dates: bool
usecols_dtype: str | None
def __init__(self, kwds) -> None:
self._implicit_index = Fa... | ParserBase |
python | huggingface__transformers | tests/models/sam2/test_image_processing_sam2.py | {
"start": 1083,
"end": 3516
} | class ____:
def __init__(
self,
parent,
batch_size=7,
num_channels=3,
image_size=18,
min_resolution=30,
max_resolution=400,
mask_size=None,
do_resize=True,
size=None,
do_normalize=True,
image_mean=[0.5, 0.5, 0.5],
... | Sam2ImageProcessingTester |
python | vyperlang__vyper | vyper/semantics/types/function.py | {
"start": 1584,
"end": 27384
} | class ____(VyperType):
"""
Contract function type.
Functions compare false against all types and so cannot be assigned without
being called. Calls are validated by `fetch_call_return`, check the call
arguments against `positional_args` and `keyword_arg`, and return `return_type`.
Attributes
... | ContractFunctionT |
python | getsentry__sentry | src/sentry/plugins/bases/issue2.py | {
"start": 1368,
"end": 2167
} | class ____(GroupEndpoint):
publish_status = {
"GET": ApiPublishStatus.PRIVATE,
"POST": ApiPublishStatus.PRIVATE,
}
view: Callable[[Request, Group], HttpResponseBase] = None # type: ignore[assignment] # populated by .as_view
def _handle(self, request: Request, group, *args, **kwargs):
... | PluginGroupEndpoint |
python | google__jax | tests/shard_alike_test.py | {
"start": 1235,
"end": 7944
} | class ____(jtu.JaxTestCase):
def setUp(self):
super().setUp()
def test_basic(self):
mesh = jtu.create_mesh((2, 2), ('x', 'y'))
np_inp = np.arange(16).reshape(8, 2)
s = NamedSharding(mesh, P('x', 'y'))
inp = jax.device_put(np_inp, s)
@jax.jit
def f(x):
y = x * x
z = y * 2
... | ShardAlikeTest |
python | getsentry__sentry | src/sentry/discover/models.py | {
"start": 1873,
"end": 2282
} | class ____(Model):
__relocation_scope__ = RelocationScope.Excluded
project = FlexibleForeignKey("sentry.Project")
discover_saved_query = FlexibleForeignKey("discover.DiscoverSavedQuery")
class Meta:
app_label = "discover"
db_table = "sentry_discoversavedqueryproject"
unique_tog... | DiscoverSavedQueryProject |
python | airbytehq__airbyte | airbyte-ci/connectors/metadata_service/lib/metadata_service/spec_cache.py | {
"start": 2282,
"end": 4317
} | class ____:
def __init__(self, bucket_name: str = PROD_SPEC_CACHE_BUCKET_NAME):
self.client = storage.Client.create_anonymous_client()
self.bucket = self.client.bucket(bucket_name)
self.cached_specs = self.get_all_cached_specs()
def get_all_cached_specs(self) -> List[CachedSpec]:
... | SpecCache |
python | kamyu104__LeetCode-Solutions | Python/maximum-strength-of-k-disjoint-subarrays.py | {
"start": 583,
"end": 1033
} | class ____(object):
def maximumStrength(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: int
"""
dp = [[float("-inf")]*(len(nums)+1) for _ in xrange(k+1)]
dp[0] = [0]*(len(nums)+1)
for i in xrange(k):
for j in xrange(len(nums)... | Solution2 |
python | realpython__materials | crud-operations/crud_fastapi.py | {
"start": 404,
"end": 2200
} | class ____(BaseModel):
model_config = ConfigDict(from_attributes=True)
id: int
name: str
def get_db():
db = SessionLocal()
try:
yield db
finally:
db.close()
@app.post("/birds/", response_model=BirdResponse)
def create_bird(bird: BirdCreate, db: Session = Depends(get_db)):
... | BirdResponse |
python | doocs__leetcode | solution/0000-0099/0044.Wildcard Matching/Solution.py | {
"start": 0,
"end": 474
} | class ____:
def isMatch(self, s: str, p: str) -> bool:
@cache
def dfs(i: int, j: int) -> bool:
if i >= len(s):
return j >= len(p) or (p[j] == "*" and dfs(i, j + 1))
if j >= len(p):
return False
if p[j] == "*":
return... | Solution |
python | pytorch__pytorch | test/functorch/test_aotdispatch.py | {
"start": 267307,
"end": 318765
} | class ____(AOTTestCase):
def test_aot_module_simplified(self):
class MockModule(torch.nn.Module):
def __init__(self) -> None:
super().__init__()
self.linear = torch.nn.Linear(20, 30)
def forward(self, x, y):
return (self.linear(x) + y,... | TestAOTModuleSimplified |
python | pytorch__pytorch | test/distributed/pipelining/test_schedule.py | {
"start": 9166,
"end": 15290
} | class ____(TestCase):
def setUp(self):
# Define a list of test cases with varying num_local_stages, num_microbatches, and group_size
# These should succeed since num_microbatches % group_size == 0
self.test_cases = [
# small number of stages
(2, 2, 2),
(2,... | TestSchedulePlan |
python | prabhupant__python-ds | data_structures/bst/min_max_value_in_bst.py | {
"start": 0,
"end": 588
} | class ____():
def __init__(self, val):
self.val = val
self.right = None
self.left = None
def min_value(root):
if not root:
return None
curr = root
while curr.left:
curr = curr.left
return curr.val
def max_value(root):
if not root:
return None
... | Node |
python | apache__airflow | helm-tests/tests/helm_tests/airflow_aux/test_migrate_database_job.py | {
"start": 914,
"end": 16276
} | class ____:
"""Tests migrate DB job."""
def test_should_run_by_default(self):
docs = render_chart(show_only=["templates/jobs/migrate-database-job.yaml"])
assert docs[0]["kind"] == "Job"
assert jmespath.search("spec.template.spec.containers[0].name", docs[0]) == "run-airflow-migrations"
... | TestMigrateDatabaseJob |
python | getsentry__sentry | tests/sentry/integrations/github/tasks/test_codecov_account_unlink.py | {
"start": 535,
"end": 4386
} | class ____(IntegrationTestCase):
provider = GitHubIntegrationProvider
def setUp(self):
super().setUp()
self.integration = self.create_integration(
organization=self.organization,
provider=IntegrationProviderSlug.GITHUB.value,
name="test-org",
exte... | CodecovAccountUnlinkTestCase |
python | getsentry__sentry | tests/sentry/monitors/endpoints/test_organization_monitor_details.py | {
"start": 158,
"end": 301
} | class ____(BaseMonitorDetailsTest):
endpoint = "sentry-api-0-organization-monitor-details"
__test__ = True
| OrganizationMonitorDetailsTest |
python | tensorflow__tensorflow | tensorflow/python/kernel_tests/array_ops/matrix_band_part_op_test.py | {
"start": 2501,
"end": 3173
} | class ____(test_lib.TestCase):
pass # Filled in below
def _GetMatrixBandPartGradTest(dtype_, batch_shape_, shape_):
@test_util.run_v1_only("b/120545219")
def Test(self):
shape = batch_shape_ + shape_
x = constant_op.constant(np.random.rand(*shape), dtype=dtype_)
with self.session(use_gpu=False):
... | MatrixBandPartGradTest |
python | automl__auto-sklearn | test/test_util/test_dependencies.py | {
"start": 276,
"end": 3257
} | class ____(unittest.TestCase):
def test_existing_package(self, getDistributionMock):
requirement = "package"
distribution_mock = unittest.mock.Mock()
getDistributionMock.return_value = distribution_mock
distribution_mock.version = "1.0.0"
verify_packages(requirement)
... | VerifyPackagesTests |
python | getsentry__sentry | tests/sentry/workflow_engine/endpoints/serializers/test_data_condition_serializer.py | {
"start": 363,
"end": 1708
} | class ____(TestCase):
def setUp(self) -> None:
super().setUp()
self.condition_group = self.create_data_condition_group(
organization_id=self.organization.id,
logic_type=DataConditionGroup.Type.ANY,
)
def test_serializer_simple(self) -> None:
condition = ... | TestDataConditionSerializer |
python | pytransitions__transitions | tests/test_core.py | {
"start": 779,
"end": 53036
} | class ____(TestCase):
def setUp(self):
self.stuff = Stuff()
self.machine_cls = Machine
def tearDown(self):
pass
def test_init_machine_with_hella_arguments(self):
states = [
State('State1'),
'State2',
{
'name': 'State3',
... | TestTransitions |
python | lazyprogrammer__machine_learning_examples | rl/approx_control.py | {
"start": 1576,
"end": 4287
} | class ____:
def __init__(self, grid):
# fit the featurizer to data
samples = gather_samples(grid)
# self.featurizer = Nystroem()
self.featurizer = RBFSampler()
self.featurizer.fit(samples)
dims = self.featurizer.n_components
# initialize linear model weights
self.w = np.zeros(dims)
... | Model |
python | Pylons__pyramid | tests/test_scripts/dummy.py | {
"start": 1816,
"end": 1998
} | class ____:
def __init__(self, **attrs):
self.__request_attrs__ = attrs
def view(context, request): # pragma: no cover
pass
@implementer(IMultiView)
| DummyView |
python | kamyu104__LeetCode-Solutions | Python/sum-of-perfect-square-ancestors.py | {
"start": 604,
"end": 2263
} | class ____(object):
def sumOfAncestors(self, n, edges, nums):
"""
:type n: int
:type edges: List[List[int]]
:type nums: List[int]
:rtype: int
"""
def prime_factors(x):
result = 1
while x != 1:
if result%SPF[x] == 0:
... | Solution |
python | apache__airflow | providers/microsoft/mssql/tests/unit/microsoft/mssql/hooks/test_mssql.py | {
"start": 3873,
"end": 10205
} | class ____:
def setup_method(self):
MsSqlHook._resolve_target_fields = True
def teardown_method(self, method):
MsSqlHook._resolve_target_fields = conf.getboolean(
"core", "dbapihook_resolve_target_fields", fallback=False
)
@mock.patch("airflow.providers.microsoft.mssql.... | TestMsSqlHook |
python | h5py__h5py | h5py/tests/test_dataset_getitem.py | {
"start": 11058,
"end": 15759
} | class ____(TestCase):
def setUp(self):
TestCase.setUp(self)
self.data = np.arange(13).astype('f')
self.dset = self.f.create_dataset('x', data=self.data)
def test_ndim(self):
""" Verify number of dimensions """
self.assertEqual(self.dset.ndim, 1)
def test_shape(self... | Test1DFloat |
python | astropy__astropy | astropy/utils/data_info.py | {
"start": 17827,
"end": 26329
} | class ____(DataInfo):
"""Base info class for anything that can be a column in an astropy Table.
There are at least two classes that inherit from this:
ColumnInfo: for native astropy Column / MaskedColumn objects
MixinInfo: for mixin column objects
Note that this class is defined here so that ... | BaseColumnInfo |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/memberAccess4.py | {
"start": 863,
"end": 996
} | class ____(Mixin2):
pass
A2.do_stuff()
# This should generate an error because B2 doesn't
# match the protocol.
B2.do_stuff()
| B2 |
python | anthropics__anthropic-sdk-python | src/anthropic/types/beta/beta_server_tool_caller.py | {
"start": 197,
"end": 299
} | class ____(BaseModel):
tool_id: str
type: Literal["code_execution_20250825"]
| BetaServerToolCaller |
python | langchain-ai__langchain | libs/core/langchain_core/runnables/graph.py | {
"start": 2271,
"end": 3107
} | class ____(NamedTuple):
"""Node in a graph."""
id: str
"""The unique identifier of the node."""
name: str
"""The name of the node."""
data: type[BaseModel] | RunnableType | None
"""The data of the node."""
metadata: dict[str, Any] | None
"""Optional metadata for the node. """
d... | Node |
python | PrefectHQ__prefect | src/prefect/server/database/orm_models.py | {
"start": 11117,
"end": 11697
} | class ____(Base):
key: Mapped[str]
latest_id: Mapped[uuid.UUID]
task_run_id: Mapped[Optional[uuid.UUID]]
flow_run_id: Mapped[Optional[uuid.UUID]]
type: Mapped[Optional[str]]
data: Mapped[Optional[Any]] = mapped_column(sa_JSON)
description: Mapped[Optional[str]]
metadata_: Mapped[Opti... | ArtifactCollection |
python | langchain-ai__langchain | libs/core/langchain_core/messages/content.py | {
"start": 16500,
"end": 17784
} | class ____(TypedDict):
"""Video data.
!!! note "Factory function"
`create_video_block` may also be used as a factory to create a
`VideoContentBlock`. Benefits include:
* Automatic ID generation (when not provided)
* Required arguments strictly validated at creation time
""... | VideoContentBlock |
python | keras-team__keras | keras/src/models/model_test.py | {
"start": 5449,
"end": 44649
} | class ____(testing.TestCase):
def test_functional_rerouting(self):
model = _get_model()
self.assertIsInstance(model, Functional)
def test_json_serialization(self):
model = _get_model()
json_string = model.to_json()
new_model = model_from_json(json_string)
self.as... | ModelTest |
python | kubernetes-client__python | kubernetes/base/dynamic/client.py | {
"start": 2172,
"end": 14416
} | class ____(object):
""" A kubernetes client that dynamically discovers and interacts with
the kubernetes API
"""
def __init__(self, client, cache_file=None, discoverer=None):
# Setting default here to delay evaluation of LazyDiscoverer class
# until constructor is called
dis... | DynamicClient |
python | PrefectHQ__prefect | src/prefect/server/models/task_workers.py | {
"start": 418,
"end": 3343
} | class ____:
def __init__(self) -> None:
self.workers: dict[WorkerId, Set[TaskKey]] = {}
self.task_keys: Dict[TaskKey, Set[WorkerId]] = defaultdict(set)
self.worker_timestamps: Dict[WorkerId, float] = {}
async def observe_worker(
self,
task_keys: List[TaskKey],
wo... | InMemoryTaskWorkerTracker |
python | airbytehq__airbyte | airbyte-integrations/connectors/destination-databend/destination_databend/writer.py | {
"start": 2773,
"end": 4174
} | class ____(DatabendWriter):
"""
Data writer using the SQL writing strategy. Data is buffered in memory
and flushed using INSERT INTO SQL statement.
"""
flush_interval = 1000
def __init__(self, client: DatabendClient) -> None:
"""
:param client: Databend SDK connection class wit... | DatabendSQLWriter |
python | Unity-Technologies__ml-agents | utils/make_readme_table.py | {
"start": 1213,
"end": 7095
} | class ____(NamedTuple):
release_tag: str
csharp_version: str
python_verion: str
release_date: str
is_verified: bool = False
@property
def loose_version(self) -> LooseVersion:
return LooseVersion(self.python_verion)
@property
def is_develop(self) -> bool:
return self... | ReleaseInfo |
python | apache__airflow | providers/google/src/airflow/providers/google/cloud/operators/bigquery.py | {
"start": 4446,
"end": 5460
} | class ____:
"""A class to handle the configuration for BigQueryHook.insert_job method."""
# Note: If you want to add this feature to a new operator you can include the class name in the type
# annotation of the `self`. Then you can inherit this class in the target operator.
# e.g: BigQueryCheckOperator... | _BigQueryOperatorsEncryptionConfigurationMixin |
python | ApeWorX__ape | src/ape/utils/process.py | {
"start": 95,
"end": 1198
} | class ____(queue.Queue):
"""
A queue that can be joined, useful for multi-processing.
Borrowed from the ``py-geth`` library.
"""
def __iter__(self):
while True:
item = self.get()
is_stop_iteration_type = isinstance(item, type) and issubclass(item, StopIteration)
... | JoinableQueue |
python | numba__numba | numba/core/byteflow.py | {
"start": 81221,
"end": 82391
} | class ____(object):
"""Adapt Flow to the old CFA class expected by Interpreter
"""
def __init__(self, flow):
self._flow = flow
self._blocks = {}
for offset, blockinfo in flow.block_infos.items():
self._blocks[offset] = AdaptCFBlock(blockinfo, offset)
backbone = se... | AdaptCFA |
python | numba__numba | numba/tests/test_operators.py | {
"start": 46953,
"end": 47815
} | class ____(TestCase):
"""
Test comparison of string constants
"""
def test_eq(self):
def test_impl1():
s = 'test'
return s == 'test'
def test_impl2():
s = 'test1'
return s == 'test'
cfunc1 = jit(nopython=True)(test_impl1)
... | TestStringConstComparison |
python | fluentpython__example-code-2e | 24-class-metaprog/checked/metaclass/checkedlib.py | {
"start": 3095,
"end": 3732
} | class ____(type):
def __new__(meta_cls, cls_name, bases, cls_dict): # <1>
if '__slots__' not in cls_dict: # <2>
slots = []
type_hints = cls_dict.get('__annotations__', {}) # <3>
for name, constructor in type_hints.items(): # <4>
field = Field(name, c... | CheckedMeta |
python | getsentry__sentry | src/sentry/grouping/api.py | {
"start": 5330,
"end": 20362
} | class ____(GroupingConfigLoader):
"""Does not affect grouping, runs in addition to measure performance impact"""
cache_prefix = "background-grouping-enhancements:"
def _get_config_id(self, _project: Project) -> str:
return options.get("store.background-grouping-config-id")
@sentry_sdk.tracing.tr... | BackgroundGroupingConfigLoader |
python | qdrant__qdrant-client | qdrant_client/http/models/models.py | {
"start": 40381,
"end": 40991
} | class ____(BaseModel, extra="forbid"):
should: Optional[Union[List["Condition"], "Condition"]] = Field(
default=None, description="At least one of those conditions should match"
)
min_should: Optional["MinShould"] = Field(
default=None, description="At least minimum amount of given condition... | Filter |
python | conda__conda | tests/shell/__init__.py | {
"start": 6498,
"end": 10911
} | class ____(metaclass=InteractiveShellType):
def __init__(
self,
shell: str | tuple[str, ...] | Shell,
*,
activator: str,
args: Iterable[str] = (),
init_command: str,
print_env_var: str,
exit_cmd: str | None = None,
base_shell: str | None = None... | InteractiveShell |
python | keras-team__keras | keras/src/layers/preprocessing/text_vectorization_test.py | {
"start": 329,
"end": 10672
} | class ____(testing.TestCase, parameterized.TestCase):
# TODO: increase coverage. Most features aren't being tested.
def test_config(self):
layer = layers.TextVectorization(
output_mode="int",
vocabulary=["one", "two"],
output_sequence_length=5,
)
self... | TextVectorizationTest |
python | airbytehq__airbyte | airbyte-ci/connectors/pipelines/pipelines/helpers/execution/run_steps.py | {
"start": 2340,
"end": 3933
} | class ____:
"""Options for the run_step function."""
fail_fast: bool = True
skip_steps: List[str] = field(default_factory=list)
keep_steps: List[str] = field(default_factory=list)
log_step_tree: bool = True
concurrency: int = 10
step_params: Dict[CONNECTOR_TEST_STEP_ID, STEP_PARAMS] = field... | RunStepOptions |
python | coleifer__peewee | peewee.py | {
"start": 260307,
"end": 260933
} | class ____(_ModelQueryHelper):
def __init__(self, model, *args, **kwargs):
self.model = model
super(_ModelWriteQueryHelper, self).__init__(model, *args, **kwargs)
def returning(self, *returning):
accum = []
for item in returning:
if is_model(item):
ac... | _ModelWriteQueryHelper |
python | kamyu104__LeetCode-Solutions | Python/sum-of-distances-in-tree.py | {
"start": 50,
"end": 1111
} | class ____(object):
def sumOfDistancesInTree(self, N, edges):
"""
:type N: int
:type edges: List[List[int]]
:rtype: List[int]
"""
def dfs(graph, node, parent, count, result):
for nei in graph[node]:
if nei != parent:
dfs... | Solution |
python | numba__numba | numba/cuda/stubs.py | {
"start": 5131,
"end": 5611
} | class ____(Stub):
'''
match_all_sync(mask, value)
Nvvm intrinsic for performing a compare and broadcast across a warp.
Returns a tuple of (mask, pred), where mask is a mask of threads that have
same value as the given value from within the masked warp, if they
all have the same value, otherwise... | match_all_sync |
python | django__django | tests/foreign_object/tests.py | {
"start": 26100,
"end": 31278
} | class ____(TestCase):
def test_equality(self):
"""
The path_infos and reverse_path_infos attributes are equivalent to
calling the get_<method>() with no arguments.
"""
foreign_object = Membership._meta.get_field("person")
self.assertEqual(
foreign_object.p... | TestCachedPathInfo |
python | tensorflow__tensorflow | tensorflow/python/distribute/one_device_strategy_test.py | {
"start": 6539,
"end": 7013
} | class ____(
strategy_test_lib.DistributionTestBase,
strategy_test_lib.OneDeviceDistributionTestBase):
def testDeviceAndInputDeviceAreColocated(self, distribution):
self._test_device_and_input_device_are_colocated(distribution)
def testDeviceAndInputDeviceAreColocatedWithFunction(self, distribution):
... | OneDeviceStrategyOnRemoteWorkerTest |
python | ethereum__web3.py | web3/types.py | {
"start": 6881,
"end": 7007
} | class ____(TypedDict, total=False):
id: RPCId
jsonrpc: Literal["2.0"]
method: RPCEndpoint
params: Any
| RPCRequest |
python | allegroai__clearml | clearml/backend_api/services/v2_23/tasks.py | {
"start": 463071,
"end": 467111
} | class ____(Request):
"""
Publish tasks
:param ids: IDs of the tasks to publish
:type ids: Sequence[str]
:param status_reason: Reason for status change
:type status_reason: str
:param status_message: Extra information regarding status change
:type status_message: str
:param force: If... | PublishManyRequest |
python | ray-project__ray | python/ray/serve/tests/unit/test_schema.py | {
"start": 22714,
"end": 29342
} | class ____:
def test_deploy_config_duplicate_apps(self):
deploy_config_dict = {
"applications": [
{
"name": "app1",
"route_prefix": "/alice",
"import_path": "module.graph",
},
{
... | TestServeDeploySchema |
python | langchain-ai__langchain | libs/core/langchain_core/runnables/graph_ascii.py | {
"start": 658,
"end": 1371
} | class ____:
"""VertexViewer class.
Class to define vertex box boundaries that will be accounted for during
graph building by grandalf.
"""
HEIGHT = 3 # top and bottom box edges + text
"""Height of the box."""
def __init__(self, name: str) -> None:
"""Create a VertexViewer.
... | VertexViewer |
python | allegroai__clearml | clearml/backend_api/services/v2_20/models.py | {
"start": 145245,
"end": 151614
} | class ____(Request):
"""
Create or update a new model for a task
:param task: Task id
:type task: str
:param uri: URI for the model. Exactly one of uri or override_model_id is a
required.
:type uri: str
:param name: Model name Unique within the company.
:type name: str
:para... | UpdateForTaskRequest |
python | aimacode__aima-python | utils4e.py | {
"start": 548,
"end": 12877
} | class ____:
"""A Queue in which the minimum (or maximum) element (as determined by f and order) is returned first.
If order is 'min', the item with minimum f(x) is
returned first; if order is 'max', then it is the item with maximum f(x).
Also supports dict-like lookup."""
def __init__(self, order='... | PriorityQueue |
python | getsentry__sentry | src/sentry/workflow_engine/types.py | {
"start": 8676,
"end": 9062
} | class ____(ABC):
"""
A ConfigTransformer is used to transform the config between API and internal representations.
"""
@abstractmethod
def from_api(self, config: dict[str, Any]) -> dict[str, Any]:
raise NotImplementedError
@abstractmethod
def to_api(self, config: dict[str, Any]) ->... | ConfigTransformer |
python | mwaskom__seaborn | seaborn/_marks/line.py | {
"start": 7156,
"end": 7505
} | class ____(Paths):
"""
A faster but less-flexible mark for drawing many lines.
See also
--------
Line : A mark connecting data points with sorting along the orientation axis.
Examples
--------
.. include:: ../docstrings/objects.Lines.rst
"""
_sort: ClassVar[bool] = True
@doc... | Lines |
python | getsentry__sentry | src/sentry/backup/comparators.py | {
"start": 16714,
"end": 21038
} | class ____(ObfuscatingComparator):
"""
Comparator that safely truncates passwords to ensure that they do not leak out in logs, stack
traces, etc. Additionally, it validates that the left and right "claimed" status is correct.
Namely, we want the following behaviors:
- If the left side is `is_unclai... | UserPasswordObfuscatingComparator |
python | doocs__leetcode | solution/0800-0899/0879.Profitable Schemes/Solution.py | {
"start": 0,
"end": 490
} | class ____:
def profitableSchemes(
self, n: int, minProfit: int, group: List[int], profit: List[int]
) -> int:
@cache
def dfs(i: int, j: int, k: int) -> int:
if i >= len(group):
return 1 if k == minProfit else 0
ans = dfs(i + 1, j, k)
i... | Solution |
python | sqlalchemy__sqlalchemy | test/orm/test_collection.py | {
"start": 77392,
"end": 79236
} | class ____(fixtures.ORMTest):
def test_name_setup(self):
class Base:
@collection.iterator
def base_iterate(self, x):
return "base_iterate"
@collection.appender
def base_append(self, x):
return "base_append"
@colle... | InstrumentationTest |
python | kamyu104__LeetCode-Solutions | Python/count-partitions-with-even-sum-difference.py | {
"start": 42,
"end": 408
} | class ____(object):
def countPartitions(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
result = left = 0
right = sum(nums)
for i in xrange(len(nums)-1):
left += nums[i]
right -= nums[i]
if left%2 == right%2:
... | Solution |
python | coleifer__peewee | tests/psycopg3_ext.py | {
"start": 19683,
"end": 20196
} | class ____(DatabaseTestCase):
database = db_loader('postgres', db_class=Psycopg3Database,
isolation_level=3) # SERIALIZABLE.
def test_isolation_level(self):
conn = self.database.connection()
self.assertEqual(conn.isolation_level, 3)
conn.isolation_level = 2
... | TestPsycopg3IsolationLevel |
python | dagster-io__dagster | python_modules/dagster-graphql/dagster_graphql/schema/inputs.py | {
"start": 13894,
"end": 14302
} | class ____(graphene.InputObjectType):
class Meta:
name = "InstigationSelector"
description = (
"""This type represents the fields necessary to identify a schedule or sensor."""
)
repositoryName = graphene.NonNull(graphene.String)
repositoryLocationName = graphene.NonNull... | GrapheneInstigationSelector |
python | django__django | tests/serializers/test_yaml.py | {
"start": 476,
"end": 1258
} | class ____:
"""Provides a wrapped import_module function to simulate yaml ImportError
In order to run tests that verify the behavior of the YAML serializer
when run on a system that has yaml installed (like the django CI server),
mock import_module, so that it raises an ImportError when the yaml
se... | YamlImportModuleMock |
python | doocs__leetcode | solution/0900-0999/0944.Delete Columns to Make Sorted/Solution.py | {
"start": 0,
"end": 309
} | class ____:
def minDeletionSize(self, strs: List[str]) -> int:
m, n = len(strs[0]), len(strs)
ans = 0
for j in range(m):
for i in range(1, n):
if strs[i][j] < strs[i - 1][j]:
ans += 1
break
return ans
| Solution |
python | pytorch__pytorch | torch/distributed/elastic/rendezvous/_etcd_stub.py | {
"start": 728,
"end": 852
} | class ____(Exception):
def __init__(self, *args: Any, **kwargs: Any) -> None:
raise EtcdStubError
| EtcdAlreadyExist |
python | django__django | tests/template_tests/syntax_tests/test_width_ratio.py | {
"start": 116,
"end": 6571
} | class ____(SimpleTestCase):
libraries = {"custom": "template_tests.templatetags.custom"}
@setup({"widthratio01": "{% widthratio a b 0 %}"})
def test_widthratio01(self):
output = self.engine.render_to_string("widthratio01", {"a": 50, "b": 100})
self.assertEqual(output, "0")
@setup({"wid... | WidthRatioTagTests |
python | chardet__chardet | chardet/jpcntx.py | {
"start": 25312,
"end": 26325
} | class ____(JapaneseContextAnalysis):
def __init__(self) -> None:
super().__init__()
self._charset_name = "SHIFT_JIS"
@property
def charset_name(self) -> str:
return self._charset_name
def get_order(self, byte_str: Union[bytes, bytearray]) -> Tuple[int, int]: # type: ignore[rep... | SJISContextAnalysis |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/namedTuple7.py | {
"start": 446,
"end": 570
} | class ____(NT1[str]): ...
reveal_type(NT2("", 4, []), expected_text="NT2")
# This should generate an error.
NT2(1, 4, [])
| NT2 |
python | run-llama__llama_index | llama-index-integrations/graph_stores/llama-index-graph-stores-memgraph/llama_index/graph_stores/memgraph/property_graph.py | {
"start": 2139,
"end": 42966
} | class ____(PropertyGraphStore):
r"""
Memgraph Property Graph Store.
This class implements a Memgraph property graph store.
Args:
username (str): The username for the Memgraph database.
password (str): The password for the Memgraph database.
url (str): The URL for the Memgraph d... | MemgraphPropertyGraphStore |
python | charliermarsh__ruff | crates/ruff_python_formatter/resources/test/fixtures/ruff/blank_line_before_class_docstring.py | {
"start": 57,
"end": 143
} | class ____:
# This is a comment
"""This is a docstring."""
| DocstringWithComment0 |
python | getsentry__sentry | tests/sentry/incidents/subscription_processor/test_subscription_processor_aci.py | {
"start": 4531,
"end": 15077
} | class ____(ProcessUpdateBaseClass):
@cached_property
def comparison_detector_above(self):
detector = self.metric_detector
detector.config.update({"comparison_delta": 60 * 60})
detector.save()
self.update_threshold(detector, DetectorPriorityLevel.HIGH, 150)
self.update_thr... | ProcessUpdateComparisonAlertTest |
python | ray-project__ray | python/ray/data/_internal/execution/interfaces/physical_operator.py | {
"start": 10669,
"end": 10987
} | class ____:
"""Breakdown of the state of the actors used by the ``PhysicalOperator``"""
running: int
pending: int
restarting: int
def __str__(self):
return (
f"running={self.running}, restarting={self.restarting}, "
f"pending={self.pending}"
)
| _ActorPoolInfo |
python | python-markdown__markdown | markdown/extensions/smarty.py | {
"start": 6167,
"end": 6801
} | class ____(HtmlInlineProcessor):
def __init__(self, pattern: str, replace: Sequence[int | str | etree.Element], md: Markdown):
""" Replaces matches with some text. """
HtmlInlineProcessor.__init__(self, pattern)
self.replace = replace
self.md = md
def handleMatch(self, m: re.Mat... | SubstituteTextPattern |
python | ethereum__web3.py | web3/exceptions.py | {
"start": 6944,
"end": 7073
} | class ____(Web3Exception):
"""
Raised when a JSON-RPC response comes back in an unexpected format
"""
| BadResponseFormat |
python | huggingface__transformers | src/transformers/models/levit/modeling_levit.py | {
"start": 4799,
"end": 5278
} | class ____(nn.Module):
def __init__(self, input_dim, output_dim, bn_weight_init=1):
super().__init__()
self.linear = nn.Linear(in_features=input_dim, out_features=output_dim, bias=False)
self.batch_norm = nn.BatchNorm1d(output_dim)
def forward(self, hidden_state):
hidden_state =... | MLPLayerWithBN |
python | doocs__leetcode | solution/0700-0799/0791.Custom Sort String/Solution2.py | {
"start": 0,
"end": 290
} | class ____:
def customSortString(self, order: str, s: str) -> str:
cnt = Counter(s)
ans = []
for c in order:
ans.append(c * cnt[c])
cnt[c] = 0
for c, v in cnt.items():
ans.append(c * v)
return ''.join(ans)
| Solution |
python | great-expectations__great_expectations | great_expectations/checkpoint/actions.py | {
"start": 41624,
"end": 43201
} | class ____(ValidationAction):
type: Literal["api"] = "api"
url: str
@override
def run(
self, checkpoint_result: CheckpointResult, action_context: ActionContext | None = None
) -> dict:
aggregate_payload = []
for run_id, run_result in checkpoint_result.run_results.items():
... | APINotificationAction |
python | weaviate__weaviate-python-client | weaviate/gql/filter.py | {
"start": 15276,
"end": 15852
} | class ____(NearMedia):
"""NearAudio class used to filter weaviate objects."""
def __init__(
self,
content: dict,
):
"""Initialize a NearAudio class instance.
Args:
content: The content of the `nearAudio` clause.
Raises:
TypeError: If 'conten... | NearAudio |
python | charliermarsh__ruff | crates/ruff_linter/resources/test/fixtures/pylint/duplicate_bases.py | {
"start": 114,
"end": 141
} | class ____(A, A,):
...
| F2 |
python | nedbat__coveragepy | tests/test_coverage.py | {
"start": 34505,
"end": 35245
} | class ____(CoverageTest):
"""Tests specific to annotations."""
def test_attribute_annotation(self) -> None:
if env.PYBEHAVIOR.deferred_annotations:
lines = [1, 3]
else:
lines = [1, 2, 3]
self.check_coverage(
"""\
class X:
x... | AnnotationTest |
python | kubernetes-client__python | kubernetes/client/api/coordination_api.py | {
"start": 543,
"end": 5197
} | 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
... | CoordinationApi |
python | huggingface__transformers | src/transformers/models/instructblip/configuration_instructblip.py | {
"start": 4852,
"end": 9877
} | class ____(PreTrainedConfig):
r"""
This is the configuration class to store the configuration of a [`InstructBlipQFormerModel`]. It is used to
instantiate a InstructBLIP Querying Transformer (Q-Former) model according to the specified arguments, defining the
model architecture. Instantiating a configura... | InstructBlipQFormerConfig |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.