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 | spyder-ide__spyder | external-deps/python-lsp-server/pylsp/python_lsp.py | {
"start": 5855,
"end": 36500
} | class ____(MethodDispatcher):
"""Implementation of the Microsoft VSCode Language Server Protocol
https://github.com/Microsoft/language-server-protocol/blob/master/versions/protocol-1-x.md
"""
def __init__(
self, rx, tx, check_parent_process=False, consumer=None, *, endpoint_cls=None
) -> No... | PythonLSPServer |
python | tensorflow__tensorflow | tensorflow/python/autograph/converters/lists_test.py | {
"start": 1278,
"end": 3095
} | class ____(converter_testing.TestCase):
def test_empty_list(self):
def f():
return []
tr = self.transform(f, lists)
tl = tr()
# Empty tensor lists cannot be evaluated or stacked.
self.assertIsInstance(tl, tensor.Tensor)
self.assertEqual(tl.dtype, dtypes.variant)
def test_initializ... | ListTest |
python | facebook__pyre-check | client/commands/tests/language_server_test.py | {
"start": 52570,
"end": 55183
} | class ____(ApiTestCase):
@setup.async_test
async def test_save_adds_path_to_queue(self) -> None:
test_path = Path("/root/test.py")
api = server_setup.create_pyre_language_server_api(
output_channel=connections.create_memory_text_writer(),
server_state=state.ServerState(
... | SaveAndOpenTest |
python | doocs__leetcode | solution/0800-0899/0865.Smallest Subtree with all the Deepest Nodes/Solution.py | {
"start": 192,
"end": 676
} | class ____:
def subtreeWithAllDeepest(self, root: Optional[TreeNode]) -> Optional[TreeNode]:
def dfs(root: Optional[TreeNode]) -> Tuple[Optional[TreeNode], int]:
if root is None:
return None, 0
l, ld = dfs(root.left)
r, rd = dfs(root.right)
if ... | Solution |
python | huggingface__transformers | tests/models/dpr/test_modeling_dpr.py | {
"start": 9059,
"end": 11522
} | class ____(unittest.TestCase):
@slow
def test_inference_no_head(self):
model = DPRQuestionEncoder.from_pretrained("facebook/dpr-question_encoder-single-nq-base", return_dict=False)
model.to(torch_device)
input_ids = torch.tensor(
[[101, 7592, 1010, 2003, 2026, 3899, 10140, 1... | DPRModelIntegrationTest |
python | huggingface__transformers | tests/models/jetmoe/test_modeling_jetmoe.py | {
"start": 3768,
"end": 6723
} | class ____(unittest.TestCase):
def setUp(self):
cleanup(torch_device, gc_collect=True)
def tearDown(self):
cleanup(torch_device, gc_collect=True)
@slow
def test_model_8b_logits(self):
input_ids = [1, 306, 4658, 278, 6593, 310, 2834, 338]
model = JetMoeForCausalLM.from_p... | JetMoeIntegrationTest |
python | pypa__pipenv | pipenv/patched/pip/_internal/models/pylock.py | {
"start": 923,
"end": 1122
} | class ____:
type: str
url: Optional[str]
# (not supported) path: Optional[str]
requested_revision: Optional[str]
commit_id: str
subdirectory: Optional[str]
@dataclass
| PackageVcs |
python | great-expectations__great_expectations | tests/actions/test_core_actions.py | {
"start": 37993,
"end": 41235
} | class ____:
@pytest.mark.unit
@pytest.mark.parametrize(
"success, notify_on, expected",
[
pytest.param(True, "all", True, id="all_success"),
pytest.param(False, "all", True, id="all_failure"),
],
)
def test_all_always_true(self, success: bool, notify_on: N... | TestShouldNotify |
python | huggingface__transformers | src/transformers/models/kosmos2/modeling_kosmos2.py | {
"start": 36132,
"end": 39976
} | class ____(GradientCheckpointingLayer):
def __init__(self, config: Kosmos2TextConfig, layer_idx=None):
super().__init__()
self.embed_dim = config.embed_dim
self.self_attn = KosmosTextAttention(
config,
embed_dim=self.embed_dim,
num_heads=config.attention_... | Kosmos2TextBlock |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-shopify/source_shopify/streams/streams.py | {
"start": 9987,
"end": 10103
} | class ____(IncrementalShopifyGraphQlBulkStream):
bulk_query: FulfillmentOrder = FulfillmentOrder
| FulfillmentOrders |
python | getsentry__sentry | src/sentry/apidocs/examples/user_examples.py | {
"start": 51,
"end": 1450
} | class ____:
LIST_ORGANIZATIONS = [
OpenApiExample(
"List your organizations",
value=[
{
"avatar": {"avatarType": "letter_avatar", "avatarUuid": None},
"dateCreated": "2018-11-06T21:19:55.101Z",
"features": [
... | UserExamples |
python | getsentry__sentry | src/sentry/utils/lazy_service_wrapper.py | {
"start": 453,
"end": 882
} | class ____:
__all__: Iterable[str] = ()
def validate(self) -> None:
"""
Validates the settings for this backend (i.e. such as proper connection
info).
Raise ``InvalidConfiguration`` if there is a configuration error.
"""
def setup(self) -> None:
"""
... | Service |
python | automl__auto-sklearn | test/test_pipeline/components/feature_preprocessing/test_random_trees_embedding.py | {
"start": 263,
"end": 1962
} | class ____(unittest.TestCase):
def test_default_configuration(self):
transformation, original = _test_preprocessing(RandomTreesEmbedding)
self.assertEqual(transformation.shape[0], original.shape[0])
self.assertEqual(transformation.shape[1], 218)
self.assertIsInstance(original, np.nda... | RandomTreesEmbeddingComponentTest |
python | kubernetes-client__python | kubernetes/client/models/v1_flow_schema_list.py | {
"start": 383,
"end": 6901
} | 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... | V1FlowSchemaList |
python | bokeh__bokeh | src/bokeh/document/events.py | {
"start": 4116,
"end": 4218
} | class ____:
def _document_changed(self, event: DocumentChangedEvent) -> None: ...
| DocumentChangedMixin |
python | cookiecutter__cookiecutter | cookiecutter/exceptions.py | {
"start": 942,
"end": 1194
} | class ____(CookiecutterException):
"""
Exception for missing generated project directory.
Raised during cleanup when remove_repo() can't find a generated project
directory inside of a repo.
"""
# unused locally
| MissingProjectDir |
python | jina-ai__jina | tests/unit/orchestrate/flow/flow-construct/test_flow.py | {
"start": 12481,
"end": 12913
} | class ____(BaseExecutor):
pass
def test_flow_add_class():
f = Flow().add(uses=BaseExecutor).add(uses=CustomizedExecutor)
with f:
pass
@pytest.mark.slow
def test_flow_allinone_yaml():
f = Flow.load_config(os.path.join(cur_dir, 'yaml/flow-allinone.yml'))
with f:
pass
f = Flow... | CustomizedExecutor |
python | modin-project__modin | modin/tests/core/storage_formats/pandas/test_internals.py | {
"start": 85526,
"end": 107125
} | class ____:
"""
Test cases that shouldn't trigger dtypes computation during their execution.
"""
@pytest.mark.parametrize("self_dtype", ["materialized", "partial", "unknown"])
@pytest.mark.parametrize(
"value, value_dtype",
[
[3.5, np.dtype(float)],
[[3.5, 2.... | TestZeroComputationDtypes |
python | bokeh__bokeh | src/bokeh/models/annotations/legends.py | {
"start": 7776,
"end": 9061
} | class ____(BaseColorBar):
''' Render a color bar based on a color mapper.
See :ref:`ug_basic_annotations_color_bars` for information on plotting color bars.
'''
# explicit __init__ to support Init signatures
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **k... | ColorBar |
python | getsentry__sentry | tests/sentry/utils/test_safe.py | {
"start": 1899,
"end": 2783
} | class ____(TestCase):
def test_with_nameless_function(self) -> None:
assert safe_execute(lambda a: a, 1) == 1
assert safe_execute(lambda: eval("a")) is None
def test_with_simple_function(self) -> None:
def simple(a):
return a
assert safe_execute(simple, 1) == 1
... | SafeExecuteTest |
python | huggingface__transformers | src/transformers/convert_slow_tokenizer.py | {
"start": 41740,
"end": 43309
} | class ____(Converter):
def converted(self) -> Tokenizer:
vocab = self.original_tokenizer.encoder
merges = list(self.original_tokenizer.bpe_ranks.keys())
unk_token = self.original_tokenizer.unk_token
tokenizer = Tokenizer(
BPE(
vocab=vocab,
... | CLIPConverter |
python | getsentry__sentry | src/sentry/snuba/tasks.py | {
"start": 1191,
"end": 14022
} | class ____(Exception):
pass
@instrumented_task(
name="sentry.snuba.tasks.create_subscription_in_snuba",
namespace=alerts_tasks,
retry=Retry(times=5, delay=5),
)
def create_subscription_in_snuba(query_subscription_id, **kwargs):
"""
Task to create a corresponding subscription in Snuba from a `Q... | SubscriptionError |
python | ApeWorX__ape | tests/functional/conftest.py | {
"start": 11658,
"end": 24716
} | class ____(threading.Thread):
def __init__(self, name, poller, handler, stop_condition, *args, **kwargs):
kwargs_dict = dict(**kwargs)
kwargs_dict["name"] = f"ape_poll_{name}"
super().__init__(*args, **kwargs_dict)
self._poller = poller
self._handler = handler
self._d... | PollDaemonThread |
python | getlogbook__logbook | src/logbook/queues.py | {
"start": 19460,
"end": 20897
} | class ____:
"""A very basic thread controller that pulls things in from a
queue and sends it to a handler. Both queue and handler are
taken from the passed :class:`ThreadedWrapperHandler`.
"""
class Command:
stop = object()
emit = object()
emit_batch = object()
def __i... | TWHThreadController |
python | wandb__wandb | wandb/integration/keras/keras.py | {
"start": 8442,
"end": 9074
} | class ____(tf.keras.callbacks.Callback):
"""Accumulates gradients during a fit() call when used in conjunction with the CustomOptimizer above."""
def set_model(self, model):
super().set_model(model)
self.og_weights = model.get_weights()
self.grads = [np.zeros(tuple(w.shape)) for w in mo... | _GradAccumulatorCallback |
python | getsentry__sentry | src/sentry/codecov/endpoints/repositories/serializers.py | {
"start": 189,
"end": 505
} | class ____(serializers.Serializer):
"""
Serializer for individual repository nodes from GraphQL response
"""
name = serializers.CharField()
updatedAt = serializers.DateTimeField()
latestCommitAt = serializers.DateTimeField()
defaultBranch = serializers.CharField()
| RepositoryNodeSerializer |
python | weaviate__weaviate-python-client | weaviate/proto/v1/v52/v1/file_replication_pb2_grpc.py | {
"start": 6770,
"end": 11207
} | class ____(object):
"""Missing associated documentation comment in .proto file."""
@staticmethod
def PauseFileActivity(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
... | FileReplicationService |
python | django__django | tests/model_options/models/default_related_name.py | {
"start": 160,
"end": 301
} | class ____(models.Model):
name = models.CharField(max_length=128)
bestselling_author = models.ForeignKey(Author, models.CASCADE)
| Editor |
python | rapidsai__cudf | python/cudf_polars/cudf_polars/dsl/ir.py | {
"start": 7678,
"end": 8011
} | class ____(IR):
"""Represents an error translating the IR."""
__slots__ = ("error",)
_non_child = (
"schema",
"error",
)
error: str
"""The error."""
def __init__(self, schema: Schema, error: str):
self.schema = schema
self.error = error
self.children... | ErrorNode |
python | numpy__numpy | numpy/_core/_exceptions.py | {
"start": 1446,
"end": 1871
} | class ____(_UFuncNoLoopError):
""" Thrown when a binary resolution fails """
def __init__(self, ufunc, dtypes):
super().__init__(ufunc, dtypes)
assert len(self.dtypes) == 2
def __str__(self):
return (
"ufunc {!r} cannot use operands with types {!r} and {!r}"
).fo... | _UFuncBinaryResolutionError |
python | readthedocs__readthedocs.org | readthedocs/core/management/commands/collectstatic.py | {
"start": 336,
"end": 585
} | class ____(collectstatic.Command):
def handle(self, **options):
pre_collectstatic.send(sender=self.__class__)
response = super().handle(**options)
post_collectstatic.send(sender=self.__class__)
return response
| Command |
python | apache__airflow | providers/mongo/src/airflow/providers/mongo/hooks/mongo.py | {
"start": 1449,
"end": 20558
} | class ____(BaseHook):
"""
PyMongo wrapper to interact with MongoDB.
Mongo Connection Documentation
https://docs.mongodb.com/manual/reference/connection-string/index.html
You can specify connection string options in extra field of your connection
https://docs.mongodb.com/manual/reference/connect... | MongoHook |
python | qdrant__qdrant-client | qdrant_client/http/models/models.py | {
"start": 129589,
"end": 129775
} | class ____(str, Enum):
"""
Immutable RAM sparse index
"""
def __str__(self) -> str:
return str(self.value)
IMMUTABLERAM = "ImmutableRam"
| SparseIndexTypeOneOf1 |
python | python-excel__xlwt | xlwt/BIFFRecords.py | {
"start": 59843,
"end": 60563
} | class ____(BiffRecord):
"""
This record represents a cell range of empty cells. All cells are
located in the same row.
Record MULBLANK, BIFF5-BIFF8:
Offset Size Contents
0 2 Index to row
2 2 Index to first column (fc)
4 2*nc List of nc=lc-fc+1... | MulBlankRecord |
python | pypa__hatch | tests/backend/builders/test_sdist.py | {
"start": 4104,
"end": 21685
} | class ____:
def test_default(self, helpers, isolation):
config = {"project": {"name": "My.App", "version": "0.1.0"}}
builder = SdistBuilder(str(isolation), config=config)
assert builder.construct_setup_py_file([]) == helpers.dedent(
"""
from setuptools import setup
... | TestConstructSetupPyFile |
python | keras-team__keras | keras/src/ops/numpy.py | {
"start": 62436,
"end": 64457
} | class ____(Operation):
def __init__(self, axis=0, *, name=None):
super().__init__(name=name)
if axis is None:
raise ValueError("`axis` cannot be None for `concatenate`.")
self.axis = axis
def call(self, xs):
return backend.numpy.concatenate(xs, axis=self.axis)
d... | Concatenate |
python | apache__airflow | providers/google/tests/unit/google/cloud/operators/test_datastore.py | {
"start": 6957,
"end": 7411
} | class ____:
@mock.patch(HOOK_PATH)
def test_execute(self, mock_hook):
op = CloudDatastoreRunQueryOperator(
task_id="test_task", gcp_conn_id=CONN_ID, project_id=PROJECT_ID, body=BODY
)
op.execute({})
mock_hook.assert_called_once_with(gcp_conn_id=CONN_ID, impersonation... | TestCloudDatastoreRunQuery |
python | pytorch__pytorch | torch/_inductor/bounds.py | {
"start": 6114,
"end": 9717
} | class ____(SymPyValueRangeAnalysis, DefaultHandler):
def __init__(self) -> None:
self.name = "ValueRangeAnalysis"
boolean_operators = (
"xor",
"logical_and",
"logical_or",
"logical_not",
)
for op in boolean_operators:
setatt... | ValueRangeAnalysis |
python | dagster-io__dagster | python_modules/libraries/dagster-azure/dagster_azure/fakes/fake_adls2_resource.py | {
"start": 6142,
"end": 6421
} | class ____:
"""Mock of an ADLS2 file downloader for testing."""
def __init__(self, contents):
self.contents = contents
def readall(self):
return self.contents
def readinto(self, fileobj):
fileobj.write(self.contents)
| FakeADLS2FileDownloader |
python | huggingface__transformers | src/transformers/models/oneformer/modeling_oneformer.py | {
"start": 36091,
"end": 37157
} | class ____(ModelOutput):
r"""
encoder_features (List of `(torch.FloatTensor)`):
List of `torch.FloatTensor` of shape `(batch_size, num_channels, height, width)`. Hidden-states (also
called feature maps) of the model at the output of each stage.
decoder_features (List of `(torch.FloatTensor)`... | OneFormerPixelLevelModuleOutput |
python | getsentry__sentry | src/sentry/rules/processing/delayed_processing.py | {
"start": 2733,
"end": 4700
} | class ____(NamedTuple):
data: EventFrequencyConditionData
group_ids: set[int]
rule_id: int | None = None
def __repr__(self) -> str:
return (
f"<DataAndGroups data: {self.data} group_ids: {self.group_ids} rule_id: {self.rule_id}>"
)
def fetch_project(project_id: int) -> Pro... | DataAndGroups |
python | python-attrs__attrs | tests/test_validators.py | {
"start": 22320,
"end": 24172
} | class ____:
"""
Tests for `is_callable`.
"""
def test_in_all(self):
"""
Verify that this validator is in ``__all__``.
"""
assert is_callable.__name__ in validator_module.__all__
def test_success(self):
"""
If the value is callable, nothing happens.
... | TestIsCallable |
python | spack__spack | var/spack/test_repos/spack_repo/builtin_mock/packages/gcc/package.py | {
"start": 307,
"end": 4963
} | class ____(CompilerPackage, Package):
"""Simple compiler package."""
homepage = "http://www.example.com"
url = "http://www.example.com/gcc-1.0.tar.gz"
version("14.0", md5="abcdef0123456789abcdef0123456789")
version("3.0", md5="def0123456789abcdef0123456789abc")
version("2.0", md5="abcdef012345... | Gcc |
python | falconry__falcon | falcon/request.py | {
"start": 87019,
"end": 92401
} | class ____:
"""Defines a set of configurable request options.
An instance of this class is exposed via :attr:`falcon.App.req_options` and
:attr:`falcon.asgi.App.req_options` for configuring certain
:class:`~.Request` and :class:`falcon.asgi.Request` behaviors,
respectively.
"""
keep_blank_... | RequestOptions |
python | pennersr__django-allauth | allauth/socialaccount/providers/google/views.py | {
"start": 3961,
"end": 5521
} | class ____(View):
@method_decorator(login_not_required)
def dispatch(self, request):
self.adapter = get_adapter()
self.provider = self.adapter.get_provider(
request, GoogleOAuth2Adapter.provider_id
)
try:
return super().dispatch(request)
except (
... | LoginByTokenView |
python | sqlalchemy__sqlalchemy | lib/sqlalchemy/dialects/mssql/pyodbc.py | {
"start": 19159,
"end": 19219
} | class ____(_ms_binary_pyodbc, BINARY):
pass
| _BINARY_pyodbc |
python | dagster-io__dagster | python_modules/dagster/dagster/_core/definitions/multi_asset_sensor_definition.py | {
"start": 7310,
"end": 38457
} | class ____(SensorEvaluationContext):
"""The context object available as the argument to the evaluation function of a
:py:class:`dagster.MultiAssetSensorDefinition`.
Users should not instantiate this object directly. To construct a
`MultiAssetSensorEvaluationContext` for testing purposes, use :py:func:`... | MultiAssetSensorEvaluationContext |
python | django-extensions__django-extensions | tests/testapp/apps.py | {
"start": 36,
"end": 95
} | class ____(AppConfig):
name = "tests.testapp"
| TestAppConfig |
python | cython__cython | Cython/Debugger/libpython.py | {
"start": 49612,
"end": 57789
} | class ____:
'''
Wrapper for gdb.Frame, adding various methods
'''
def __init__(self, gdbframe):
self._gdbframe = gdbframe
def older(self):
older = self._gdbframe.older()
if older:
return Frame(older)
else:
return None
def newer(self):
... | Frame |
python | run-llama__llama_index | llama-index-integrations/vector_stores/llama-index-vector-stores-azurecosmosnosql/tests/test_azurecosmosnosql.py | {
"start": 2972,
"end": 7443
} | class ____:
@classmethod
def setup_class(cls) -> None:
# insure the test container is empty
items_list = test_container.read_all_items()
first_item = next(iter(items_list), None) # type: ignore[index]
assert first_item is None
@classmethod
def teardown_class(cls) -> Non... | TestAzureCosmosNoSqlVectorSearch |
python | tensorflow__tensorflow | tensorflow/python/kernel_tests/check_ops_test.py | {
"start": 65155,
"end": 76542
} | class ____(test.TestCase):
@test_util.run_in_graph_and_eager_modes
def test_raise_static_shape_mismatch(self):
x = array_ops.ones([3, 2], name="x")
y = array_ops.ones([2, 3], name="y")
shapes = [
(x, ("N", "Q")),
(y, ("N", "D")),
]
regex = (r"Specified by tensor .* dimension 0. ... | AssertShapesTest |
python | openai__openai-python | src/openai/resources/beta/chatkit/threads.py | {
"start": 9444,
"end": 17971
} | class ____(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncThreadsWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.gi... | AsyncThreads |
python | huggingface__transformers | src/transformers/models/edgetam_video/modular_edgetam_video.py | {
"start": 31303,
"end": 31375
} | class ____(Sam2VideoPreTrainedModel):
pass
| EdgeTamVideoPreTrainedModel |
python | modin-project__modin | modin/config/envvars.py | {
"start": 24168,
"end": 25201
} | class ____(EnvironmentVariable, type=dict):
"""
Ray node's custom resources to request them in tasks or actors.
Visit Ray documentation for more details:
https://docs.ray.io/en/latest/ray-core/scheduling/resources.html#custom-resources
Notes
-----
You can use this config to limit the paral... | RayTaskCustomResources |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-amazon-seller-partner/components.py | {
"start": 9941,
"end": 10787
} | class ____(TypeTransformer):
def __init__(self, *args, **kwargs):
config = TransformConfig.DefaultSchemaNormalization | TransformConfig.CustomSchemaNormalization
super().__init__(config)
self.registerCustomTransform(self.get_transform_function())
@staticmethod
def get_transform_func... | MerchantReportsTypeTransformer |
python | readthedocs__readthedocs.org | readthedocs/builds/admin.py | {
"start": 3749,
"end": 4007
} | class ____(PolymorphicChildModelAdmin, admin.ModelAdmin):
raw_id_fields = ("project",)
readonly_fields = (
"created",
"modified",
)
base_model = RegexAutomationRule
@admin.register(VersionAutomationRule)
| RegexAutomationRuleAdmin |
python | ZoranPandovski__al-go-rithms | data_structures/binarySearch_tree/Python/binary-tree.py | {
"start": 434,
"end": 2900
} | class ____:
def __init__(self):
self.root = None
self.size = 0
def _addNode(self, current, value):
if value < current.key:
if current.left != None:
self._addNode(current.left, value)
else:
current.left = Node(value, parent=current)... | Tree |
python | pandas-dev__pandas | asv_bench/benchmarks/strings.py | {
"start": 4217,
"end": 4596
} | class ____:
params = ["int", "array"]
param_names = ["repeats"]
def setup(self, repeats):
N = 10**5
self.s = Series(Index([f"i-{i}" for i in range(N)], dtype=object))
repeat = {"int": 1, "array": np.random.randint(1, 3, N)}
self.values = repeat[repeats]
def time_repeat(... | Repeat |
python | django__django | tests/custom_pk/models.py | {
"start": 901,
"end": 977
} | class ____(models.Model):
bar = models.ForeignKey(Bar, models.CASCADE)
| Foo |
python | huggingface__transformers | src/transformers/models/metaclip_2/configuration_metaclip_2.py | {
"start": 5784,
"end": 10160
} | class ____(PreTrainedConfig):
r"""
This is the configuration class to store the configuration of a [`MetaClip2VisionModel`]. It is used to instantiate a MetaClip2
vision encoder according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yi... | MetaClip2VisionConfig |
python | apache__airflow | airflow-core/src/airflow/models/trigger.py | {
"start": 2182,
"end": 2398
} | class ____(str, Enum):
"""
Reasons for trigger failures.
Internal use only.
:meta private:
"""
TRIGGER_TIMEOUT = "Trigger timeout"
TRIGGER_FAILURE = "Trigger failure"
| TriggerFailureReason |
python | ray-project__ray | python/ray/serve/tests/test_runtime_env_2.py | {
"start": 511,
"end": 1055
} | class ____:
def __call__(self, *args):
return open("hello").read()
handle = serve.run(Test.bind())
assert handle.remote().result() == "world"
"""
run_string_as_driver(driver1)
with open("hello", "w") as f:
f.write("world2")
driver2 = """
import ray
from ray import serve
from ray.serv... | Test |
python | sqlalchemy__sqlalchemy | lib/sqlalchemy/orm/descriptor_props.py | {
"start": 40846,
"end": 41299
} | class ____(SynonymProperty[_T], _DeclarativeMapped[_T]):
"""Declarative front-end for the :class:`.SynonymProperty` class.
Public constructor is the :func:`_orm.synonym` function.
.. versionchanged:: 2.0 Added :class:`_orm.Synonym` as a Declarative
compatible subclass for :class:`_orm.SynonymProper... | Synonym |
python | Textualize__textual | src/textual/errors.py | {
"start": 300,
"end": 534
} | class ____(TextualError):
"""More than one handler for a single key press.
For example, if the handlers `key_ctrl_i` and `key_tab` were defined on the same
widget, then this error would be raised.
"""
| DuplicateKeyHandlers |
python | scipy__scipy | scipy/stats/tests/test_distributions.py | {
"start": 182370,
"end": 183458
} | class ____:
def test_nan_raises_error(self):
# see gh-issue 10300
x = np.array([1.6483, 2.7169, 2.4667, 1.1791, 3.5433, np.nan])
assert_raises(ValueError, stats.norm.fit, x)
def test_inf_raises_error(self):
# see gh-issue 10300
x = np.array([1.6483, 2.7169, 2.4667, 1.179... | TestNorm |
python | PrefectHQ__prefect | src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py | {
"start": 89892,
"end": 90506
} | class ____(sgqlc.types.Input):
"""
See source code for more info.
"""
__schema__ = graphql_schema
__field_names__ = ("team_id", "title", "body", "private", "client_mutation_id")
team_id = sgqlc.types.Field(sgqlc.types.non_null(ID), graphql_name="teamId")
title = sgqlc.types.Field(sgqlc.type... | CreateTeamDiscussionInput |
python | great-expectations__great_expectations | great_expectations/expectations/core/expect_column_value_lengths_to_be_between.py | {
"start": 2786,
"end": 19611
} | class ____(ColumnMapExpectation):
__doc__ = f"""{EXPECTATION_SHORT_DESCRIPTION}
This expectation only works for string-type values. Invoking it on ints or floats will raise a TypeError.
ExpectColumnValueLengthsToBeBetween is a \
Column Map Expectation.
Column Map Expectations are one of the most ... | ExpectColumnValueLengthsToBeBetween |
python | tensorflow__tensorflow | tensorflow/python/framework/test_combinations.py | {
"start": 6817,
"end": 15772
} | class ____(ParameterModifier):
"""A parameter that is optional in `combine()` and in the test signature.
`OptionalParameter` is usually used with `TestCombination` in the
`parameter_modifiers()`. It allows `TestCombination` to skip certain
parameters when passing them to `combine()`, since the `TestCombination... | OptionalParameter |
python | spack__spack | lib/spack/spack/report.py | {
"start": 923,
"end": 2665
} | class ____(Record):
"""Data class for recording outcomes for an entire DAG
Each BuildRequest in the installer and each root spec in a TestSuite generates a
RequestRecord. The ``packages`` list of the RequestRecord is a list of SpecRecord
objects recording individual data for each node in the Spec repre... | RequestRecord |
python | tensorflow__tensorflow | tensorflow/python/compiler/tensorrt/model_tests/model_handler.py | {
"start": 14722,
"end": 17044
} | class ____(_ModelHandlerBase):
"""Base class for converting and running a model."""
def __init__(
self,
model_config: ModelConfig,
trt_convert_params: trt.TrtConversionParams,
):
super(_TrtModelHandlerBase, self).__init__(model_config)
self._trt_convert_params = trt_convert_params
... | _TrtModelHandlerBase |
python | numpy__numpy | numpy/_core/arrayprint.py | {
"start": 34617,
"end": 49226
} | class ____:
""" Formatter for subtypes of np.floating """
def __init__(self, data, precision, floatmode, suppress_small, sign=False,
*, legacy=None):
# for backcompatibility, accept bools
if isinstance(sign, bool):
sign = '+' if sign else '-'
self._legacy = ... | FloatingFormat |
python | kamyu104__LeetCode-Solutions | Python/possible-bipartition.py | {
"start": 66,
"end": 786
} | class ____(object):
def possibleBipartition(self, N, dislikes):
"""
:type N: int
:type dislikes: List[List[int]]
:rtype: bool
"""
adj = [[] for _ in xrange(N)]
for u, v in dislikes:
adj[u-1].append(v-1)
adj[v-1].append(u-1)
col... | Solution |
python | Textualize__textual | tests/snapshot_tests/snapshot_apps/command_palette.py | {
"start": 520,
"end": 714
} | class ____(App[None]):
COMMANDS = {TestSource}
def on_mount(self) -> None:
self.action_command_palette()
if __name__ == "__main__":
CommandPaletteApp().run()
| CommandPaletteApp |
python | sympy__sympy | sympy/logic/boolalg.py | {
"start": 30149,
"end": 34885
} | class ____(BooleanFunction):
"""
Logical XOR (exclusive OR) function.
Returns True if an odd number of the arguments are True and the rest are
False.
Returns False if an even number of the arguments are True and the rest are
False.
Examples
========
>>> from sympy.logic.boolalg ... | Xor |
python | pypa__pipenv | pipenv/vendor/plette/models/sections.py | {
"start": 178,
"end": 248
} | class ____(DataModelMapping):
item_class = Package
| PackageCollection |
python | ray-project__ray | python/ray/autoscaler/v2/schema.py | {
"start": 4807,
"end": 5601
} | class ____:
# How long it took to get the GCS request.
# This is required when initializing the Stats since it should be calculated before
# the request was made.
gcs_request_time_s: float
# How long it took to get all live instances from node provider.
none_terminated_node_request_time_s: Optio... | Stats |
python | allegroai__clearml | clearml/backend_api/services/v2_20/projects.py | {
"start": 138405,
"end": 139543
} | class ____(Request):
"""
Convert company projects to public
:param ids: Ids of the projects to convert
:type ids: Sequence[str]
"""
_service = "projects"
_action = "make_public"
_version = "2.20"
_schema = {
"definitions": {},
"properties": {
"ids": {
... | MakePublicRequest |
python | pytorch__pytorch | torch/_dispatch/python.py | {
"start": 3391,
"end": 6750
} | class ____:
def __init__(self, s):
self.s = s
def __repr__(self):
return self.s
def _fmt(a: object) -> object:
if isinstance(a, torch.Tensor):
return Lit(
f"torch.empty_strided({tuple(a.size())}, {a.stride()}, dtype={a.dtype})"
)
else:
return a
de... | Lit |
python | run-llama__llama_index | llama-index-core/llama_index/core/query_engine/retriever_query_engine.py | {
"start": 1006,
"end": 8862
} | class ____(BaseQueryEngine):
"""
Retriever query engine.
Args:
retriever (BaseRetriever): A retriever object.
response_synthesizer (Optional[BaseSynthesizer]): A BaseSynthesizer
object.
callback_manager (Optional[CallbackManager]): A callback manager.
"""
def _... | RetrieverQueryEngine |
python | scipy__scipy | scipy/special/tests/test_basic.py | {
"start": 47879,
"end": 55807
} | class ____:
"""
Tests for betainc, betaincinv, betaincc, betainccinv.
"""
def test_a1_b1(self):
# betainc(1, 1, x) is x.
x = np.array([0, 0.25, 1])
assert_equal(special.betainc(1, 1, x), x)
assert_equal(special.betaincinv(1, 1, x), x)
assert_equal(special.betainc... | TestBetaInc |
python | getsentry__sentry | src/sentry/api/endpoints/user_subscriptions.py | {
"start": 553,
"end": 829
} | class ____(serializers.Serializer):
listId = serializers.IntegerField(required=True)
subscribed = serializers.BooleanField(required=True)
from rest_framework.request import Request
from rest_framework.response import Response
@control_silo_endpoint
| NewsletterValidator |
python | ansible__ansible | test/lib/ansible_test/_internal/target.py | {
"start": 14614,
"end": 15524
} | class ____(metaclass=abc.ABCMeta):
"""Command-line argument completion target base class."""
def __init__(self) -> None:
self.name = ''
self.path = ''
self.base_path: t.Optional[str] = None
self.modules: tuple[str, ...] = tuple()
self.aliases: tuple[str, ...] = tuple()
... | CompletionTarget |
python | getsentry__sentry | src/sentry/sentry_metrics/consumers/indexer/multiprocess.py | {
"start": 686,
"end": 5340
} | class ____(ProcessingStep[KafkaPayload]):
def __init__(
self,
output_topic: Topic,
commit_function: Commit,
producer: AbstractProducer[KafkaPayload] | None = None,
) -> None:
snuba_metrics = kafka_config.get_topic_definition(output_topic)
producer_config = kafka_c... | SimpleProduceStep |
python | huggingface__transformers | src/transformers/models/instructblipvideo/modular_instructblipvideo.py | {
"start": 1540,
"end": 1616
} | class ____(InstructBlipQFormerConfig):
pass
| InstructBlipVideoQFormerConfig |
python | PrefectHQ__prefect | src/prefect/_versioning.py | {
"start": 1269,
"end": 1474
} | class ____(VersionInfo):
type: Literal["vcs:azuredevops"] = "vcs:azuredevops"
version: str
commit_sha: str
message: str
branch: str
repository: str
url: str
| AzureDevopsVersionInfo |
python | nedbat__coveragepy | tests/test_arcs.py | {
"start": 508,
"end": 5473
} | class ____(CoverageTest):
"""Tests for coverage.py's arc measurement."""
def test_simple_sequence(self) -> None:
self.check_coverage(
"""\
a = 1
b = 2
""",
branchz="",
)
self.check_coverage(
"""\
a = 1
... | SimpleArcTest |
python | django__django | tests/migrations/test_migrations_squashed_extra/0002_second.py | {
"start": 35,
"end": 126
} | class ____(migrations.Migration):
dependencies = [("migrations", "0001_initial")]
| Migration |
python | jmcnamara__XlsxWriter | xlsxwriter/test/comparison/test_chart_layout07.py | {
"start": 315,
"end": 1643
} | class ____(ExcelComparisonTest):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.set_filename("chart_layout07.xlsx")
def test_create_file(self):
"""Test the creation of an XlsxWriter file with user defined layout."""
workbook... | TestCompareXLSXFiles |
python | huggingface__transformers | src/transformers/models/donut/processing_donut.py | {
"start": 897,
"end": 1017
} | class ____(ProcessingKwargs, total=False):
_defaults = {}
logger = logging.get_logger(__name__)
| DonutProcessorKwargs |
python | celery__celery | celery/backends/arangodb.py | {
"start": 501,
"end": 5937
} | class ____(KeyValueStoreBackend):
"""ArangoDb backend.
Sample url
"arangodb://username:password@host:port/database/collection"
*arangodb_backend_settings* is where the settings are present
(in the app.conf)
Settings should contain the host, port, username, password, database name,
collectio... | ArangoDbBackend |
python | pypa__setuptools | setuptools/_vendor/jaraco/collections/__init__.py | {
"start": 23641,
"end": 24086
} | class ____:
"""
A value that is always lesser than any other
>>> least = Least()
>>> 3 < least
False
>>> 3 > least
True
>>> least < 3
True
>>> least <= 3
True
>>> least > 3
False
>>> 'x' > least
True
>>> None > least
True
"""
def __le__(self,... | Least |
python | pyca__cryptography | tests/hazmat/primitives/test_hmac.py | {
"start": 639,
"end": 730
} | class ____:
test_copy = generate_base_hmac_test(
hashes.MD5(),
)
| TestHMACCopy |
python | altair-viz__altair | altair/vegalite/v6/schema/_config.py | {
"start": 134876,
"end": 155065
} | class ____(TypedDict, total=False):
"""
:class:`altair.LineConfig` ``TypedDict`` wrapper.
Parameters
----------
align
The horizontal alignment of the text or ranged marks (area, bar, image, rect, rule).
One of ``"left"``, ``"right"``, ``"center"``.
**Note:** Expression refe... | LineConfigKwds |
python | allegroai__clearml | clearml/backend_api/services/v2_20/events.py | {
"start": 50173,
"end": 50407
} | class ____(Response):
"""
Response of events.add endpoint.
"""
_service = "events"
_action = "add"
_version = "2.20"
_schema = {"additionalProperties": True, "definitions": {}, "type": "object"}
| AddResponse |
python | PyCQA__pylint | doc/data/messages/s/super-with-arguments/bad.py | {
"start": 24,
"end": 134
} | class ____(Fruit):
def __init__(self):
super(Orange, self).__init__() # [super-with-arguments]
| Orange |
python | pytest-dev__pytest-rerunfailures | src/pytest_rerunfailures.py | {
"start": 12584,
"end": 13702
} | class ____:
def __init__(self):
self.delim = b"\n"
self.hmap = {}
def _hash(self, crashitem: str) -> str:
if crashitem not in self.hmap:
self.hmap[crashitem] = hashlib.sha1(crashitem.encode()).hexdigest()[:10] # noqa: S324
return self.hmap[crashitem]
def add_t... | StatusDB |
python | ray-project__ray | rllib/examples/offline_rl/classes/image_offline_data.py | {
"start": 395,
"end": 2756
} | class ____(OfflineData):
"""This class overrides `OfflineData` to read in raw image data.
The image data is from Ray Data`s S3 example bucket, namely
`ray-example-data/batoidea/JPEGImages/`.
To read in this data the raw bytes have to be decoded and then
converted to `numpy` arrays. Each image array... | ImageOfflineData |
python | matplotlib__matplotlib | lib/matplotlib/legend_handler.py | {
"start": 22961,
"end": 26359
} | class ____(HandlerNpointsYoffsets):
"""
Handler for plots produced by `~.Axes.stem`.
"""
def __init__(self, marker_pad=0.3, numpoints=None,
bottom=None, yoffsets=None, **kwargs):
"""
Parameters
----------
marker_pad : float, default: 0.3
Padd... | HandlerStem |
python | huggingface__transformers | src/transformers/models/qwen2_5_omni/modular_qwen2_5_omni.py | {
"start": 115462,
"end": 115861
} | class ____(Qwen2_5_VLTextModel):
config: Qwen2_5OmniTalkerConfig
input_modalities = ("image", "video", "audio", "text")
_no_split_modules = ["Qwen2_5OmniTalkerDecoderLayer"]
def __init__(self, config: Qwen2_5OmniTalkerConfig):
super().__init__(config)
self.embed_tokens = nn.Embedding(c... | Qwen2_5OmniTalkerModel |
python | apache__airflow | task-sdk/tests/task_sdk/io/test_path.py | {
"start": 2516,
"end": 3169
} | class ____(MemoryFileSystem):
protocol = ("s3", "fakefs", "ffs", "ffs2")
root_marker = ""
store: ClassVar[dict[str, Any]] = {}
pseudo_dirs = [""]
def __init__(self, *args, **kwargs):
self.conn_id = kwargs.pop("conn_id", None)
super().__init__(*args, **kwargs)
@classmethod
d... | _FakeRemoteFileSystem |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.