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 | openai__openai-python | src/openai/types/responses/response_input_item_param.py | {
"start": 10615,
"end": 11322
} | class ____(TypedDict, total=False):
call_id: Required[str]
"""The unique ID of the apply patch tool call generated by the model."""
status: Required[Literal["completed", "failed"]]
"""The status of the apply patch tool call output. One of `completed` or `failed`."""
type: Required[Literal["apply_p... | ApplyPatchCallOutput |
python | pytorch__pytorch | torch/testing/_comparison.py | {
"start": 16719,
"end": 17244
} | class ____(Pair):
"""Pair for ``None`` inputs."""
def __init__(self, actual: Any, expected: Any, **other_parameters: Any) -> None:
if not (actual is None or expected is None):
self._inputs_not_supported()
super().__init__(actual, expected, **other_parameters)
def compare(self)... | NonePair |
python | Pylons__pyramid | tests/test_security.py | {
"start": 16863,
"end": 17477
} | class ____:
def __init__(self, result):
self.result = result
def identity(self, request):
return self.result
def authenticated_userid(self, request):
return self.result
def permits(self, request, context, permission):
return self.result
def remember(self, request,... | DummySecurityPolicy |
python | tensorflow__tensorflow | tensorflow/python/framework/tensor.py | {
"start": 44018,
"end": 50116
} | class ____(TensorSpec, trace_type.Serializable):
"""A `TensorSpec` that specifies minimum and maximum values.
Example usage:
```python
spec = tensor_spec.BoundedTensorSpec((1, 2, 3), tf.float32, 0, (5, 5, 5))
tf_minimum = tf.convert_to_tensor(spec.minimum, dtype=spec.dtype)
tf_maximum = tf.convert_to_tenso... | BoundedTensorSpec |
python | apache__airflow | task-sdk/src/airflow/sdk/execution_time/comms.py | {
"start": 25284,
"end": 25495
} | class ____(BaseModel):
"""Get the number of (mapped) XCom values available."""
key: str
dag_id: str
run_id: str
task_id: str
type: Literal["GetNumberXComs"] = "GetNumberXComs"
| GetXComCount |
python | kubernetes-client__python | kubernetes/client/models/v1_flow_distinguisher_method.py | {
"start": 383,
"end": 3798
} | class ____(object):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attri... | V1FlowDistinguisherMethod |
python | walkccc__LeetCode | solutions/1720. Decode XORed Array/1720.py | {
"start": 0,
"end": 168
} | class ____:
def decode(self, encoded: list[int], first: int) -> list[int]:
ans = [first]
for e in encoded:
ans.append(e ^ ans[-1])
return ans
| Solution |
python | run-llama__llama_index | llama-index-integrations/embeddings/llama-index-embeddings-nomic/llama_index/embeddings/nomic/base.py | {
"start": 821,
"end": 926
} | class ____(str, Enum):
REMOTE = "remote"
LOCAL = "local"
DYNAMIC = "dynamic"
| NomicInferenceMode |
python | h5py__h5py | h5py/tests/test_selections.py | {
"start": 692,
"end": 2224
} | class ____(BaseSelection):
"""
Internal feature: Determine output types from dataset dtype and fields.
"""
def test_simple(self):
""" Non-compound types are handled appropriately """
dt = np.dtype('i')
out, format = sel2.read_dtypes(dt, ())
self.assertEqual(out, for... | TestTypeGeneration |
python | tensorflow__tensorflow | tensorflow/python/saved_model/load_test.py | {
"start": 97818,
"end": 117832
} | class ____(test.TestCase, parameterized.TestCase):
def test_load_with_tags(self, use_cpp_bindings):
if use_cpp_bindings:
self.skipTest("Cpp bindings do not support Tags.")
root = autotrackable.AutoTrackable()
path = tempfile.mkdtemp(prefix=self.get_temp_dir())
save.save(root, path)
with se... | SingleCycleTests |
python | joke2k__faker | tests/providers/test_bank.py | {
"start": 2974,
"end": 3440
} | class ____:
"""Test sk_SK bank provider"""
def test_bban(self, faker, num_samples):
for _ in range(num_samples):
assert re.fullmatch(r"\d{20}", faker.bban())
def test_iban(self, faker, num_samples):
for _ in range(num_samples):
iban = faker.iban()
assert... | TestSkSk |
python | google__jax | jax/_src/pallas/mosaic_gpu/core.py | {
"start": 33222,
"end": 34148
} | class ____(state_types.Transform):
"""Bitcasts the underlying ref at the given offset to the given shape and dtype."""
dtype: dtypes.DType
shape: tuple[int, ...]
offset: int
# TMEM-specific params
layout: tcgen05.TMEMLayout | None
@classmethod
def from_transformed_ref(
cls,
ref: pallas_core... | ExtractAliasedRef |
python | getlogbook__logbook | src/logbook/handlers.py | {
"start": 11090,
"end": 11531
} | class ____(Handler):
"""A handler that does nothing.
Useful to silence logs above a certain location in the handler stack::
handler = NullHandler()
handler.push_application()
NullHandlers swallow all logs sent to them, and do not bubble them onwards.
"""
blackhole = True
de... | NullHandler |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/typeVarTuple16.py | {
"start": 462,
"end": 539
} | class ____(Base[int, str]): ...
Child.method1(1, "")
Child.method2(1, "")
| Child |
python | PyCQA__pylint | tests/functional/u/unsupported/unsupported_binary_operation.py | {
"start": 1409,
"end": 1738
} | class ____(A3):
def __radd__(self, other):
return NotImplemented
A3() + B3() # [unsupported-binary-operation]
# Augmented
FFF = 1
FFF += A() # [unsupported-binary-operation]
TTT = 1
TTT += [] # [unsupported-binary-operation]
# Don't emit for this case since we don't know what unknown is.
from unknown impo... | B3 |
python | jina-ai__jina | jina/proto/serializer.py | {
"start": 2853,
"end": 3529
} | class ____:
"""Since the serializer is replacing the `jina_pb2 to know how to exactly serialize messages, this is just a placeholder that
delegates the serializing and deserializing to the internal protobuf structure with no extra optimization.
"""
@staticmethod
def SerializeToString(x):
""... | StatusProto |
python | openai__openai-python | src/openai/types/webhooks/response_incomplete_webhook_event.py | {
"start": 327,
"end": 782
} | class ____(BaseModel):
id: str
"""The unique ID of the event."""
created_at: int
"""The Unix timestamp (in seconds) of when the model response was interrupted."""
data: Data
"""Event data payload."""
type: Literal["response.incomplete"]
"""The type of the event. Always `response.incom... | ResponseIncompleteWebhookEvent |
python | realpython__materials | wordcount/tests/fixtures.py | {
"start": 1463,
"end": 5603
} | class ____:
files: list[FakeFile]
def __iter__(self):
return iter(self.files)
def __len__(self):
return len(self.files)
@cached_property
def paths(self):
return [str(file.path) for file in self.files]
@cached_property
def expected(self):
if len(self.files)... | Files |
python | conda__conda | conda/core/path_actions.py | {
"start": 37697,
"end": 38213
} | class ____(PrefixPathAction, metaclass=ABCMeta):
def __init__(
self, transaction_context, linked_package_data, target_prefix, target_short_path
):
super().__init__(transaction_context, target_prefix, target_short_path)
self.linked_package_data = linked_package_data
def verify(self):... | RemoveFromPrefixPathAction |
python | getsentry__sentry | src/sentry/tempest/serializers.py | {
"start": 1487,
"end": 2462
} | class ____(serializers.ModelSerializer):
clientId = serializers.CharField(source="client_id")
clientSecret = serializers.CharField(source="client_secret")
message = serializers.CharField(read_only=True)
messageType = serializers.CharField(source="message_type", read_only=True)
latestFetchedItemId = ... | DRFTempestCredentialsSerializer |
python | pydantic__pydantic | tests/mypy/modules/plugin_success.py | {
"start": 6794,
"end": 6946
} | class ____(BaseModel):
model_config = ConfigDict(populate_by_name=True)
my_field: str = Field(alias='my_alias')
m5 = Model5(my_field='foo')
| Model5 |
python | charliermarsh__ruff | crates/ruff_linter/resources/test/fixtures/ruff/RUF009_attrs.py | {
"start": 2172,
"end": 2208
} | class ____:
foo: int = 1
@define
| D |
python | google__pytype | pytype_extensions/__init__.py | {
"start": 1471,
"end": 5187
} | class ____(Protocol[T]):
"""Protocol that matches any dataclass (or instance thereof).
Can be used to match any dataclass. Example (modulo pytype bugs):
@dataclasses.dataclass
class Foo:
x: str
y: int
@dataclasses.dataclass
class Bar:
x: str
y: str
class Baz:
x: str
y: int
d... | Dataclass |
python | getsentry__sentry | src/sentry/sentry_metrics/indexer/base.py | {
"start": 14267,
"end": 18674
} | class ____(Service):
"""
Provides integer IDs for metric names, tag keys and tag values
and the corresponding reverse lookup.
Check `sentry.snuba.metrics` for convenience functions.
"""
__all__ = (
"record",
"resolve",
"reverse_resolve",
"bulk_record",
"... | StringIndexer |
python | spack__spack | lib/spack/spack/mirrors/layout.py | {
"start": 812,
"end": 2242
} | class ____(MirrorLayout):
def __init__(self, alias_path: str, digest_path: Optional[str] = None) -> None:
# When we have a digest, it is used as the primary storage location. If not, then we use
# the human-readable alias. In case of mirrors of a VCS checkout, we currently do not have
# a di... | DefaultLayout |
python | encode__django-rest-framework | tests/test_middleware.py | {
"start": 678,
"end": 789
} | class ____(APIView):
def post(self, request):
return Response(data=request.data, status=200)
| PostView |
python | apache__airflow | providers/databricks/src/airflow/providers/databricks/operators/databricks.py | {
"start": 16646,
"end": 29928
} | class ____(BaseOperator):
"""
Submits a Spark job run to Databricks using the api/2.1/jobs/runs/submit API endpoint.
See: https://docs.databricks.com/dev-tools/api/latest/jobs.html#operation/JobsRunsSubmit
There are three ways to instantiate this operator.
.. seealso::
For more informatio... | DatabricksSubmitRunOperator |
python | mlflow__mlflow | dev/remove_experimental_decorators.py | {
"start": 347,
"end": 6146
} | class ____:
version: str
line_number: int
end_line_number: int
column: int
age_days: int
content: str
def get_tracked_python_files() -> list[Path]:
"""Get all tracked Python files in the repository."""
result = subprocess.check_output(["git", "ls-files", "*.py"], text=True)
return ... | ExperimentalDecorator |
python | wandb__wandb | wandb/vendor/pygments/lexers/tcl.py | {
"start": 450,
"end": 5398
} | class ____(RegexLexer):
"""
For Tcl source code.
.. versionadded:: 0.10
"""
keyword_cmds_re = words((
'after', 'apply', 'array', 'break', 'catch', 'continue', 'elseif', 'else', 'error',
'eval', 'expr', 'for', 'foreach', 'global', 'if', 'namespace', 'proc', 'rename', 'return',
... | TclLexer |
python | langchain-ai__langchain | libs/partners/fireworks/tests/unit_tests/test_standard.py | {
"start": 284,
"end": 1361
} | class ____(ChatModelUnitTests):
@property
def chat_model_class(self) -> type[BaseChatModel]:
return ChatFireworks
@property
def chat_model_params(self) -> dict:
return {
"model": "accounts/fireworks/models/llama-v3p1-70b-instruct",
"api_key": "test_api_key",
... | TestFireworksStandard |
python | conda__conda | conda/common/configuration.py | {
"start": 49915,
"end": 64278
} | class ____(metaclass=ConfigurationType):
def __init__(self, search_path=(), app_name=None, argparse_args=None, **kwargs):
# Currently, __init__ does a **full** disk reload of all files.
# A future improvement would be to cache files that are already loaded.
self.raw_data = {}
self._c... | Configuration |
python | apache__thrift | lib/py/src/transport/THeaderTransport.py | {
"start": 1564,
"end": 2081
} | class ____(object):
ZLIB = 0x01
READ_TRANSFORMS_BY_ID = {
THeaderTransformID.ZLIB: zlib.decompress,
}
WRITE_TRANSFORMS_BY_ID = {
THeaderTransformID.ZLIB: zlib.compress,
}
def _readString(trans):
size = readVarint(trans)
if size < 0:
raise TTransportException(
TTransportExce... | THeaderTransformID |
python | huggingface__transformers | src/transformers/models/efficientnet/modeling_efficientnet.py | {
"start": 4832,
"end": 6192
} | class ____(nn.Module):
r"""
This corresponds to the depthwise convolution phase of each block in the original implementation.
"""
def __init__(
self,
config: EfficientNetConfig,
in_dim: int,
stride: int,
kernel_size: int,
adjust_padding: bool,
):
... | EfficientNetDepthwiseLayer |
python | Netflix__metaflow | metaflow/_vendor/click/core.py | {
"start": 4679,
"end": 23695
} | class ____(object):
"""The context is a special internal object that holds state relevant
for the script execution at every single level. It's normally invisible
to commands unless they opt-in to getting access to it.
The context is useful as it can pass internal objects around and can
control spe... | Context |
python | kamyu104__LeetCode-Solutions | Python/maximal-square.py | {
"start": 2114,
"end": 3811
} | class ____(object):
# @param {character[][]} matrix
# @return {integer}
def maximalSquare(self, matrix):
if not matrix:
return 0
H, W = 0, 1
# DP table stores (h, w) for each (i, j).
table = [[[0, 0] for j in xrange(len(matrix[0]))] \
for... | Solution3 |
python | ray-project__ray | python/ray/dashboard/modules/node/datacenter.py | {
"start": 370,
"end": 1012
} | class ____:
# {node id hex(str): node stats(dict of GetNodeStatsReply
# in node_manager.proto)}
node_stats = {}
# {node id hex(str): node physical stats(dict from reporter_agent.py)}
node_physical_stats = {}
# {actor id hex(str): actor table data(dict of ActorTableData
# in gcs.proto)}
a... | DataSource |
python | walkccc__LeetCode | solutions/2389. Longest Subsequence With Limited Sum/2389.py | {
"start": 0,
"end": 363
} | class ____:
def answerQueries(self, nums: list[int], queries: list[int]) -> list[int]:
nums.sort()
def numOfElementsLessThan(query: int) -> int:
summ = 0
for i, num in enumerate(nums):
summ += num
if summ > query:
return i
return len(nums)
return [numOfElement... | Solution |
python | dask__dask | dask/dataframe/dask_expr/_expr.py | {
"start": 54102,
"end": 54533
} | class ____(Elemwise):
_projection_passthrough = True
_filter_passthrough = True
_parameters = ["frame", "mapper", "index", "columns", "axis"]
_defaults = {
"mapper": no_default,
"index": no_default,
"columns": no_default,
"axis": 0,
}
_keyword_only = ["mapper", "i... | RenameAxis |
python | pytorch__pytorch | torch/distributed/checkpoint/_experimental/checkpoint_writer.py | {
"start": 1654,
"end": 5270
} | class ____:
"""
Handles writing state dictionaries to storage.
This class is responsible for writing model state dictionaries to storage according
to the specified checkpoint layout. It supports synchronization barriers to ensure
all ranks in a distributed setting complete their checkpoint operatio... | CheckpointWriter |
python | pytorch__pytorch | torch/distributed/fsdp/_fully_shard/_fsdp_param_group.py | {
"start": 4844,
"end": 39082
} | class ____:
"""This class represents a parameter group to communicate together."""
_orig_dtype: Optional[torch.dtype]
_reduce_dtype: Optional[torch.dtype]
def __init__(
self,
params: list[nn.Parameter],
modules: tuple[nn.Module, ...],
mesh_info: FSDPMeshInfo,
po... | FSDPParamGroup |
python | prakhar1989__Algorithms | tests/gcd_test.py | {
"start": 45,
"end": 516
} | class ____(unittest.TestCase):
def test_gcd(self):
self.assertEqual(fractions.gcd(30,50),GCD.greatest_common_divisor(30,50))
self.assertEqual(fractions.gcd(55555,123450),GCD.greatest_common_divisor(55555,123450))
self.assertEqual(fractions.gcd(-30,-50),GCD.greatest_common_divisor(-30,-50))
... | TestEuclideanGCD |
python | getsentry__sentry | src/sentry/relay/config/__init__.py | {
"start": 8609,
"end": 8802
} | class ____(TypedDict):
id: str
passive: NotRequired[bool]
window: SlidingWindow
limit: int
scope: Literal["organization", "project"]
namespace: str | None
| CardinalityLimit |
python | dask__dask | dask/dataframe/shuffle.py | {
"start": 298,
"end": 7795
} | class ____:
"""
If serialized, will return non-buffered partd. Otherwise returns a buffered partd
"""
def __init__(self, encode_cls=None, buffer=True, tempdir=None):
self.tempdir = tempdir or config.get("temporary_directory", None)
self.buffer = buffer
self.compression = config.... | maybe_buffered_partd |
python | tiangolo__fastapi | docs_src/extra_models/tutorial001.py | {
"start": 114,
"end": 236
} | class ____(BaseModel):
username: str
password: str
email: EmailStr
full_name: Union[str, None] = None
| UserIn |
python | python-poetry__poetry | src/poetry/console/application.py | {
"start": 3353,
"end": 22268
} | class ____(BaseApplication):
def __init__(self) -> None:
super().__init__("poetry", __version__)
self._poetry: Poetry | None = None
self._io: IO | None = None
self._disable_plugins = False
self._disable_cache = False
self._plugins_loaded = False
self._working... | Application |
python | wandb__wandb | wandb/vendor/pygments/lexers/robotframework.py | {
"start": 11610,
"end": 11673
} | class ____(_Table):
_tokenizer_class = Variable
| VariableTable |
python | HypothesisWorks__hypothesis | hypothesis-python/tests/django/toystore/test_given_forms.py | {
"start": 1436,
"end": 5247
} | class ____(TestCase):
@given(from_form(CustomerForm))
def test_valid_customer(self, customer_form):
self.assertTrue(customer_form.is_valid())
@given(from_form(ManyNumericsForm))
def test_valid_numerics(self, numerics_form):
self.assertTrue(numerics_form.is_valid())
@given(from_form... | TestGetsBasicForms |
python | sqlalchemy__sqlalchemy | lib/sqlalchemy/sql/elements.py | {
"start": 182836,
"end": 185092
} | class ____(Annotated):
_Annotated__element: ColumnElement[Any]
def __init__(self, element, values):
Annotated.__init__(self, element, values)
for attr in (
"comparator",
"_proxy_key",
"_tq_key_label",
"_tq_label",
"_non_anon_label",
... | AnnotatedColumnElement |
python | PrefectHQ__prefect | src/integrations/prefect-dbt/prefect_dbt/cloud/models.py | {
"start": 758,
"end": 2403
} | class ____(BaseModel):
"""
Defines options that can be defined when triggering a dbt Cloud job run.
"""
cause: str = Field(
default_factory=default_cause_factory,
description="A text description of the reason for running this job.",
)
git_sha: Optional[str] = Field(
defa... | TriggerJobRunOptions |
python | spyder-ide__spyder | spyder/plugins/run/api.py | {
"start": 4775,
"end": 5106
} | class ____(TypedDict):
"""Output format information schema."""
# Human-readable name for the output format. It must be CamelCase
name: str
# String identifier for the output format. If non-existent or None, then a
# snake_case version of the name is used.
identifier: NotRequired[Optional[str]]... | OutputFormat |
python | astropy__astropy | astropy/io/votable/exceptions.py | {
"start": 29048,
"end": 29704
} | class ____(UnimplementedWarning):
"""
The 4 datatypes defined in the VOTable specification and supported by
``astropy.io.votable`` are ``TABLEDATA``, ``BINARY``, ``BINARY2`` and ``FITS``.
In addition, ``astropy.io.votable`` also supports ``PARQUET`` serialization, which is
a candidate for addition t... | W37 |
python | keras-team__keras | keras/src/optimizers/adafactor_test.py | {
"start": 152,
"end": 3791
} | class ____(testing.TestCase):
def test_config(self):
optimizer = Adafactor(
learning_rate=0.5,
beta_2_decay=-0.65,
epsilon_1=1e-15,
epsilon_2=1e-4,
clip_threshold=0.9,
relative_step=False,
)
self.run_class_serialization_... | AdafactorTest |
python | ray-project__ray | python/ray/data/preprocessors/scaler.py | {
"start": 9061,
"end": 12880
} | class ____(SerializablePreprocessorBase):
r"""Scale each column by its absolute max value.
The general formula is given by
.. math::
x' = \frac{x}{\max{\vert x \vert}}
where :math:`x` is the column and :math:`x'` is the transformed column. If
:math:`\max{\vert x \vert} = 0` (i.e., the co... | MaxAbsScaler |
python | PrefectHQ__prefect | tests/server/models/test_workers.py | {
"start": 2271,
"end": 5439
} | class ____:
async def test_creating_a_pool_creates_default_queue(self, session: AsyncSession):
result = await models.workers.create_work_pool(
session=session,
work_pool=schemas.actions.WorkPoolCreate(name="My Test Pool"),
)
# read the default queue
queue = a... | TestDefaultQueues |
python | ray-project__ray | python/ray/tests/test_multi_tenancy.py | {
"start": 3292,
"end": 10371
} | class ____:
def __init__(self):
self._tmpdir = tempfile.TemporaryDirectory()
self._tmppath = os.path.join(self._tmpdir.name, "signal.txt")
def __enter__(self):
return self
def __exit__(self, exc_type, exc_val, exc_tb):
self._tmpdir.cleanup()
def wait(self):
whi... | SignalFile |
python | spack__spack | var/spack/test_repos/spack_repo/builtin_mock/packages/mirror_sourceware_broken/package.py | {
"start": 307,
"end": 623
} | class ____(AutotoolsPackage, SourcewarePackage):
"""Simple sourceware.org package"""
homepage = "https://sourceware.org/bzip2/"
url = "https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz"
version("1.0.8", sha256="ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269")
| MirrorSourcewareBroken |
python | jmcnamara__XlsxWriter | xlsxwriter/test/comparison/test_chart_data_labels33.py | {
"start": 315,
"end": 1654
} | class ____(ExcelComparisonTest):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.set_filename("chart_data_labels33.xlsx")
def test_create_file(self):
"""Test the creation of a simple XlsxWriter file."""
workbook = Workbook(se... | TestCompareXLSXFiles |
python | celery__celery | celery/bin/worker.py | {
"start": 981,
"end": 2062
} | class ____(click.Choice):
"""Workers pool option."""
name = "pool"
def __init__(self):
"""Initialize the workers pool option with the relevant choices."""
super().__init__(concurrency.get_available_pool_names())
def convert(self, value, param, ctx):
# Pools like eventlet/geven... | WorkersPool |
python | pallets__jinja | src/jinja2/async_utils.py | {
"start": 2071,
"end": 2816
} | class ____(t.Generic[V]):
def __init__(self, iterator: "t.Iterator[V]"):
self._iterator = iterator
def __aiter__(self) -> "te.Self":
return self
async def __anext__(self) -> V:
try:
return next(self._iterator)
except StopIteration as e:
raise StopAsy... | _IteratorToAsyncIterator |
python | dagster-io__dagster | python_modules/libraries/dagster-airbyte/dagster_airbyte/managed/generated/destinations.py | {
"start": 8346,
"end": 8949
} | class ____(GeneratedAirbyteDestination):
@public
def __init__(self, name: str, bucket_id: str, secret_key: str):
"""Airbyte Destination for Kvdb.
Documentation can be found at https://kvdb.io/docs/api/
Args:
name (str): The name of the destination.
bucket_id (st... | KvdbDestination |
python | ray-project__ray | python/ray/util/state/common.py | {
"start": 55228,
"end": 55497
} | class ____:
#: The class name of the actor.
class_name: str
#: State name to the count dict. State name is equivalent to
#: the protobuf ActorState.
state_counts: Dict[TypeActorStatus, int] = field(default_factory=dict)
@dataclass
| ActorSummaryPerClass |
python | allegroai__clearml | clearml/backend_api/services/v2_20/queues.py | {
"start": 84406,
"end": 85808
} | class ____(Request):
"""
Removes a task entry from the queue.
:param queue: Queue id
:type queue: str
:param task: Task id
:type task: str
"""
_service = "queues"
_action = "remove_task"
_version = "2.20"
_schema = {
"definitions": {},
"properties": {
... | RemoveTaskRequest |
python | falconry__falcon | tests/test_error_handlers.py | {
"start": 882,
"end": 1322
} | class ____:
def on_get(self, req, resp):
raise Exception('Plain Exception')
def on_head(self, req, resp):
raise CustomBaseException('CustomBaseException')
def on_delete(self, req, resp):
raise CustomException('CustomException')
@pytest.fixture
def client(asgi, util):
app = ut... | ErroredClassResource |
python | plotly__plotly.py | plotly/graph_objs/layout/ternary/baxis/_title.py | {
"start": 235,
"end": 2875
} | class ____(_BaseLayoutHierarchyType):
_parent_path_str = "layout.ternary.baxis"
_path_str = "layout.ternary.baxis.title"
_valid_props = {"font", "text"}
@property
def font(self):
"""
Sets this axis' title font.
The 'font' property is an instance of Font
that may be ... | Title |
python | encode__starlette | starlette/datastructures.py | {
"start": 21709,
"end": 22448
} | class ____:
"""
An object that can be used to store arbitrary state.
Used for `request.state` and `app.state`.
"""
_state: dict[str, Any]
def __init__(self, state: dict[str, Any] | None = None):
if state is None:
state = {}
super().__setattr__("_state", state)
... | State |
python | pdm-project__pdm | src/pdm/models/candidates.py | {
"start": 3691,
"end": 11067
} | class ____:
"""A concrete candidate that can be downloaded and installed.
A candidate comes from the PyPI index of a package, or from the requirement itself
(for file or VCS requirements). Each candidate has a name, version and several
dependencies together with package metadata.
"""
__slots__ ... | Candidate |
python | pallets__click | src/click/types.py | {
"start": 39799,
"end": 39927
} | class ____(t.TypedDict, total=False):
envvars: tuple[str, ...]
default: str
range: str
required: str
| OptionHelpExtra |
python | langchain-ai__langchain | libs/core/langchain_core/runnables/config.py | {
"start": 1319,
"end": 16143
} | class ____(TypedDict, total=False):
"""Configuration for a `Runnable`.
See the [reference docs](https://reference.langchain.com/python/langchain_core/runnables/#langchain_core.runnables.RunnableConfig)
for more details.
"""
tags: list[str]
"""Tags for this call and any sub-calls (e.g. a Chain ... | RunnableConfig |
python | sphinx-doc__sphinx | sphinx/domains/c/__init__.py | {
"start": 13352,
"end": 13407
} | class ____(CObject):
object_type = 'type'
| CTypeObject |
python | pytorch__pytorch | torch/cpu/__init__.py | {
"start": 2451,
"end": 3064
} | class ____:
def query(self) -> bool:
return True
def record(self, stream=None) -> None:
pass
def synchronize(self) -> None:
pass
def wait(self, stream=None) -> None:
pass
_default_cpu_stream = Stream()
_current_stream = _default_cpu_stream
def current_stream(device... | Event |
python | readthedocs__sphinx_rtd_theme | setup.py | {
"start": 591,
"end": 977
} | class ____(distutils.cmd.Command):
description = "Run Webpack dev server"
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
subprocess.run(
["node_modules/.bin/webpack-dev-server", "--open", "--config", "webp... | WebpackDevelopCommand |
python | encode__django-rest-framework | tests/test_serializer_nested.py | {
"start": 7065,
"end": 8462
} | class ____:
def setup_method(self):
class NestedSerializer(serializers.Serializer):
one = serializers.IntegerField(max_value=10)
class TestSerializer(serializers.Serializer):
nested = NestedSerializer(required=False, many=True)
self.Serializer = TestSerializer
... | TestNotRequiredNestedSerializerWithMany |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/genericType28.py | {
"start": 1141,
"end": 1182
} | class ____(Class4[T_co]): ...
| Class4_Child3 |
python | dask__dask | dask/dataframe/dask_expr/_rolling.py | {
"start": 5052,
"end": 5106
} | class ____(RollingReduction):
how = "max"
| RollingMax |
python | allegroai__clearml | clearml/backend_api/services/v2_13/models.py | {
"start": 41141,
"end": 42442
} | class ____(Request):
"""
Delete models
:param ids: Entities to move
:type ids: Sequence[str]
"""
_service = "models"
_action = "delete_many"
_version = "2.13"
_schema = {
"definitions": {},
"force": {
"description": "Force. Required if there are tasks th... | DeleteManyRequest |
python | kamyu104__LeetCode-Solutions | Python/minimum-time-takes-to-reach-destination-without-drowning.py | {
"start": 1394,
"end": 2970
} | class ____(object):
def minimumSeconds(self, land):
"""
:type land: List[List[str]]
:rtype: int
"""
DIRECTIONS = ((1, 0), (0, 1), (-1, 0), (0, -1))
lookup1 = [[0 if land[i][j] == "*" else -1 for j in xrange(len(land[0]))] for i in xrange(len(land))]
lookup2 = ... | Solution2 |
python | pytorch__pytorch | torch/_dynamo/variables/functions.py | {
"start": 45679,
"end": 46034
} | class ____(
LocalGeneratorObjectVariable
):
"""
.. note::
This is only used when the function is annotated with @contextlib.contextmanager
It is a special case of a generator function as we do not allow return a context manager
from a torch.compile function.
"""
| ContextlibContextManagerLocalGeneratorObjectVariable |
python | django__django | tests/admin_inlines/admin.py | {
"start": 3955,
"end": 4054
} | class ____(forms.NumberInput):
class Media:
js = ("custom_number.js",)
| CustomNumberWidget |
python | cherrypy__cherrypy | cherrypy/test/modpy.py | {
"start": 3237,
"end": 5447
} | class ____(helper.Supervisor):
"""Server Controller for ModPython and CherryPy."""
using_apache = True
using_wsgi = False
template = None
def __str__(self):
"""Render a :class:`ModPythonSupervisor` instance as a string."""
return 'ModPython Server on %s:%s' % (self.host, self.port)... | ModPythonSupervisor |
python | pennersr__django-allauth | tests/apps/socialaccount/providers/line/tests.py | {
"start": 236,
"end": 693
} | class ____(OAuth2TestsMixin, TestCase):
provider_id = LineProvider.id
def get_mocked_response(self):
return MockedResponse(
HTTPStatus.OK,
"""
{
"userId": "u7d47d26a6bab09b95695ff02d1a36e38",
"displayName": "\uc774\uc0c1\ud601",
"pictureUrl":
"http://dl.profile.line-cdn.net/0m05... | LineTests |
python | dagster-io__dagster | python_modules/dagster/dagster/_daemon/sensor.py | {
"start": 27075,
"end": 56246
} | class ____(NamedTuple):
run_key: Optional[str]
error_info: Optional[SerializableErrorInfo]
run: Union[SkippedSensorRun, DagsterRun, BackfillSubmission]
def _submit_run_request(
run_id: str,
run_request: RunRequest,
workspace_process_context: IWorkspaceProcessContext,
remote_sensor: RemoteS... | SubmitRunRequestResult |
python | streamlit__streamlit | lib/streamlit/elements/lib/form_utils.py | {
"start": 873,
"end": 2587
} | class ____(NamedTuple):
"""Form data stored on a DeltaGenerator."""
# The form's unique ID.
form_id: str
def _current_form(this_dg: DeltaGenerator) -> FormData | None:
"""Find the FormData for the given DeltaGenerator.
Forms are blocks, and can have other blocks nested inside them.
To find t... | FormData |
python | apache__airflow | airflow-core/src/airflow/dag_processing/collection.py | {
"start": 26919,
"end": 43390
} | class ____(NamedTuple):
"""Collect asset/alias objects from DAGs and perform database operations for them."""
schedule_asset_references: dict[str, list[Asset]]
schedule_asset_alias_references: dict[str, list[AssetAlias]]
schedule_asset_name_references: set[tuple[str, str]] # dag_id, ref_name.
sche... | AssetModelOperation |
python | run-llama__llama_index | llama-index-core/llama_index/core/query_engine/sub_question_query_engine.py | {
"start": 1121,
"end": 1382
} | class ____(BaseModel):
"""
Pair of the sub question and optionally its answer (if its been answered yet).
"""
sub_q: SubQuestion
answer: Optional[str] = None
sources: List[NodeWithScore] = Field(default_factory=list)
| SubQuestionAnswerPair |
python | dagster-io__dagster | python_modules/dagster/dagster/_core/snap/dep_snapshot.py | {
"start": 7744,
"end": 9219
} | class ____(
NamedTuple(
"_NodeInvocationSnap",
[
("node_name", str),
("node_def_name", str),
("tags", Mapping[str, str]),
("input_dep_snaps", Sequence[InputDependencySnap]),
("is_dynamic_mapped", bool),
],
)
):
def __new__(
... | NodeInvocationSnap |
python | huggingface__transformers | src/transformers/models/blip/modeling_blip.py | {
"start": 18124,
"end": 18931
} | class ____(PreTrainedModel):
config: BlipConfig
base_model_prefix = "blip"
input_modalities = ("image", "text")
supports_gradient_checkpointing = True
_no_split_modules = ["BlipEncoderLayer", "BlipTextEmbeddings"]
_skip_keys_device_placement = ["past_key_values"]
@torch.no_grad()
def _i... | BlipPreTrainedModel |
python | google__jax | tests/config_test.py | {
"start": 1236,
"end": 4560
} | class ____(jtu.JaxTestCase):
@parameterized.named_parameters(
{"testcase_name": "_enum", "config_name": "jax_test_enum_config",
"config_obj": jax_test_enum_config, "default": "default", "val1": "xxx",
"val2": "yyy"},
{"testcase_name": "_bool", "config_name": "jax_test_bool_config",
"c... | ConfigTest |
python | urllib3__urllib3 | test/conftest.py | {
"start": 11193,
"end": 12560
} | class ____:
def __init__(self, *args: typing.Any, **kwargs: typing.Any):
raise ValueError(
"HTTP/2 support currently only applies to HTTPS, don't use http_version for HTTP tests"
)
@pytest.fixture(params=["h11", "h2"])
def http_version(request: pytest.FixtureRequest) -> typing.Generato... | ErroringHTTPConnection |
python | django__django | tests/template_tests/syntax_tests/i18n/test_get_current_language_bidi.py | {
"start": 129,
"end": 607
} | class ____(SimpleTestCase):
libraries = {"i18n": "django.templatetags.i18n"}
@setup({"template": "{% load i18n %} {% get_current_language_bidi %}"})
def test_no_as_var(self):
msg = (
"'get_current_language_bidi' requires 'as variable' (got "
"['get_current_language_bidi'])"
... | I18nGetCurrentLanguageBidiTagTests |
python | getsentry__sentry | tests/snuba/search/test_backend.py | {
"start": 3914,
"end": 11342
} | class ____(SharedSnubaMixin):
@property
def backend(self):
return EventsDatasetSnubaSearchBackend()
def setUp(self) -> None:
super().setUp()
self.base_datetime = before_now(days=3).replace(microsecond=0)
event1_timestamp = (self.base_datetime - timedelta(days=21)).isoformat... | EventsDatasetTestSetup |
python | apache__airflow | providers/google/src/airflow/providers/google/cloud/operators/compute.py | {
"start": 60867,
"end": 68250
} | class ____(ComputeEngineBaseOperator):
"""
Creates an Instance Group Managers using the body specified.
After the group is created, instances in the group are created using the specified Instance Template.
.. seealso::
For more information on how to use this operator, take a look at the guide:... | ComputeEngineInsertInstanceGroupManagerOperator |
python | sympy__sympy | sympy/printing/llvmjitcode.py | {
"start": 10958,
"end": 12423
} | class ____(LLVMJitCode):
def __init__(self, signature):
super().__init__(signature)
def _create_param_dict(self, func_args):
for i, a in enumerate(func_args):
if isinstance(a, IndexedBase):
self.param_dict[a] = (self.fn.args[i], i)
self.fn.args[i].nam... | LLVMJitCodeCallback |
python | doocs__leetcode | solution/2000-2099/2031.Count Subarrays With More Ones Than Zeros/Solution2.py | {
"start": 0,
"end": 308
} | class ____:
def subarraysWithMoreZerosThanOnes(self, nums: List[int]) -> int:
sl = SortedList([0])
mod = 10**9 + 7
ans = s = 0
for x in nums:
s += x or -1
ans += sl.bisect_left(s)
ans %= mod
sl.add(s)
return ans
| Solution |
python | walkccc__LeetCode | solutions/406. Queue Reconstruction by Height/406.py | {
"start": 0,
"end": 228
} | class ____:
def reconstructQueue(self, people: list[list[int]]) -> list[list[int]]:
ans = []
people.sort(key=lambda x: (-x[0], x[1]))
for person in people:
ans.insert(person[1], person)
return ans
| Solution |
python | lepture__authlib | authlib/oidc/core/errors.py | {
"start": 514,
"end": 953
} | class ____(OAuth2Error):
"""The Authorization Server requires End-User authentication. This error
MAY be returned when the prompt parameter value in the Authentication
Request is none, but the Authentication Request cannot be completed
without displaying a user interface for End-User authentication.
... | LoginRequiredError |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 917428,
"end": 920096
} | class ____(sgqlc.types.Type):
"""A ref update rules for a viewer."""
__schema__ = github_schema
__field_names__ = (
"allows_deletions",
"allows_force_pushes",
"blocks_creations",
"pattern",
"required_approving_review_count",
"required_status_check_contexts",
... | RefUpdateRule |
python | ray-project__ray | python/ray/data/aggregate.py | {
"start": 42380,
"end": 45474
} | class ____(AggregateFnV2[List[int], float]):
"""Calculates the percentage of null values in a column.
This aggregation computes the percentage of null (missing) values in a dataset column.
It treats both None values and NaN values as null. The result is a percentage value
between 0.0 and 100.0, where 0... | MissingValuePercentage |
python | tensorflow__tensorflow | tensorflow/python/ops/parallel_for/pfor.py | {
"start": 9195,
"end": 34226
} | class ____:
"""Object for storing state for converting the outputs of a while_loop."""
def __init__(
self,
exit_node: tensor_lib.Tensor,
pfor_ops: List[ops.Operation],
fallback_to_while_loop: bool,
pfor_config: "PForConfig",
):
"""Initializer.
Args:
exit_node: A tenso... | WhileOp |
python | getsentry__sentry | src/sentry/taskworker/client/processing_result.py | {
"start": 121,
"end": 308
} | class ____:
"""Result structure from child processess to parent"""
task_id: str
status: TaskActivationStatus.ValueType
host: str
receive_timestamp: float
| ProcessingResult |
python | apache__airflow | providers/google/src/airflow/providers/google/cloud/links/mlengine.py | {
"start": 1705,
"end": 1921
} | class ____(BaseGoogleLink):
"""Helper class for constructing ML Engine link."""
name = "MLEngine Models List"
key = "ml_engine_models_list"
format_str = MLENGINE_MODELS_LIST_LINK
| MLEngineModelsListLink |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.