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 | huggingface__transformers | src/transformers/models/blip/image_processing_blip.py | {
"start": 1367,
"end": 15069
} | class ____(BaseImageProcessor):
r"""
Constructs a BLIP image processor.
Args:
do_resize (`bool`, *optional*, defaults to `True`):
Whether to resize the image's (height, width) dimensions to the specified `size`. Can be overridden by the
`do_resize` parameter in the `preproce... | BlipImageProcessor |
python | astropy__astropy | astropy/io/votable/exceptions.py | {
"start": 28566,
"end": 29048
} | class ____(VOTableSpecWarning):
"""
If the field specifies a ``null`` value, that value must conform
to the given ``datatype``.
**References:** `1.1
<http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#sec:values>`__,
`1.2
<http://www.ivoa.net/documents/VOTable/2009... | W36 |
python | apache__airflow | providers/amazon/src/airflow/providers/amazon/aws/operators/ec2.py | {
"start": 1329,
"end": 3495
} | class ____(AwsBaseOperator[EC2Hook]):
"""
Start AWS EC2 instance using boto3.
.. seealso::
For more information on how to use this operator, take a look at the guide:
:ref:`howto/operator:EC2StartInstanceOperator`
:param instance_id: id of the AWS EC2 instance
:param aws_conn_i... | EC2StartInstanceOperator |
python | encode__django-rest-framework | tests/authentication/models.py | {
"start": 64,
"end": 241
} | class ____(models.Model):
key = models.CharField(max_length=40, primary_key=True)
user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
| CustomToken |
python | matplotlib__matplotlib | lib/matplotlib/image.py | {
"start": 32193,
"end": 39793
} | class ____(_ImageBase):
"""
An image with pixels on a regular grid, attached to an Axes.
Parameters
----------
ax : `~matplotlib.axes.Axes`
The Axes the image will belong to.
cmap : str or `~matplotlib.colors.Colormap`, default: :rc:`image.cmap`
The Colormap instance or register... | AxesImage |
python | apache__airflow | providers/amazon/tests/unit/amazon/aws/waiters/test_glue.py | {
"start": 1701,
"end": 3111
} | class ____(TestGlueDataQualityCustomWaitersBase):
WAITER_NAME = "data_quality_ruleset_evaluation_run_complete"
@pytest.fixture
def mock_get_job(self):
with mock.patch.object(self.client, "get_data_quality_ruleset_evaluation_run") as mock_getter:
yield mock_getter
@pytest.mark.param... | TestGlueDataQualityRuleSetEvaluationRunCompleteWaiter |
python | django__django | django/utils/archive.py | {
"start": 1756,
"end": 2987
} | class ____:
"""
The external API class that encapsulates an archive implementation.
"""
def __init__(self, file):
self._archive = self._archive_cls(file)(file)
@staticmethod
def _archive_cls(file):
cls = None
if isinstance(file, str):
filename = file
... | Archive |
python | ray-project__ray | python/ray/_private/thirdparty/pynvml/pynvml.py | {
"start": 70095,
"end": 70377
} | class ____(_PrintableStructure):
_fields_ = [
('isGridLicenseSupported', c_int),
('licensableFeaturesCount', c_uint),
('gridLicensableFeatures', c_nvmlGridLicensableFeature_v3_t * NVML_GRID_LICENSE_FEATURE_MAX_COUNT),
]
| c_nvmlGridLicensableFeatures_v3_t |
python | sanic-org__sanic | guide/webapp/display/markdown.py | {
"start": 741,
"end": 4494
} | class ____(HTMLRenderer):
def block_code(self, code: str, info: str | None = None):
builder = Builder("Block")
with builder.div(class_="code-block"):
if info:
lexer = get_lexer_by_name(info, stripall=False)
formatter = html.HtmlFormatter(
... | DocsRenderer |
python | patrick-kidger__equinox | equinox/_module/_module.py | {
"start": 1721,
"end": 2629
} | class ____(eqx.Module):
@property
def foo(self):
return self.bar
def bar(self):
...
```
so that you can still use `self.foo`, but it is not stored in the PyTree structure.
This is a check that was introduced in Equinox v0.11.0. Before this, the above error
went uncaught, possibly leading t... | MyModule |
python | numba__numba | numba/cuda/cg.py | {
"start": 275,
"end": 1490
} | class ____:
"""A cooperative group representing the entire grid"""
def sync() -> None:
"""Synchronize this grid group"""
def this_grid() -> GridGroup:
"""Get the current grid group."""
return GridGroup()
@intrinsic
def _this_grid(typingctx):
sig = signature(grid_group)
def codegen(... | GridGroup |
python | getsentry__sentry | src/sentry/replays/lib/http.py | {
"start": 481,
"end": 1217
} | class ____:
"""Bounded range header.
A bounded range header is a pair of integers representing the inclusive range of a
unit in the resource.
"""
def __init__(self, start: int, end: int) -> None:
self.start = start
self.end = end
def make_range(self, last_index: int) -> tuple[... | BoundedRange |
python | pandas-dev__pandas | pandas/tests/frame/indexing/test_get.py | {
"start": 75,
"end": 690
} | class ____:
def test_get(self, float_frame):
b = float_frame.get("B")
tm.assert_series_equal(b, float_frame["B"])
assert float_frame.get("foo") is None
tm.assert_series_equal(
float_frame.get("foo", float_frame["B"]), float_frame["B"]
)
@pytest.mark.parametr... | TestGet |
python | numba__numba | numba/core/typing/builtins.py | {
"start": 31128,
"end": 31724
} | class ____(AbstractTemplate):
def generic(self, args, kws):
assert not kws
it = args[0]
if len(args) > 1 and not isinstance(args[1], types.Integer):
raise errors.NumbaTypeError("Only integers supported as start "
"value in enumerate")
... | Enumerate |
python | django__django | tests/m2m_regress/models.py | {
"start": 1968,
"end": 2171
} | class ____(models.Model):
name = models.CharField(max_length=1)
class Meta:
abstract = True
def split(self):
raise RuntimeError("split should not be called")
| BadModelWithSplit |
python | pyca__cryptography | src/cryptography/hazmat/primitives/serialization/ssh.py | {
"start": 2404,
"end": 6758
} | class ____:
alg: type[algorithms.AES]
key_len: int
mode: type[modes.CTR] | type[modes.CBC] | type[modes.GCM]
block_len: int
iv_len: int
tag_len: int | None
is_aead: bool
# ciphers that are actually used in key wrapping
_SSH_CIPHERS: dict[bytes, _SSHCipher] = {
b"aes256-ctr": _SSHCipher... | _SSHCipher |
python | pytorch__pytorch | tools/experimental/torchfuzz/operators/nn_functional.py | {
"start": 31783,
"end": 33275
} | class ____(Operator):
"""Operator for torch.nn.functional.leaky_relu."""
def __init__(self):
super().__init__("torch.nn.functional.leaky_relu")
@property
def torch_op_name(self) -> str | None:
"""Return the torch operation name."""
return "torch.nn.functional.leaky_relu"
d... | LeakyReLUOperator |
python | GoogleCloudPlatform__python-docs-samples | appengine/standard/i18n/i18n_utils.py | {
"start": 5517,
"end": 7496
} | class ____(object):
"""A WSGI middleware for i18n.
This middleware determines users' preferred language, loads the
translations files, and install it to the builtin namespace of the
Python runtime.
"""
def __init__(self, app, default_language="en", locale_path=None):
"""A constructor f... | I18nMiddleware |
python | yaml__pyyaml | lib/yaml/events.py | {
"start": 667,
"end": 1007
} | class ____(NodeEvent):
def __init__(self, anchor, tag, implicit, start_mark=None, end_mark=None,
flow_style=None):
self.anchor = anchor
self.tag = tag
self.implicit = implicit
self.start_mark = start_mark
self.end_mark = end_mark
self.flow_style = flow_sty... | CollectionStartEvent |
python | allegroai__clearml | clearml/backend_api/services/v2_20/projects.py | {
"start": 119426,
"end": 122927
} | class ____(Request):
"""
Get unique parent tasks for the tasks in the specified projects
:param projects: The list of projects which task parents are retrieved. If not passed or empty then all the
projects are searched
:type projects: Sequence[str]
:param tasks_state: Return parents for tas... | GetTaskParentsRequest |
python | FactoryBoy__factory_boy | tests/test_alchemy.py | {
"start": 3444,
"end": 4539
} | class ____(TransactionTestCase):
def test_simple_call(self):
obj1 = WithGetOrCreateFieldFactory(foo='foo1')
obj2 = WithGetOrCreateFieldFactory(foo='foo1')
self.assertEqual(obj1, obj2)
def test_missing_arg(self):
with self.assertRaises(factory.FactoryError):
Multifiel... | SQLAlchemyGetOrCreateTests |
python | apache__airflow | task-sdk/src/airflow/sdk/api/datamodels/_generated.py | {
"start": 4460,
"end": 4651
} | class ____(BaseModel):
"""
Response for inactive assets.
"""
inactive_assets: Annotated[list[AssetProfile] | None, Field(title="Inactive Assets")] = None
| InactiveAssetsResponse |
python | kamyu104__LeetCode-Solutions | Python/find-pattern-in-infinite-stream-i.py | {
"start": 96,
"end": 982
} | class ____(object):
def findPattern(self, stream, pattern):
"""
:type stream: InfiniteStream
:type pattern: List[int]
:rtype: int
"""
def getPrefix(pattern):
prefix = [-1]*len(pattern)
j = -1
for i in xrange(1, len(pattern)):
... | Solution |
python | spack__spack | var/spack/test_repos/spack_repo/builtin_mock/packages/conditionally_extends_transitive_dep/package.py | {
"start": 217,
"end": 587
} | class ____(Package):
"""Package that tests if the extends directive supports a spec."""
homepage = "http://www.example.com"
url = "http://www.example.com/example-1.0.tar.gz"
version("1.0", md5="0123456789abcdef0123456789abcdef")
extends("extendee", when="@2:") # will not satisfy version
depe... | ConditionallyExtendsTransitiveDep |
python | huggingface__transformers | tests/models/mamba/test_modeling_mamba.py | {
"start": 1293,
"end": 8491
} | class ____:
def __init__(
self,
parent,
batch_size=14,
seq_length=7,
is_training=True,
use_labels=True,
vocab_size=99,
hidden_size=32,
num_hidden_layers=2,
intermediate_size=32,
hidden_act="silu",
hidden_dropout_prob=0.1... | MambaModelTester |
python | nedbat__coveragepy | tests/helpers.py | {
"start": 12047,
"end": 13098
} | class ____(DebugControl):
"""A `DebugControl` that writes to a StringIO, for testing."""
def __init__(self, options: Iterable[str]) -> None:
self.io = io.StringIO()
super().__init__(options, self.io)
def get_output(self) -> str:
"""Get the output text from the `DebugControl`."""
... | DebugControlString |
python | pennersr__django-allauth | allauth/socialaccount/providers/oauth/views.py | {
"start": 602,
"end": 1576
} | class ____:
client_class = OAuthClient
def __init__(self, request):
self.request = request
def complete_login(self, request, app):
"""
Returns a SocialLogin instance
"""
raise NotImplementedError
def get_provider(self):
adapter = get_adapter(self.reques... | OAuthAdapter |
python | mlflow__mlflow | tests/pyfunc/test_model_export_with_class_and_artifacts.py | {
"start": 96333,
"end": 100984
} | class ____(mlflow.pyfunc.PythonModel):
def predict(self, model_input: list[str]) -> list[str]:
return model_input
def test_lock_model_requirements(monkeypatch: pytest.MonkeyPatch, tmp_path: Path):
monkeypatch.setenv("MLFLOW_LOCK_MODEL_DEPENDENCIES", "true")
model_info = mlflow.pyfunc.log_model(na... | ExampleModel |
python | django-crispy-forms__django-crispy-forms | crispy_forms/bootstrap.py | {
"start": 24531,
"end": 26404
} | class ____(ContainerHolder):
"""
TabHolder object. It wraps Tab objects in a container.
Attributes
----------
template : str
The default template which this Layout Object will be rendered
with.
css_class : str, optional
CSS classes to be applied to the ``<div>``. By defa... | TabHolder |
python | apache__airflow | providers/google/tests/unit/google/cloud/operators/test_dataproc.py | {
"start": 86893,
"end": 88306
} | class ____(DataprocClusterTestBase):
@mock.patch(DATAPROC_PATH.format("Cluster.to_dict"))
@mock.patch(DATAPROC_PATH.format("DataprocHook"))
def test_execute(self, mock_hook, mock_to_dict):
cluster = MagicMock()
cluster.status.State.RUNNING = 3
cluster.status.state = 0
mock_ho... | TestDataprocStartClusterOperator |
python | allegroai__clearml | clearml/backend_api/services/v2_9/tasks.py | {
"start": 166778,
"end": 167982
} | class ____(Response):
"""
Response of tasks.edit_configuration endpoint.
:param updated: Indicates if the task was updated successfully
:type updated: int
"""
_service = "tasks"
_action = "edit_configuration"
_version = "2.9"
_schema = {
"definitions": {},
"properti... | EditConfigurationResponse |
python | python-jsonschema__jsonschema | jsonschema/tests/test_types.py | {
"start": 3435,
"end": 6977
} | class ____(TestCase):
def test_simple_type_can_be_extended(self):
def int_or_str_int(checker, instance):
if not isinstance(instance, (int, str)):
return False
try:
int(instance)
except ValueError:
return False
re... | TestCustomTypes |
python | huggingface__transformers | src/transformers/models/edgetam_video/modeling_edgetam_video.py | {
"start": 73306,
"end": 75431
} | class ____(nn.Module):
def __init__(self, config: EdgeTamVideoMaskDecoderConfig):
super().__init__()
self.config = config
self.num_hidden_layers = config.num_hidden_layers
self.layers = nn.ModuleList()
for i in range(self.num_hidden_layers):
self.layers.append(E... | EdgeTamVideoTwoWayTransformer |
python | davidhalter__jedi | test/completion/classes.py | {
"start": 4007,
"end": 4054
} | class ____(object):
FACTOR_1 = 0.1
| FactorMixin |
python | django__django | tests/template_tests/filter_tests/test_linebreaksbr.py | {
"start": 1037,
"end": 1842
} | class ____(SimpleTestCase):
def test_newline(self):
self.assertEqual(linebreaksbr("line 1\nline 2"), "line 1<br>line 2")
def test_carriage(self):
self.assertEqual(linebreaksbr("line 1\rline 2"), "line 1<br>line 2")
def test_carriage_newline(self):
self.assertEqual(linebreaksbr("lin... | FunctionTests |
python | kamyu104__LeetCode-Solutions | Python/path-with-minimum-effort.py | {
"start": 6045,
"end": 7268
} | class ____(object):
def minimumEffortPath(self, heights):
"""
:type heights: List[List[int]]
:rtype: int
"""
directions = [(0, 1), (1, 0), (0, -1), (-1, 0)]
def check(heights, x):
lookup = [[False]*len(heights[0]) for _ in xrange(len(heights))]
... | Solution5 |
python | getsentry__sentry | src/sentry/integrations/github_enterprise/webhook.py | {
"start": 11599,
"end": 12360
} | class ____(GitHubEnterpriseWebhookBase):
owner = ApiOwner.ECOSYSTEM
publish_status = {
"POST": ApiPublishStatus.PRIVATE,
}
_handlers = {
"push": GitHubEnterprisePushEventWebhook,
"pull_request": GitHubEnterprisePullRequestEventWebhook,
"installation": GitHubEnterpriseInst... | GitHubEnterpriseWebhookEndpoint |
python | davidhalter__jedi | test/examples/pytest_plugin_package/pytest_plugin/plugin.py | {
"start": 118,
"end": 215
} | class ____:
def login(self, **credentials):
...
def logout(self):
...
| Client |
python | PyCQA__pyflakes | pyflakes/checker.py | {
"start": 15508,
"end": 15648
} | class ____(Scope):
def __init__(self):
super().__init__()
# {name: node}
self.indirect_assignments = {}
| ClassScope |
python | facebook__pyre-check | tools/pysa_integration_tests/runner_lib.py | {
"start": 742,
"end": 865
} | class ____(Exception):
"""
Custom Exception to raise when Pyre errors out
"""
pass
@final
| PyreErrorException |
python | numba__numba | numba/core/types/npytypes.py | {
"start": 1717,
"end": 7905
} | class ____(Type):
"""
A Record datatype can be mapped to a NumPy structured dtype.
A record is very flexible since it is laid out as a list of bytes.
Fields can be mapped to arbitrary points inside it, even if they overlap.
*fields* is a list of `(name:str, data:dict)`.
Where `data` is `{ t... | Record |
python | celery__celery | t/unit/concurrency/test_gevent.py | {
"start": 592,
"end": 1363
} | class ____:
def setup_method(self):
self.patching.modules(*gevent_modules)
self.greenlet = self.patching('gevent.greenlet')
self.GreenletExit = self.patching('gevent.greenlet.GreenletExit')
def test_sched(self):
self.greenlet.Greenlet = object
x = Timer()
self.g... | test_Timer |
python | pytorch__pytorch | torch/_guards.py | {
"start": 18721,
"end": 19547
} | class ____:
global_state: dict[str, tuple[Callable, Any]] = {}
def __init__(self, global_states: dict[str, tuple[Callable, Any]]) -> None:
self.global_state = global_states
def diff(self, other: GlobalContextCheckpointState) -> Optional[set[str]]:
"""
Produces a delta against anoth... | GlobalContextCheckpointState |
python | getsentry__sentry | tests/sentry/issues/endpoints/test_project_grouping_configs.py | {
"start": 220,
"end": 731
} | class ____(APITestCase):
endpoint = "sentry-api-0-project-grouping-configs"
def test_permissions(self) -> None:
with assume_test_silo_mode(SiloMode.CONTROL):
token = ApiToken.objects.create(user=self.user, scope_list=[])
url = reverse(self.endpoint, args=(self.project.organization.... | ProjectGroupingConfigsTest |
python | kubernetes-client__python | kubernetes/base/config/kube_config_test.py | {
"start": 5441,
"end": 10567
} | class ____(BaseTestCase):
@staticmethod
def get_file_content(filename):
with open(filename) as f:
return f.read()
def test_file_given_file(self):
temp_filename = _create_temp_file_with_content(TEST_DATA)
obj = {TEST_FILE_KEY: temp_filename}
t = FileOrData(obj=ob... | TestFileOrData |
python | readthedocs__readthedocs.org | readthedocs/builds/migrations/0053_alter_version_build_data.py | {
"start": 148,
"end": 692
} | class ____(migrations.Migration):
safe = Safe.after_deploy()
dependencies = [
("builds", "0052_alter_versionautomationrule_polymorphic_ctype"),
]
operations = [
migrations.AlterField(
model_name="version",
name="build_data",
field=models.JSONField(
... | Migration |
python | PrefectHQ__prefect | src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py | {
"start": 341825,
"end": 342867
} | class ____(sgqlc.types.Type):
"""
See source code for more info.
"""
__schema__ = graphql_schema
__field_names__ = (
"attributes",
"emails",
"family_name",
"given_name",
"groups",
"name_id",
"username",
)
attributes = sgqlc.types.Field... | ExternalIdentitySamlAttributes |
python | python-markdown__markdown | markdown/inlinepatterns.py | {
"start": 36024,
"end": 36481
} | class ____(ReferenceInlineProcessor):
""" Match to a stored reference and return `img` element. """
def makeTag(self, href: str, title: str, text: str) -> etree.Element:
""" Return an `img` [`Element`][xml.etree.ElementTree.Element]. """
el = etree.Element("img")
el.set("src", href)
... | ImageReferenceInlineProcessor |
python | astropy__astropy | astropy/visualization/wcsaxes/tests/test_transform_coord_meta.py | {
"start": 454,
"end": 915
} | class ____(CurvedTransform):
has_inverse = True
def __init__(self, R=6e3):
super().__init__()
self.R = R
def transform(self, xy):
x, y = xy[:, 0], xy[:, 1]
lam = np.degrees(np.arctan2(y, x))
phi = 90.0 - np.degrees(np.hypot(x, y) / self.R)
return np.array((l... | DistanceToLonLat |
python | realpython__materials | python-class/animals.py | {
"start": 703,
"end": 781
} | class ____(Fish):
def swim(self):
print("The shark is swimming")
| Shark |
python | kamyu104__LeetCode-Solutions | Python/right-triangles.py | {
"start": 1170,
"end": 1905
} | class ____(object):
def numberOfRightTriangles(self, grid):
"""
:type grid: List[List[int]]
:rtype: int
"""
def get(i, j):
return grid[i][j] if n < m else grid[j][i]
def count(direction):
result = 0
cnt = [0]*min(n, m)
... | Solution3 |
python | django__django | tests/migrations/migrations_test_apps/mutate_state_b/migrations/0001_initial.py | {
"start": 43,
"end": 736
} | class ____(migrations.Migration):
dependencies = []
operations = [
migrations.SeparateDatabaseAndState(
[],
[
migrations.CreateModel(
name="B",
fields=[
(
"id",
... | Migration |
python | pallets__click | tests/test_options.py | {
"start": 56786,
"end": 56872
} | class ____(enum.Enum):
MD5 = "MD5"
SHA1 = "SHA1"
SHA256 = "SHA-256"
| HashType |
python | mlflow__mlflow | mlflow/models/dependencies_schemas.py | {
"start": 8110,
"end": 9703
} | class ____(Schema):
"""
Define vector search index resource to serve a model.
Args:
name (str): The name of the vector search index schema.
primary_key (str): The primary key for the index.
text_column (str): The main text column for the index.
doc_uri (Optional[str]): The d... | RetrieverSchema |
python | run-llama__llama_index | llama-index-core/llama_index/core/instrumentation/events/llm.py | {
"start": 2759,
"end": 3373
} | class ____(BaseEvent):
"""
LLMCompletionInProgressEvent.
Args:
prompt (str): The prompt to be completed.
response (CompletionResponse): Completion response.
"""
prompt: str
response: CompletionResponse
@classmethod
def class_name(cls) -> str:
"""Class name."""... | LLMCompletionInProgressEvent |
python | charliermarsh__ruff | crates/ruff_linter/resources/test/fixtures/pylint/duplicate_bases.py | {
"start": 250,
"end": 279
} | class ____(A, A, B):
...
| G1 |
python | ray-project__ray | python/ray/cloudpickle/py_pickle.py | {
"start": 346,
"end": 676
} | class ____(_Pickler):
def __init__(self, file, protocol=None, *, fix_imports=True, buffer_callback=None):
super().__init__(
file, protocol, fix_imports=fix_imports, buffer_callback=buffer_callback
)
# avoid being overrided by cloudpickle
self.dispatch = _Pickler.dispatch.... | Pickler |
python | django__django | django/db/models/functions/window.py | {
"start": 404,
"end": 520
} | class ____(Func):
function = "DENSE_RANK"
output_field = IntegerField()
window_compatible = True
| DenseRank |
python | mlflow__mlflow | mlflow/gateway/app.py | {
"start": 8762,
"end": 18621
} | class ____(BaseModel):
routes: list[_LegacyRoute]
next_page_token: str | None = None
model_config = ConfigDict(
json_schema_extra={
"example": {
"endpoints": [
{
"name": "openai-chat",
"route_type": "llm... | _LegacySearchRoutesResponse |
python | tensorflow__tensorflow | tensorflow/python/framework/errors_impl.py | {
"start": 13976,
"end": 14692
} | class ____(OpError):
"""Raised when some prerequisites are not met when running an operation.
This typically indicates that system is not in state to execute the operation
and requires preconditions to be met before successfully executing current
operation.
For example, this exception is commonly raised whe... | FailedPreconditionError |
python | streamlit__streamlit | lib/tests/streamlit/elements/lib/options_selector_utils_test.py | {
"start": 5682,
"end": 13118
} | class ____:
"""Test class for Enum Coercion feature."""
@pytest.fixture
def EnumAOrig(self):
class EnumA(enum.Enum):
A = enum.auto()
B = enum.auto()
C = enum.auto()
EnumA.__qualname__ = "__main__.EnumA"
return EnumA
@pytest.fixture
def E... | TestEnumCoercion |
python | langchain-ai__langchain | libs/core/langchain_core/output_parsers/transform.py | {
"start": 2878,
"end": 5835
} | class ____(BaseTransformOutputParser[T]):
"""Base class for an output parser that can handle streaming input."""
diff: bool = False
"""In streaming mode, whether to yield diffs between the previous and current
parsed output, or just the current parsed output.
"""
def _diff(
self,
... | BaseCumulativeTransformOutputParser |
python | getsentry__sentry | src/sentry/web/frontend/debug/debug_uptime_auto_detected_monitor_email.py | {
"start": 536,
"end": 917
} | class ____(View):
def get(self, request: HttpRequest) -> HttpResponse:
context = get_context()
return MailPreview(
text_template="sentry/emails/uptime/auto-detected-monitors.txt",
html_template="sentry/emails/uptime/auto-detected-monitors.html",
context=context,
... | DebugUptimeAutoDetectedMonitorEmailView |
python | pytorch__pytorch | torch/_inductor/codegen/cpp_gemm_template.py | {
"start": 77885,
"end": 77962
} | class ____(metaclass=CppWoqInt4GemmTemplateMeta):
pass
| CppWoqInt4GemmTemplate |
python | sqlalchemy__sqlalchemy | lib/sqlalchemy/pool/base.py | {
"start": 1195,
"end": 2770
} | class ____:
"""describes the state of a DBAPI connection as it is being passed to
the :meth:`.PoolEvents.reset` connection pool event.
.. versionadded:: 2.0.0b3
"""
__slots__ = ("transaction_was_reset", "terminate_only", "asyncio_safe")
transaction_was_reset: bool
"""Indicates if the tra... | PoolResetState |
python | explosion__spaCy | spacy/lang/cs/__init__.py | {
"start": 215,
"end": 305
} | class ____(Language):
lang = "cs"
Defaults = CzechDefaults
__all__ = ["Czech"]
| Czech |
python | h5py__h5py | h5py/tests/test_dataset.py | {
"start": 4648,
"end": 8510
} | class ____(BaseDataset):
"""
Feature: Datasets can be created from existing data
"""
def test_create_scalar(self):
""" Create a scalar dataset from existing array """
data = np.ones((), 'f')
dset = self.f.create_dataset(make_name(), data=data)
self.assertEqual(dset.... | TestCreateData |
python | lazyprogrammer__machine_learning_examples | ann_class2/batch_norm_theano.py | {
"start": 2908,
"end": 5905
} | class ____(object):
def __init__(self, hidden_layer_sizes):
self.hidden_layer_sizes = hidden_layer_sizes
def fit(self, X, Y, Xtest, Ytest, activation=T.nnet.relu, learning_rate=1e-2, mu=0.9, epochs=15, batch_sz=100, print_period=100, show_fig=True):
X = X.astype(np.float32)
Y = Y.astype(np.int32)
... | ANN |
python | doocs__leetcode | solution/0900-0999/0936.Stamping The Sequence/Solution.py | {
"start": 0,
"end": 917
} | class ____:
def movesToStamp(self, stamp: str, target: str) -> List[int]:
m, n = len(stamp), len(target)
indeg = [m] * (n - m + 1)
q = deque()
g = [[] for _ in range(n)]
for i in range(n - m + 1):
for j, c in enumerate(stamp):
if target[i + j] == c... | Solution |
python | aio-libs__aiohttp | aiohttp/web_exceptions.py | {
"start": 5041,
"end": 5120
} | class ____(HTTPSuccessful):
status_code = 203
| HTTPNonAuthoritativeInformation |
python | getsentry__sentry | src/sentry/integrations/msteams/client.py | {
"start": 3089,
"end": 3683
} | class ____(MsTeamsClientABC):
integration_name = IntegrationProviderSlug.MSTEAMS.value
def __init__(self, access_token: str, service_url: str):
super().__init__()
self.access_token = access_token
self.base_url = service_url.rstrip("/")
def request(self, method, path, data=None, par... | MsTeamsPreInstallClient |
python | google__pytype | pytype/tests/test_fiddle_overlay.py | {
"start": 350,
"end": 397
} | class ____(Generic[T], Buildable[T]):
...
| Config |
python | getsentry__sentry | src/sentry/backup/services/import_export/model.py | {
"start": 7573,
"end": 8009
} | class ____(RpcModel):
"""
Information about a successful export: the mapping of old pks to new ones, the maximum pk
exported, and the JSON string of the exported models.
"""
is_err: Literal[False] = False
mapped_pks: RpcPrimaryKeyMap
max_pk: int = 0
json_data: str = "[]"
# Using strin... | RpcExportOk |
python | allegroai__clearml | clearml/backend_api/services/v2_13/workers.py | {
"start": 30941,
"end": 43268
} | class ____(NonStrictDataModel):
"""
:param cpu_usage: Average CPU usage per core
:type cpu_usage: Sequence[float]
:param gpu_usage: Average GPU usage per GPU card
:type gpu_usage: Sequence[float]
:param memory_used: Used memory MBs
:type memory_used: int
:param memory_free: Free memory M... | MachineStats |
python | streamlit__streamlit | lib/streamlit/web/server/bidi_component_request_handler.py | {
"start": 1459,
"end": 6932
} | class ____(tornado.web.RequestHandler):
"""Request handler for serving Custom Components v2 static assets.
The handler resolves a requested path to a registered component's asset
within its component root, writes the file contents to the response, and
sets appropriate ``Content-Type`` and cache headers... | BidiComponentRequestHandler |
python | sympy__sympy | sympy/functions/elementary/hyperbolic.py | {
"start": 64476,
"end": 70979
} | class ____(InverseHyperbolicFunction):
"""
``acsch(x)`` is the inverse hyperbolic cosecant of ``x``.
The inverse hyperbolic cosecant function.
Examples
========
>>> from sympy import acsch, sqrt, I
>>> from sympy.abc import x
>>> acsch(x).diff(x)
-1/(x**2*sqrt(1 + x**(-2)))
>>... | acsch |
python | sphinx-doc__sphinx | sphinx/ext/intersphinx/_load.py | {
"start": 7927,
"end": 16450
} | class ____:
intersphinx_cache_limit: int
intersphinx_timeout: int | float | None
tls_verify: bool
tls_cacerts: str | dict[str, str] | None
user_agent: str
@classmethod
def from_config(cls, config: Config) -> _InvConfig:
return cls(
intersphinx_cache_limit=config.intersph... | _InvConfig |
python | sqlalchemy__sqlalchemy | lib/sqlalchemy/orm/decl_api.py | {
"start": 38380,
"end": 64630
} | class ____(EventTarget):
"""Generalized registry for mapping classes.
The :class:`_orm.registry` serves as the basis for maintaining a collection
of mappings, and provides configurational hooks used to map classes.
The three general kinds of mappings supported are Declarative Base,
Declarative Dec... | registry |
python | airbytehq__airbyte | airbyte-ci/connectors/live-tests/src/live_tests/report.py | {
"start": 2469,
"end": 6642
} | class ____(BaseReport):
TEMPLATE_NAME = "private_details.html.j2"
SPEC_SECRET_MASK_URL = "https://connectors.airbyte.com/files/registries/v0/specs_secrets_mask.yaml"
def __init__(self, path: Path, pytest_config: Config) -> None:
self.secret_properties = self.get_secret_properties()
super().... | PrivateDetailsReport |
python | coleifer__peewee | tests/shortcuts.py | {
"start": 607,
"end": 652
} | class ____(TestModel):
tag = TextField()
| Tag |
python | great-expectations__great_expectations | great_expectations/data_context/types/base.py | {
"start": 42411,
"end": 46994
} | class ____(Schema):
config_version: fields.Number = fields.Number(
validate=lambda x: 0 < x < 100, # noqa: PLR2004 # FIXME CoP
error_messages={"invalid": "config version must be a number."},
)
fluent_datasources = fields.Dict(
keys=fields.Str(),
required=False,
allow... | DataContextConfigSchema |
python | spack__spack | lib/spack/spack/cmd/create.py | {
"start": 25581,
"end": 38894
} | class ____:
"""An instance of BuildSystemAndLanguageGuesser provides a callable object to be used
during ``spack create``. By passing this object to ``spack checksum``, we
can take a peek at the fetched tarball and discern the build system it uses
"""
def __init__(self):
"""Sets the default... | BuildSystemAndLanguageGuesser |
python | xlwings__xlwings | xlwings/_xlmac.py | {
"start": 44288,
"end": 44690
} | class ____(base_classes.Note):
def __init__(self, parent, xl):
self.parent = parent
self.xl = xl
def api(self):
return self.xl
@property
def text(self):
return self.xl.Excel_comment_text()
@text.setter
def text(self, value):
self.xl.Excel_comment_text(t... | Note |
python | getsentry__sentry | tests/sentry/core/endpoints/test_organization_member_details.py | {
"start": 6939,
"end": 37287
} | class ____(OrganizationMemberTestBase, HybridCloudTestMixin):
method = "put"
def setUp(self) -> None:
super().setUp()
self.curr_user = self.create_user("member@example.com")
self.curr_member = self.create_member(
organization=self.organization, role="member", user=self.curr... | UpdateOrganizationMemberTest |
python | PrefectHQ__prefect | src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py | {
"start": 6586,
"end": 6979
} | class ____(sgqlc.types.Enum):
"""
See source code for more info.
"""
__schema__ = graphql_schema
__choices__ = (
"ENTERPRISE_ORGANIZATIONS",
"ENTERPRISE_ORGANIZATIONS_USER_ACCOUNTS",
"EVERYWHERE",
"SAME_ORGANIZATION",
"SAME_ORGANIZATION_USER_ACCOUNTS",
... | EnterpriseAllowPrivateRepositoryForkingPolicyValue |
python | getsentry__sentry | tests/sentry/sentry_apps/tasks/test_servicehooks.py | {
"start": 364,
"end": 4252
} | class ____(TestCase):
def setUp(self) -> None:
self.hook = self.create_service_hook(project=self.project, events=("issue.created",))
@patch("sentry.sentry_apps.tasks.service_hooks.safe_urlopen")
@responses.activate
def test_verify_sentry_hook_signature(self, safe_urlopen: MagicMock) -> None:
... | TestServiceHooks |
python | tensorflow__tensorflow | tensorflow/python/platform/resource_loader_test.py | {
"start": 797,
"end": 1179
} | class ____(googletest.TestCase):
def test_exception(self):
with self.assertRaises(IOError):
resource_loader.load_resource("/fake/file/path/dne")
def test_exists(self):
contents = resource_loader.load_resource(
"python/platform/resource_loader.py")
self.assertIn(b"tensorflow", contents)
... | ResourceLoaderTest |
python | tensorflow__tensorflow | tensorflow/python/saved_model/method_name_updater_test.py | {
"start": 2749,
"end": 10356
} | class ____(test.TestCase):
def setUp(self):
super(MethodNameUpdaterTest, self).setUp()
self._saved_model_path = tempfile.mkdtemp(prefix=test.get_temp_dir())
def testBasic(self):
path = os.path.join(
compat.as_bytes(self._saved_model_path),
compat.as_bytes(constants.SAVED_MODEL_FILENAME... | MethodNameUpdaterTest |
python | weaviate__weaviate-python-client | weaviate/collections/classes/internal.py | {
"start": 4373,
"end": 5658
} | class ____(Generic[P, R], Object[P, R]):
"""A single Weaviate object returned by a query within the `generate` namespace of a collection."""
__generated: Optional[str]
generative: Optional[GenerativeSingle]
# init required because of nuances of dataclass when defining @property generated and private v... | GenerativeObject |
python | HypothesisWorks__hypothesis | hypothesis-python/tests/cover/test_pretty.py | {
"start": 9152,
"end": 13287
} | class ____(type):
def __new__(metacls, name):
return type.__new__(metacls, name, (object,), {"name": name})
def __repr__(cls):
return f"[CUSTOM REPR FOR CLASS {cls.name}]"
ClassWithMeta = MetaClass("ClassWithMeta")
def test_metaclass_repr():
output = pretty.pretty(ClassWithMeta)
ass... | MetaClass |
python | django-haystack__django-haystack | test_haystack/test_app_using_appconfig/apps.py | {
"start": 36,
"end": 179
} | class ____(AppConfig):
name = "test_haystack.test_app_using_appconfig"
verbose_name = "Simple test app using AppConfig"
| SimpleTestAppConfig |
python | lxml__lxml | src/lxml/html/__init__.py | {
"start": 51786,
"end": 53056
} | class ____(list):
"""
Represents a group of checkboxes (``<input type=checkbox>``) that
have the same name.
In addition to using this like a list, the ``.value`` attribute
returns a set-like object that you can add to or remove from to
check and uncheck checkboxes. You can also use ``.value_op... | CheckboxGroup |
python | cherrypy__cherrypy | cherrypy/_cpwsgi.py | {
"start": 8832,
"end": 14956
} | class ____(object):
"""WSGI response iterable for CherryPy applications."""
def __init__(self, environ, start_response, cpapp):
"""Initialize the WSGI app response."""
self.cpapp = cpapp
try:
self.environ = environ
self.run()
r = _cherrypy.serving.re... | AppResponse |
python | openai__openai-python | src/openai/_module_client.py | {
"start": 1877,
"end": 2004
} | class ____(LazyProxy["Images"]):
@override
def __load__(self) -> Images:
return _load_client().images
| ImagesProxy |
python | Unity-Technologies__ml-agents | ml-agents-envs/mlagents_envs/environment.py | {
"start": 1773,
"end": 23093
} | class ____(BaseEnv):
# Communication protocol version.
# When connecting to C#, this must be compatible with Academy.k_ApiVersion.
# We follow semantic versioning on the communication version, so existing
# functionality will work as long the major versions match.
# This should be changed whenever a... | UnityEnvironment |
python | explosion__spaCy | spacy/schemas.py | {
"start": 17198,
"end": 17287
} | class ____(BaseModel):
class Config:
extra = "forbid"
| ConfigSchemaPretrainEmpty |
python | scipy__scipy | scipy/optimize/tests/test_cobyla.py | {
"start": 228,
"end": 5691
} | class ____:
def setup_method(self):
# The algorithm is very fragile on 32 bit, so unfortunately we need to start
# very near the solution in order for the test to pass.
self.x0 = [np.sqrt(25 - (2.0/3)**2), 2.0/3 + 1e-4]
self.solution = [math.sqrt(25 - (2.0/3)**2), 2.0/3]
self... | TestCobyla |
python | walkccc__LeetCode | solutions/1318. Minimum Flips to Make a OR b Equal to c/1318.py | {
"start": 0,
"end": 296
} | class ____:
def minFlips(self, a: int, b: int, c: int) -> int:
MAX_BIT = 30
ans = 0
for i in range(MAX_BIT):
if c >> i & 1:
ans += (a >> i & 1) == 0 and (b >> i & 1) == 0
else: # (c >> i & 1) == 0
ans += (a >> i & 1) + (b >> i & 1)
return ans
| Solution |
python | sqlalchemy__sqlalchemy | lib/sqlalchemy/ext/automap.py | {
"start": 30703,
"end": 31864
} | class ____(Protocol):
def __call__(
self,
base: Type[Any],
local_cls: Type[Any],
referred_cls: Type[Any],
constraint: ForeignKeyConstraint,
) -> str: ...
def name_for_collection_relationship(
base: Type[Any],
local_cls: Type[Any],
referred_cls: Type[Any],
... | NameForCollectionRelationshipType |
python | run-llama__llama_index | llama-index-integrations/embeddings/llama-index-embeddings-oracleai/llama_index/embeddings/oracleai/base.py | {
"start": 643,
"end": 6511
} | class ____(BaseEmbedding):
"""Get Embeddings."""
_conn: Any = PrivateAttr()
_params: Dict[str, Any] = PrivateAttr()
_proxy: Optional[str] = PrivateAttr()
def __init__(
self,
conn: Connection,
params: Dict[str, Any],
proxy: Optional[str] = None,
**kwargs: Any... | OracleEmbeddings |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.