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 | bokeh__bokeh | src/bokeh/models/widgets/pickers.py | {
"start": 1952,
"end": 2468
} | class ____(InputWidget):
""" Base class for various kinds of picker widgets. """
# explicit __init__ to support Init signatures
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)
position = Enum(CalendarPosition, default="auto", help="""
Where the cale... | PickerBase |
python | google__pytype | pytype/pytd/pytd.py | {
"start": 18523,
"end": 18591
} | class ____(Type):
value: int | str | bool | TypeU | Constant
| Literal |
python | imageio__imageio | imageio/plugins/_dicom.py | {
"start": 3868,
"end": 22347
} | class ____(object):
"""
This class provides reading of pixel data from DICOM files. It is
focussed on getting the pixel data, not the meta info.
To use, first create an instance of this class (giving it
a file object or filename). Next use the info attribute to
get a dict of the meta data. The ... | SimpleDicomReader |
python | gevent__gevent | src/greentest/3.14/test_smtplib.py | {
"start": 4889,
"end": 6949
} | class ____(GeneralTests, unittest.TestCase):
client = smtplib.LMTP
@unittest.skipUnless(hasattr(socket, 'AF_UNIX'), "test requires Unix domain socket")
def testUnixDomainSocketTimeoutDefault(self):
local_host = '/some/local/lmtp/delivery/program'
mock_socket.reply_with(b"220 Hello world")
... | LMTPGeneralTests |
python | pydantic__pydantic | pydantic-core/tests/test_errors.py | {
"start": 33009,
"end": 37672
} | class ____:
def __repr__(self):
raise RuntimeError('bad repr')
def test_error_on_repr(pydantic_version):
s = SchemaValidator(core_schema.int_schema())
with pytest.raises(ValidationError) as exc_info:
s.validate_python(BadRepr())
assert str(exc_info.value) == (
'1 validation er... | BadRepr |
python | FactoryBoy__factory_boy | factory/fuzzy.py | {
"start": 3281,
"end": 3777
} | class ____(BaseFuzzyAttribute):
"""Random decimal within a given range."""
def __init__(self, low, high=None, precision=2):
if high is None:
high = low
low = 0.0
self.low = low
self.high = high
self.precision = precision
super().__init__()
... | FuzzyDecimal |
python | tox-dev__tox | src/tox/execute/local_sub_process/__init__.py | {
"start": 6808,
"end": 14584
} | class ____(ExecuteInstance):
def __init__(
self,
request: ExecuteRequest,
options: ExecuteOptions,
out: SyncWrite,
err: SyncWrite,
on_exit_drain: bool = True, # noqa: FBT001, FBT002
) -> None:
super().__init__(request, options, out, err)
self.proc... | LocalSubProcessExecuteInstance |
python | jazzband__django-oauth-toolkit | oauth2_provider/views/oidc.py | {
"start": 4784,
"end": 5930
} | class ____(OIDCOnlyMixin, View):
"""
View used to show oidc json web key set document
"""
def get(self, request, *args, **kwargs):
keys = []
if oauth2_settings.OIDC_RSA_PRIVATE_KEY:
for pem in [
oauth2_settings.OIDC_RSA_PRIVATE_KEY,
*oauth2_se... | JwksInfoView |
python | apache__airflow | airflow-core/tests/unit/dags/test_on_kill.py | {
"start": 1106,
"end": 2133
} | class ____(EmptyOperator):
def execute(self, context: Context):
import os
self.log.info("Signalling that I am running")
# signal to the test that we've started
with open("/tmp/airflow_on_kill_running", "w") as f:
f.write("ON_KILL_RUNNING")
self.log.info("Signalle... | DummyWithOnKill |
python | tensorflow__tensorflow | tensorflow/python/framework/python_tensor_converter_test.py | {
"start": 1330,
"end": 9127
} | class ____(test_util.TensorFlowTestCase,
parameterized.TestCase):
def setUp(self):
context.ensure_initialized()
super(PythonTensorConverterTest, self).setUp()
def makePythonTensorConverter(self):
return _pywrap_python_tensor_converter.PythonTensorConverter(
cont... | PythonTensorConverterTest |
python | charliermarsh__ruff | crates/ruff_linter/resources/test/fixtures/flake8_unused_arguments/ignore_variadic_names.py | {
"start": 101,
"end": 236
} | class ____:
def f(self, a, b):
print("Hello, world!")
def f(self, a, b, *args, **kwargs):
print("Hello, world!")
| C |
python | numba__numba | numba/np/ufunc/parallel.py | {
"start": 6191,
"end": 7337
} | class ____(ufuncbuilder.UFuncBuilder):
def build(self, cres, sig):
_launch_threads()
# Builder wrapper for ufunc entry point
ctx = cres.target_context
signature = cres.signature
library = cres.library
fname = cres.fndesc.llvm_func_name
info = build_ufunc_wra... | ParallelUFuncBuilder |
python | django__django | tests/messages_tests/tests.py | {
"start": 3711,
"end": 7779
} | class ____(MessagesTestMixin, SimpleTestCase):
def test_assertion(self):
response = FakeResponse()
add_message(response.wsgi_request, constants.DEBUG, "DEBUG message.")
add_message(response.wsgi_request, constants.INFO, "INFO message.")
add_message(response.wsgi_request, constants.SU... | AssertMessagesTest |
python | dagster-io__dagster | python_modules/dagster-graphql/dagster_graphql/schema/roots/pipeline.py | {
"start": 547,
"end": 765
} | class ____(graphene.Union):
class Meta:
types = (
GrapheneGraph,
GrapheneGraphNotFoundError,
GraphenePythonError,
)
name = "GraphOrError"
| GrapheneGraphOrError |
python | jazzband__django-polymorphic | example/orders/models.py | {
"start": 1652,
"end": 1914
} | class ____(Payment):
"""
Payment by SEPA (EU)
"""
iban = models.CharField(max_length=34)
bic = models.CharField(max_length=11)
class Meta:
verbose_name = _("SEPA Payment")
verbose_name_plural = _("SEPA Payments")
| SepaPayment |
python | spack__spack | lib/spack/spack/repo.py | {
"start": 61267,
"end": 70061
} | class ____(RepoDescriptor):
def __init__(
self,
*,
name: Optional[str],
repository: str,
branch: Optional[str],
commit: Optional[str],
tag: Optional[str],
destination: str,
relative_paths: Optional[List[str]],
lock: spack.util.lock.Lock... | RemoteRepoDescriptor |
python | scipy__scipy | scipy/signal/tests/test_ltisys.py | {
"start": 33225,
"end": 39020
} | class ____:
A = [[1.0, 2.0], [3.0, 4.0]]
B = [[-1.0], [5.0]]
C = [[4.0, 5.0]]
D = [[2.5]]
def test_no_matrix_fails(self):
assert_raises(ValueError, abcd_normalize)
def test_A_nosquare_fails(self, xp):
assert_raises(ValueError, abcd_normalize, xp.asarray([1, -1]),
... | Test_abcd_normalize |
python | python-openxml__python-docx | src/docx/shared.py | {
"start": 2885,
"end": 3170
} | class ____(Length):
"""Convenience constructor for length in twips, e.g. ``width = Twips(42)``.
A twip is a twentieth of a point, 635 EMU.
"""
def __new__(cls, twips: float):
emu = int(twips * Length._EMUS_PER_TWIP)
return Length.__new__(cls, emu)
| Twips |
python | milvus-io__pymilvus | pymilvus/exceptions.py | {
"start": 2691,
"end": 2796
} | class ____(MilvusException):
"""Raise when insert data isn't match with schema"""
| DataNotMatchException |
python | ethereum__web3.py | web3/utils/subscriptions.py | {
"start": 7145,
"end": 7876
} | class ____(EthSubscription[BlockData]):
def __init__(
self,
label: str | None = None,
handler: NewHeadsSubscriptionHandler | None = None,
handler_context: dict[str, Any] | None = None,
parallelize: bool | None = None,
) -> None:
super().__init__(
subsc... | NewHeadsSubscription |
python | ray-project__ray | rllib/algorithms/dqn/dqn.py | {
"start": 2332,
"end": 24984
} | class ____(AlgorithmConfig):
r"""Defines a configuration class from which a DQN Algorithm can be built.
.. testcode::
from ray.rllib.algorithms.dqn.dqn import DQNConfig
config = (
DQNConfig()
.environment("CartPole-v1")
.training(replay_buffer_config={
... | DQNConfig |
python | getsentry__sentry-python | sentry_sdk/_init_implementation.py | {
"start": 173,
"end": 2559
} | class ____:
_CONTEXT_MANAGER_DEPRECATION_WARNING_MESSAGE = (
"Using the return value of sentry_sdk.init as a context manager "
"and manually calling the __enter__ and __exit__ methods on the "
"return value are deprecated. We are no longer maintaining this "
"functionality, and we wi... | _InitGuard |
python | kamyu104__LeetCode-Solutions | Python/minimum-absolute-difference-in-sliding-submatrix.py | {
"start": 1353,
"end": 1915
} | class ____(object):
def minAbsDiff(self, grid, k):
"""
:type grid: List[List[int]]
:type k: int
:rtype: List[List[int]]
"""
result = [[-1]*(len(grid[0])-(k-1)) for _ in xrange(len(grid)-(k-1))]
for i in xrange(len(grid)-(k-1)):
for j in xrange(len(... | Solution2 |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/metaclass7.py | {
"start": 763,
"end": 885
} | class ____(type):
def __call__(cls, *args, **kwargs) -> Any:
return super().__call__(*args, **kwargs)
| MetaClass3 |
python | numpy__numpy | numpy/_core/tests/test_multiarray.py | {
"start": 29848,
"end": 32605
} | class ____:
def _create_array(self):
return np.array([0, 1])[0]
def test_ellipsis_subscript(self):
a = self._create_array()
assert_equal(a[...], 0)
assert_equal(a[...].shape, ())
def test_empty_subscript(self):
a = self._create_array()
assert_equal(a[()], 0)... | TestScalarIndexing |
python | huggingface__transformers | src/transformers/models/unispeech_sat/modeling_unispeech_sat.py | {
"start": 65253,
"end": 66873
} | class ____(nn.Module):
def __init__(self, config, layer_id=0):
super().__init__()
self.in_conv_dim = config.tdnn_dim[layer_id - 1] if layer_id > 0 else config.tdnn_dim[layer_id]
self.out_conv_dim = config.tdnn_dim[layer_id]
self.kernel_size = config.tdnn_kernel[layer_id]
self... | TDNNLayer |
python | getsentry__sentry | src/sentry/notifications/api/serializers/notification_action_response.py | {
"start": 432,
"end": 2738
} | class ____(Serializer):
"""
Model serializer for outgoing NotificationAction API payloads
"""
def get_attrs(self, item_list: Sequence[NotificationAction], user, **kwargs):
action_ids = {i.id for i in item_list}
projects_by_action_id = manytoone_to_dict(
NotificationActionPro... | OutgoingNotificationActionSerializer |
python | gevent__gevent | src/gevent/_ident.py | {
"start": 541,
"end": 2249
} | class ____(object):
"""
Maintains a unique mapping of (small) non-negative integer identifiers
to objects that can be weakly referenced.
It is guaranteed that no two objects will have the the same
identifier at the same time, as long as those objects are
also uniquely hashable.
"""
def... | IdentRegistry |
python | squidfunk__mkdocs-material | material/plugins/projects/structure/__init__.py | {
"start": 10260,
"end": 10548
} | class ____:
# Initialize project job
def __init__(self, project: Project, dependencies: list[Project]):
self.project = project
self.dependencies = dependencies
# -----------------------------------------------------------------------------
# Project link
| ProjectJob |
python | rapidsai__cudf | python/cudf/cudf/core/join/_join_helpers.py | {
"start": 773,
"end": 1140
} | class ____:
# Indexer into a column (either a data column or index level).
#
# >>> df
# a
# b
# 4 1
# 5 2
# 6 3
# >>> _Indexer("a", column=True).get(df) # returns column "a" of df
# >>> _Indexer("b", index=True).get(df) # returns index level "b" of df
def __init__(se... | _Indexer |
python | mlflow__mlflow | mlflow/gateway/schemas/chat.py | {
"start": 3805,
"end": 3957
} | class ____(ChatCompletionChunk, ResponseModel):
model_config = ConfigDict(json_schema_extra=_STREAM_RESPONSE_PAYLOAD_EXTRA_SCHEMA)
| StreamResponsePayload |
python | ethereum__web3.py | web3/geth.py | {
"start": 4215,
"end": 6465
} | class ____(Module):
"""
https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-admin
"""
is_async = True
_add_peer: Method[Callable[[EnodeURI], Awaitable[bool]]] = Method(
RPC.admin_addPeer,
mungers=[default_root_munger],
)
async def add_peer(self, node_url: EnodeURI)... | AsyncGethAdmin |
python | Lightning-AI__lightning | examples/pytorch/basics/autoencoder.py | {
"start": 4176,
"end": 5659
} | class ____(LightningModule):
"""
>>> LitAutoEncoder() # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
LitAutoEncoder(
(encoder): ...
(decoder): ...
)
"""
def __init__(self, hidden_dim: int = 64, learning_rate=10e-3):
super().__init__()
self.save_hyperparameters()
... | LitAutoEncoder |
python | PyCQA__pylint | tests/functional/n/no/no_warning_docstring.py | {
"start": 321,
"end": 521
} | class ____(AAAA):
''' class BBBB '''
def __init__(self):
AAAA.__init__(self)
# should ignore docstring calling from class AAAA
def method1(self):
AAAA.method1(self)
| BBBB |
python | kamyu104__LeetCode-Solutions | Python/check-if-numbers-are-ascending-in-a-sentence.py | {
"start": 29,
"end": 563
} | class ____(object):
def areNumbersAscending(self, s):
"""
:type s: str
:rtype: bool
"""
prev = curr = -1
for i, c in enumerate(s):
if c.isdigit():
curr = max(curr, 0)*10+int(c)
continue
if prev != -1 and curr != ... | Solution |
python | ApeWorX__ape | tests/functional/test_dependencies.py | {
"start": 28413,
"end": 31911
} | class ____:
@pytest.fixture
def api(self):
return LocalDependency(local=Path.cwd(), name="ooga", version="1.0.0")
@pytest.fixture
def dependency(self, api, project):
return Dependency(api, project)
def test_repr(self, dependency):
actual = repr(dependency)
path = st... | TestDependency |
python | cython__cython | Cython/Compiler/Nodes.py | {
"start": 71873,
"end": 75579
} | class ____(StatNode):
# name string or None
# cname string or None
# scoped boolean Is a C++ scoped enum
# underlying_type CSimpleBaseTypeNode The underlying value type (int or C++ type)
# items [CEnumDefItemNode]
# t... | CEnumDefNode |
python | PyCQA__pylint | tests/functional/s/super/super_init_not_called.py | {
"start": 2071,
"end": 2277
} | class ____(AbstractBase):
def __init__(self, param: int) -> None: # [super-init-not-called]
print("Called")
def abstract_method(self) -> str:
return "Implemented"
| DerivedFromAbstract |
python | plotly__plotly.py | plotly/graph_objs/scattermapbox/_legendgrouptitle.py | {
"start": 233,
"end": 2982
} | class ____(_BaseTraceHierarchyType):
_parent_path_str = "scattermapbox"
_path_str = "scattermapbox.legendgrouptitle"
_valid_props = {"font", "text"}
@property
def font(self):
"""
Sets this legend group's title font.
The 'font' property is an instance of Font
that ma... | Legendgrouptitle |
python | modin-project__modin | modin/config/envvars.py | {
"start": 33440,
"end": 33875
} | class ____(EnvironmentVariable, type=bool):
"""Whether serialization should be persistent."""
varname = "MODIN_PERSISTENT_PICKLE"
# When set to off, it allows faster serialization which is only
# valid in current run (i.e. useless for saving to disk).
# When set to on, Modin objects could be saved ... | PersistentPickle |
python | anthropics__anthropic-sdk-python | src/anthropic/lib/bedrock/_beta_messages.py | {
"start": 1376,
"end": 2287
} | class ____(AsyncAPIResource):
create = FirstPartyAsyncMessagesAPI.create
@cached_property
def with_raw_response(self) -> AsyncMessagesWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return the
the raw response object instead of the parsed conte... | AsyncMessages |
python | mlflow__mlflow | docs/api_reference/source/testcode_block.py | {
"start": 1818,
"end": 3667
} | class ____(CodeBlock):
"""
Overrides the `code-block` directive to dump code blocks marked with the `:test:` option
to files for testing.
```
.. code-block:: python
:test:
print("Hello, world!")
```
"""
option_spec = {**CodeBlock.option_spec, "test": directives.flag}
... | TestCodeBlockDirective |
python | getsentry__sentry | tests/sentry/integrations/gitlab/tasks/test_pr_comment.py | {
"start": 7586,
"end": 11578
} | class ____(SnubaTestCase, GitlabCommentTestCase):
def test_simple(self) -> None:
group1 = [
self.store_event(
{"fingerprint": ["group-1"], "timestamp": before_now(days=1).isoformat()},
project_id=self.project.id,
)
for _ in range(3)
... | TestTop5IssuesByCount |
python | python-openxml__python-docx | tests/dml/test_color.py | {
"start": 379,
"end": 4897
} | class ____:
"""Unit-test suite for `docx.dml.color.ColorFormat` objects."""
@pytest.mark.parametrize(
("r_cxml", "expected_value"),
[
("w:r", None),
("w:r/w:rPr", None),
("w:r/w:rPr/w:color{w:val=auto}", MSO_COLOR_TYPE.AUTO),
("w:r/w:rPr/w:color{w... | DescribeColorFormat |
python | bokeh__bokeh | src/bokeh/models/widgets/buttons.py | {
"start": 5328,
"end": 6459
} | class ____(AbstractButton):
''' A dropdown button.
'''
# explicit __init__ to support Init signatures
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)
label = Override(default="Dropdown")
split = Bool(default=False, help="""
""")
menu ... | Dropdown |
python | walkccc__LeetCode | solutions/1766. Tree of Coprimes/1766.py | {
"start": 0,
"end": 865
} | class ____:
def getCoprimes(self, nums: list[int], edges: list[list[int]]) -> list[int]:
MAX = 50
ans = [-1] * len(nums)
tree = [[] for _ in range(len(nums))]
# stacks[i] := (node, depth)s of nodes with value i
stacks = [[] for _ in range(MAX + 1)]
for u, v in edges:
tree[u].append(v)
... | Solution |
python | ray-project__ray | python/ray/_private/thirdparty/pynvml/pynvml.py | {
"start": 89321,
"end": 90053
} | class ____(Structure):
_fields_ = [("vgpuVmCompatibility", _nvmlVgpuVmCompatibility_t),
("compatibilityLimitCode", _nvmlVgpuPgpuCompatibilityLimitCode_t)
]
## vGPU scheduler policy defines
NVML_VGPU_SCHEDULER_POLICY_UNKNOWN = 0
NVML_VGPU_SCHEDULER_POLICY_BEST_EFFORT = 1
NVML_VG... | c_nvmlVgpuPgpuCompatibility_t |
python | walkccc__LeetCode | solutions/1540. Can Convert String in K Moves/1540-2.py | {
"start": 0,
"end": 529
} | class ____:
def canConvertString(self, s: str, t: str, k: int) -> bool:
if len(s) != len(t):
return False
# e.g. s = "aab", t = "bbc", so shiftCount[1] = 3
# 1. a -> b, need 1 move.
# 2. a -> b, need 1 + 26 moves.
# 3. b -> c, need 1 + 26 * 2 moves.
shiftCount = [0] * 26
for a, b i... | Solution |
python | fsspec__filesystem_spec | fsspec/implementations/http.py | {
"start": 19177,
"end": 25641
} | class ____(AbstractBufferedFile):
"""
A file-like object pointing to a remote HTTP(S) resource
Supports only reading, with read-ahead of a predetermined block-size.
In the case that the server does not supply the filesize, only reading of
the complete file in one go is supported.
Parameters
... | HTTPFile |
python | redis__redis-py | redis/connection.py | {
"start": 43693,
"end": 46376
} | class ____(AbstractConnection):
"Manages TCP communication to and from a Redis server"
def __init__(
self,
host="localhost",
port=6379,
socket_keepalive=False,
socket_keepalive_options=None,
socket_type=0,
**kwargs,
):
self._host = host
... | Connection |
python | qdrant__qdrant-client | qdrant_client/http/models/models.py | {
"start": 139306,
"end": 140610
} | class ____(BaseModel, extra="forbid"):
type: "TextIndexType" = Field(..., description="")
tokenizer: Optional["TokenizerType"] = Field(default=None, description="")
min_token_len: Optional[int] = Field(default=None, description="Minimum characters to be tokenized.")
max_token_len: Optional[int] = Field(... | TextIndexParams |
python | plotly__plotly.py | plotly/graph_objs/contour/colorbar/_title.py | {
"start": 233,
"end": 3971
} | class ____(_BaseTraceHierarchyType):
_parent_path_str = "contour.colorbar"
_path_str = "contour.colorbar.title"
_valid_props = {"font", "side", "text"}
@property
def font(self):
"""
Sets this color bar's title font.
The 'font' property is an instance of Font
that ma... | Title |
python | encode__starlette | starlette/websockets.py | {
"start": 399,
"end": 576
} | class ____(Exception):
def __init__(self, code: int = 1000, reason: str | None = None) -> None:
self.code = code
self.reason = reason or ""
| WebSocketDisconnect |
python | huggingface__transformers | tests/models/umt5/test_modeling_umt5.py | {
"start": 8581,
"end": 14487
} | class ____(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (
(UMT5Model, UMT5ForConditionalGeneration, UMT5ForSequenceClassification, UMT5ForQuestionAnswering)
if is_torch_available()
else ()
)
pipeline_model_mapping = (
{... | UMT5ModelTest |
python | encode__django-rest-framework | tests/schemas/test_coreapi.py | {
"start": 17846,
"end": 17958
} | class ____(ExampleViewSet):
permission_classes = [DenyAllUsingPermissionDenied]
| PermissionDeniedExampleViewSet |
python | spack__spack | lib/spack/spack/test/stage.py | {
"start": 11692,
"end": 13578
} | class ____(spack.fetch_strategy.FetchStrategy):
def fetch(self):
raise spack.fetch_strategy.FailedDownloadError(
"<non-existent URL>", "This implementation of FetchStrategy always fails"
)
@pytest.fixture
def search_fn():
"""Returns a search function that always succeeds."""
c... | FailingFetchStrategy |
python | getsentry__sentry | tests/sentry/lang/javascript/test_sourcemaps.py | {
"start": 13168,
"end": 16072
} | class ____(TestCase):
# Tests lookups that fall exactly on source map token boundaries
# https://github.com/mozilla/source-map/blob/master/test/test-source-map-consumer.js#138
def test_exact_mappings(self) -> None:
smap_view = SourceMapView.from_json_bytes(indexed_sourcemap_example)
# one.j... | ParseIndexedSourcemapTest |
python | dagster-io__dagster | python_modules/dagster/dagster_tests/storage_tests/branching_io_manager_tests/utils.py | {
"start": 394,
"end": 2588
} | class ____:
"""Helper class for running asset-oriented tests. Handles threading
through the instance for you (this is easy to forget to do).
"""
def __init__(self, defs: Definitions, instance: DagsterInstance):
self.defs = defs
self.instance = instance
@staticmethod
@contextman... | DefinitionsRunner |
python | sqlalchemy__sqlalchemy | lib/sqlalchemy/dialects/oracle/vector.py | {
"start": 1603,
"end": 2072
} | class ____(Enum):
"""Enum representing the data format used to store vector components.
See :ref:`oracle_vector_datatype` for background.
.. versionadded:: 2.0.41
"""
INT8 = "INT8"
"""
8-bit integer format.
"""
BINARY = "BINARY"
"""
Binary format.
"""
FLOAT32 = "F... | VectorStorageFormat |
python | getsentry__sentry | src/sentry/models/grouphistory.py | {
"start": 6509,
"end": 13364
} | class ____(Model):
"""
This model is used to track certain status changes for groups,
and is designed to power a few types of queries:
- `resolved_in:release` syntax - we can query for entries with status=REGRESSION and matching release
- Time to Resolution and Age of Unresolved Issues-style queries... | GroupHistory |
python | django__django | tests/queries/models.py | {
"start": 10906,
"end": 11127
} | class ____(models.Model):
new_name = models.CharField(max_length=15)
category = models.OneToOneField(SimpleCategory, models.CASCADE)
def __str__(self):
return "one2one " + self.new_name
| OneToOneCategory |
python | numpy__numpy | tools/swig/test/testVector.py | {
"start": 10633,
"end": 10898
} | class ____(VectorTestCase):
def __init__(self, methodName="runTest"):
VectorTestCase.__init__(self, methodName)
self.typeStr = "schar"
self.typeCode = "b"
######################################################################
| scharTestCase |
python | html5lib__html5lib-python | html5lib/treebuilders/base.py | {
"start": 4149,
"end": 4859
} | class ____(list):
def append(self, node):
"""Append node to the end of the list."""
equalCount = 0
if node != Marker:
for element in self[::-1]:
if element == Marker:
break
if self.nodesEqual(element, node):
... | ActiveFormattingElements |
python | allegroai__clearml | clearml/backend_api/services/v2_23/projects.py | {
"start": 37777,
"end": 42151
} | class ____(Request):
"""
Create a new project
:param name: Project name Unique within the company.
:type name: str
:param description: Project description.
:type description: str
:param tags: User-defined tags
:type tags: Sequence[str]
:param system_tags: System tags. This field is ... | CreateRequest |
python | getsentry__sentry | tests/sentry/integrations/msteams/test_notify_action.py | {
"start": 1000,
"end": 15172
} | class ____(RuleTestCase, PerformanceIssueTestCase):
rule_cls = MsTeamsNotifyServiceAction
def setUp(self) -> None:
event = self.get_event()
self.integration, _ = self.create_provider_integration_for(
event.project.organization,
self.user,
provider="msteams",... | MsTeamsNotifyActionTest |
python | PyCQA__isort | scripts/build_config_option_docs.py | {
"start": 1387,
"end": 9895
} | class ____:
section_complete: str = ""
cfg: str = ""
pyproject_toml: str = ""
cli: str = ""
def __post_init__(self):
if self.cfg or self.pyproject_toml or self.cli:
if self.cfg:
cfg = dedent(self.cfg).lstrip()
self.cfg = (
dede... | Example |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-webflow/source_webflow/auth.py | {
"start": 705,
"end": 893
} | class ____(WebflowAuthMixin, TokenAuthenticator):
"""
Authentication class information
https://docs.developers.webflow.com/reference/authorization
"""
| WebflowTokenAuthenticator |
python | numpy__numpy | numpy/_core/tests/test_umath.py | {
"start": 90152,
"end": 91961
} | class ____(_FilterInvalids):
def test_logaddexp_values(self):
x = [1, 2, 3, 4, 5]
y = [5, 4, 3, 2, 1]
z = [6, 6, 6, 6, 6]
for dt, dec_ in zip(['f', 'd', 'g'], [6, 15, 15]):
xf = np.log(np.array(x, dtype=dt))
yf = np.log(np.array(y, dtype=dt))
zf = ... | TestLogAddExp |
python | bokeh__bokeh | src/bokeh/document/events.py | {
"start": 9644,
"end": 12691
} | class ____(DocumentPatchedEvent):
''' A concrete event representing updating an attribute and value of a
specific Bokeh Model.
'''
kind = "ModelChanged"
def __init__(self, document: Document, model: Model, attr: str, new: Any,
setter: Setter | None = None, callback_invoker: Invoker | ... | ModelChangedEvent |
python | automl__auto-sklearn | autosklearn/pipeline/implementations/MinorityCoalescer.py | {
"start": 103,
"end": 2861
} | class ____(BaseEstimator, TransformerMixin):
"""Group together categories which occurence is less than a specified
minimum fraction. Coalesced categories get index of one.
"""
def __init__(self, minimum_fraction=None):
self.minimum_fraction = minimum_fraction
def check_X(self, X):
... | MinorityCoalescer |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 555983,
"end": 556453
} | class ____(sgqlc.types.Type):
"""Autogenerated return type of DeleteLinkedBranch"""
__schema__ = github_schema
__field_names__ = ("client_mutation_id", "issue")
client_mutation_id = sgqlc.types.Field(String, graphql_name="clientMutationId")
"""A unique identifier for the client performing the mutat... | DeleteLinkedBranchPayload |
python | eth-brownie__brownie | brownie/exceptions.py | {
"start": 5363,
"end": 5418
} | class ____(LookupError):
pass
@final
| EventLookupError |
python | getsentry__sentry | src/sentry/migrations/0989_add_release_date_added_idx.py | {
"start": 184,
"end": 1505
} | class ____(CheckedMigration):
# This flag is used to mark that a migration shouldn't be automatically run in production.
# This should only be used for operations where it's safe to run the migration after your
# code has deployed. So this should not be used for most operations that alter the schema
# o... | Migration |
python | pytorch__pytorch | test/higher_order_ops/test_invoke_subgraph.py | {
"start": 73630,
"end": 75927
} | class ____(torch.nn.Module):
def forward(self, s77: "Sym(s77)", L_x_: "f32[s77, 8]"):
l_x_ = L_x_
subgraph_0 = self.subgraph_0
invoke_subgraph = torch.ops.higher_order.invoke_subgraph(subgraph_0, 'subgraph_0', s77, l_x_); subgraph_0 = l_x_ = None
a: "f32[s77, 8]" = invoke_subgraph[... | GraphModule |
python | django__django | django/contrib/gis/gdal/geometries.py | {
"start": 20429,
"end": 21614
} | class ____(OGRGeometry):
def _geos_ptr(self):
from django.contrib.gis import geos
return geos.Point._create_empty() if self.empty else super()._geos_ptr()
@classmethod
def _create_empty(cls):
return capi.create_geom(OGRGeomType("point").num)
@property
def x(self):
... | Point |
python | getsentry__sentry | src/sentry/workflow_engine/handlers/condition/latest_release_handler.py | {
"start": 1637,
"end": 4385
} | class ____(CacheAccess[Release | Literal[False]]):
"""
If we have a latest adopted release for a project in an environment, we cache it.
If we don't, we cache False.
"""
def __init__(self, event: GroupEvent, environment: Environment):
self._key = latest_adopted_release_cache_key(event.group... | _LatestAdoptedReleaseCacheAccess |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/typeAliasType2.py | {
"start": 1387,
"end": 1705
} | class ____(Generic[T1]):
L = TypeAliasType("L", list[T1])
a1: A[int].L = [1, 2, 3]
a2: A[str].L = ["1", "2", "3"]
# This should generate an error because S is not in scope.
TA8 = TypeAliasType("TA8", list[S])
def identity[T](t: T) -> T:
return t
reveal_type(identity(TA1), expected_text="TypeAliasType")
... | A |
python | django__django | tests/custom_managers/models.py | {
"start": 950,
"end": 1550
} | class ____(models.QuerySet):
def filter(self, *args, **kwargs):
queryset = super().filter(fun=True)
queryset._filter_CustomQuerySet = True
return queryset
def public_method(self, *args, **kwargs):
return self.all()
def _private_method(self, *args, **kwargs):
return ... | CustomQuerySet |
python | google__flatbuffers | python/flatbuffers/flexbuffers.py | {
"start": 9559,
"end": 9825
} | class ____:
"""Base class for all non-trivial data accessors."""
__slots__ = '_buf', '_byte_width'
def __init__(self, buf, byte_width):
self._buf = buf
self._byte_width = byte_width
@property
def ByteWidth(self):
return self._byte_width
| Object |
python | readthedocs__readthedocs.org | readthedocs/rtd_tests/tests/test_project_views.py | {
"start": 25824,
"end": 27371
} | class ____(TestCase):
def setUp(self):
self.user = get(User)
self.project = get(Project, slug="test", users=[self.user])
self.version = get(Version, slug="1.0", project=self.project)
self.email_notification = get(EmailHook, project=self.project)
self.client.force_login(self.u... | TestProjectEmailNotifications |
python | conda__conda | conda/plugins/types.py | {
"start": 9482,
"end": 9961
} | class ____(CondaPlugin):
"""
Return type to use when defining a conda post-solve plugin hook.
For details on how this is used, see
:meth:`~conda.plugins.hookspec.CondaSpecs.conda_post_solves`.
:param name: Post-solve name (e.g., ``custom_plugin_post_solve``).
:param action: Callable which cont... | CondaPostSolve |
python | astropy__astropy | astropy/cosmology/_src/tests/io/test_connect.py | {
"start": 9363,
"end": 10478
} | class ____(ToFromFormatTestMixin):
"""Test Cosmology[To/From]Format classes."""
@pytest.fixture(scope="class", params=cosmo_instances)
def cosmo(self, request):
return getattr(cosmology.realizations, request.param)
@pytest.fixture(scope="class")
def cosmo_cls(self, cosmo):
return c... | TestCosmologyToFromFormat |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/protocol6.py | {
"start": 284,
"end": 349
} | class ____(Mammal[_T3], Protocol):
type_of_hooves: _T3
| Ungulate |
python | spack__spack | lib/spack/spack/vendor/ruamel/yaml/error.py | {
"start": 400,
"end": 1305
} | class ____:
__slots__ = 'name', 'index', 'line', 'column'
def __init__(self, name, index, line, column):
# type: (Any, int, int, int) -> None
self.name = name
self.index = index
self.line = line
self.column = column
def __str__(self):
# type: () -> Any
... | StreamMark |
python | pytorch__pytorch | torch/_subclasses/meta_utils.py | {
"start": 22234,
"end": 30348
} | class ____(Generic[_TensorT]):
id: MetaTensorId
ndim: int
dtype: torch.dtype
device: torch.device
# NB: Sometimes, size, stride and storage_offset contain SymInt, in which
# case this is NOT serializable. That only happens when you're
# re-fakeifying a fake tensor with an existing ShapeEnv... | MetaTensorDesc |
python | run-llama__llama_index | llama-index-integrations/storage/index_store/llama-index-storage-index-store-tablestore/llama_index/storage/index_store/tablestore/base.py | {
"start": 187,
"end": 1672
} | class ____(KVIndexStore):
"""
Tablestore Index store.
Args:
tablestore_kvstore (TablestoreKVStore): Tablestore key-value store
namespace (str): namespace for the index store
collection_suffix (str): suffix for the table name
"""
def __init__(
self,
tablesto... | TablestoreIndexStore |
python | joke2k__faker | tests/providers/test_date_time.py | {
"start": 42776,
"end": 43128
} | class ____(unittest.TestCase):
def setUp(self):
self.fake = Faker("nl_NL")
Faker.seed(0)
def test_day(self):
day = self.fake.day_of_week()
assert day in NlProvider.DAY_NAMES.values()
def test_month(self):
month = self.fake.month_name()
assert month in NlProv... | TestNlNl |
python | django__django | django/contrib/admin/views/autocomplete.py | {
"start": 257,
"end": 4385
} | class ____(BaseListView):
"""Handle AutocompleteWidget's AJAX requests for data."""
paginate_by = 20
admin_site = None
def get(self, request, *args, **kwargs):
"""
Return a JsonResponse with search results as defined in
serialize_result(), by default:
{
resu... | AutocompleteJsonView |
python | readthedocs__readthedocs.org | readthedocs/projects/views/private.py | {
"start": 7600,
"end": 7931
} | class ____(SuccessMessageMixin, PrivateViewMixin):
"""Common pieces for model views of Project."""
model = Project
lookup_url_kwarg = "project_slug"
lookup_field = "slug"
context_object_name = "project"
def get_queryset(self):
return self.model.objects.for_admin_user(self.request.user)... | ProjectMixin |
python | kamyu104__LeetCode-Solutions | Python/single-row-keyboard.py | {
"start": 29,
"end": 393
} | class ____(object):
def calculateTime(self, keyboard, word):
"""
:type keyboard: str
:type word: str
:rtype: int
"""
lookup = {c:i for i, c in enumerate(keyboard)}
result, prev = 0, 0
for c in word:
result += abs(lookup[c]-prev)
... | Solution |
python | run-llama__llama_index | llama-index-integrations/readers/llama-index-readers-confluence/llama_index/readers/confluence/event.py | {
"start": 136,
"end": 420
} | class ____(Enum):
IMAGE = "image"
DOCUMENT = "document"
TEXT = "text"
HTML = "html"
CSV = "csv"
MARKDOWN = "md"
SPREADSHEET = "spreadsheet"
PRESENTATION = "presentation"
PDF = "pdf"
UNKNOWN = "unknown"
# LlamaIndex instrumentation events
| FileType |
python | google__pytype | pytype/matcher.py | {
"start": 4659,
"end": 5577
} | class ____:
"""Collection of TypeParameter objects encountered during matching."""
def __init__(self):
self.seen = set()
self._mutually_exclusive = collections.defaultdict(set)
def add_mutually_exclusive_groups(self, groups):
"""Adds groups of mutually exclusive type parameters.
For example, [{... | _TypeParams |
python | modin-project__modin | modin/core/execution/dispatching/factories/factories.py | {
"start": 23958,
"end": 24137
} | class ____(BaseFactory):
@classmethod
@doc(_doc_factory_prepare_method, io_module_name="`NativeIO`")
def prepare(cls):
cls.io_cls = NativeIO
| NativeOnNativeFactory |
python | doocs__leetcode | solution/3100-3199/3173.Bitwise OR of Adjacent Elements/Solution.py | {
"start": 0,
"end": 119
} | class ____:
def orArray(self, nums: List[int]) -> List[int]:
return [a | b for a, b in pairwise(nums)]
| Solution |
python | realpython__materials | django-markdown/dmd_app/migrations/0001_initial.py | {
"start": 92,
"end": 817
} | class ____(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.CreateModel(
name="MarkdownContent",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
... | Migration |
python | getsentry__sentry | tests/snuba/rules/conditions/test_event_frequency.py | {
"start": 52369,
"end": 52639
} | class ____(
PerfIssuePlatformEventMixin,
EventUniqueUserFrequencyConditionTestCase,
):
pass
@freeze_time(
(timezone.now() - timedelta(days=2)).replace(hour=12, minute=40, second=0, microsecond=0)
)
| PerfIssuePlatformIssueUniqueUserFrequencyConditionTestCase |
python | allegroai__clearml | clearml/backend_api/services/v2_23/dataviews.py | {
"start": 135009,
"end": 137798
} | class ____(Request):
"""
Move dataviews to a project
:param ids: Dataviews to move
:type ids: Sequence[str]
:param project: Target project ID. If not provided, `project_name` must be
provided. Use null for the root project
:type project: str
:param project_name: Target project name.... | MoveRequest |
python | pytorch__pytorch | torch/_functorch/_aot_autograd/aot_autograd_result.py | {
"start": 7891,
"end": 8066
} | class ____(FxGraphCacheLoadable):
"""
Cacheable entry for a forward function
"""
def _is_backward(self) -> bool:
return False
@dataclass
| CompiledForward |
python | pennersr__django-allauth | allauth/idp/oidc/migrations/0001_initial.py | {
"start": 170,
"end": 6106
} | class ____(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name="Client",
fields=[
(
"id",
models.... | Migration |
python | doocs__leetcode | solution/2200-2299/2218.Maximum Value of K Coins From Piles/Solution.py | {
"start": 0,
"end": 477
} | class ____:
def maxValueOfCoins(self, piles: List[List[int]], k: int) -> int:
n = len(piles)
f = [[0] * (k + 1) for _ in range(n + 1)]
for i, nums in enumerate(piles, 1):
s = list(accumulate(nums, initial=0))
for j in range(k + 1):
for h, w in enumerat... | Solution |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.