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 | sqlalchemy__sqlalchemy | lib/sqlalchemy/dialects/mssql/base.py | {
"start": 41011,
"end": 41077
} | class ____(TIME):
__visit_name__ = "_BASETIMEIMPL"
| _BASETIMEIMPL |
python | PrefectHQ__prefect | src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py | {
"start": 607952,
"end": 608589
} | class ____(sgqlc.types.relay.Connection):
"""
See source code for more info.
"""
__schema__ = graphql_schema
__field_names__ = ("edges", "nodes", "page_info", "total_count")
edges = sgqlc.types.Field(
sgqlc.types.list_of("ReviewRequestEdge"), graphql_name="edges"
)
nodes = sgqlc... | ReviewRequestConnection |
python | sphinx-doc__sphinx | sphinx/util/_inventory_file_reader.py | {
"start": 442,
"end": 2027
} | class ____:
"""A file reader for an inventory file.
This reader supports mixture of texts and compressed texts.
"""
def __init__(self, stream: _SupportsRead) -> None:
self.stream = stream
self.buffer = b''
self.eof = False
def read_buffer(self) -> None:
chunk = sel... | InventoryFileReader |
python | django__django | tests/test_utils/tests.py | {
"start": 8952,
"end": 13087
} | class ____(TestCase):
@classmethod
def setUpTestData(cls):
cls.p1 = Person.objects.create(name="p1")
cls.p2 = Person.objects.create(name="p2")
def test_empty(self):
self.assertQuerySetEqual(Person.objects.filter(name="p3"), [])
def test_ordered(self):
self.assertQuerySe... | AssertQuerySetEqualTests |
python | apache__airflow | airflow-core/src/airflow/executors/executor_utils.py | {
"start": 966,
"end": 2417
} | class ____(LoggingMixin):
"""Representation of an executor config/name."""
def __init__(self, module_path: str, alias: str | None = None, team_name: str | None = None) -> None:
self.module_path: str = module_path
self.alias: str | None = alias
self.team_name: str | None = team_name
... | ExecutorName |
python | getsentry__sentry | tests/sentry/api/endpoints/test_project_transaction_threshold.py | {
"start": 177,
"end": 6641
} | class ____(APITestCase):
feature_name = "organizations:performance-view"
def setUp(self) -> None:
super().setUp()
self.login_as(user=self.user)
self.project = self.create_project()
self.url = reverse(
"sentry-api-0-project-transaction-threshold",
kwargs... | ProjectTransactionThresholdTest |
python | doocs__leetcode | solution/1700-1799/1703.Minimum Adjacent Swaps for K Consecutive Ones/Solution.py | {
"start": 0,
"end": 524
} | class ____:
def minMoves(self, nums: List[int], k: int) -> int:
arr = [i for i, x in enumerate(nums) if x]
s = list(accumulate(arr, initial=0))
ans = inf
x = (k + 1) // 2
y = k - x
for i in range(x - 1, len(arr) - y):
j = arr[i]
ls = s[i + 1] -... | Solution |
python | pytorch__pytorch | test/jit/test_backends.py | {
"start": 17803,
"end": 18198
} | class ____(torch.nn.Module):
"""
A simple add Module used to test to_backend lowering machinery.
"""
def forward(self, x, h):
return x + h
# This is ignored in IS_WINDOWS or IS_MACOS cases. Hence we need the one in TestBackends.
@unittest.skipIf(
IS_SANDCASTLE or IS_WINDOWS or IS_MACOS or... | BasicModuleAdd |
python | chroma-core__chroma | chromadb/proto/convert.py | {
"start": 894,
"end": 1036
} | class ____(TypedDict):
id: str
document: Optional[str]
embedding: Optional[Vector]
metadata: Optional[Metadata]
| ProjectionRecord |
python | huggingface__transformers | src/transformers/models/shieldgemma2/processing_shieldgemma2.py | {
"start": 2207,
"end": 8484
} | class ____(Gemma3Processor):
def __init__(
self, image_processor, tokenizer, chat_template=None, image_seq_length=256, policy_definitions=None, **kwargs
):
"""A processor for the ShieldGemma 2 model.
Args:
image_processor: The image processor to use, typically a `Gemma3Image... | ShieldGemma2Processor |
python | tensorflow__tensorflow | tensorflow/python/kernel_tests/math_ops/matmul_op_test.py | {
"start": 3556,
"end": 5162
} | class ____(test_lib.TestCase):
pass # Filled in below
def _GetMatMulTest(a_np_, b_np_, use_static_shape_, **kwargs_):
@test_util.run_without_tensor_float_32("Tests matmul")
def Test(self):
np_val = np.matrix(a_np_) * np.matrix(b_np_)
use_gpu = True
if a_np_.dtype is np.float16 and (
not t... | MatMulTest |
python | apache__airflow | providers/google/src/airflow/providers/google/cloud/operators/vertex_ai/dataset.py | {
"start": 14524,
"end": 18827
} | class ____(GoogleCloudBaseOperator, DatasetImportDataResultsCheckHelper):
"""
Imports data into a Dataset.
:param project_id: Required. The ID of the Google Cloud project the cluster belongs to.
:param region: Required. The Cloud Dataproc region in which to handle the request.
:param dataset_id: Re... | ImportDataOperator |
python | ray-project__ray | python/ray/_private/thirdparty/dacite/exceptions.py | {
"start": 2275,
"end": 2587
} | class ____(DaciteError):
def __init__(self, keys: Set[str]) -> None:
super().__init__()
self.keys = keys
def __str__(self) -> str:
formatted_keys = ", ".join(f'"{key}"' for key in self.keys)
return f"can not match {formatted_keys} to any data class field"
| UnexpectedDataError |
python | facebook__pyre-check | client/commands/tests/check_test.py | {
"start": 476,
"end": 1857
} | class ____(testslide.TestCase):
def test_serialize_arguments(self) -> None:
def assert_serialized(
arguments: check.Arguments, items: Iterable[Tuple[str, object]]
) -> None:
serialized = arguments.serialize()
for key, value in items:
if key not in ... | ArgumentTest |
python | getsentry__sentry | src/sentry/plugins/bases/issue.py | {
"start": 731,
"end": 942
} | class ____(forms.Form):
title = forms.CharField(max_length=200, widget=forms.TextInput(attrs={"class": "span9"}))
description = forms.CharField(widget=forms.Textarea(attrs={"class": "span9"}))
| NewIssueForm |
python | django__django | tests/check_framework/test_security.py | {
"start": 19689,
"end": 20042
} | class ____(SimpleTestCase):
@override_settings(ALLOWED_HOSTS=[])
def test_allowed_hosts_empty(self):
self.assertEqual(base.check_allowed_hosts(None), [base.W020])
@override_settings(ALLOWED_HOSTS=[".example.com"])
def test_allowed_hosts_set(self):
self.assertEqual(base.check_allowed_hos... | CheckAllowedHostsTest |
python | walkccc__LeetCode | solutions/62. Unique Paths/62-2.py | {
"start": 0,
"end": 185
} | class ____:
def uniquePaths(self, m: int, n: int) -> int:
dp = [1] * n
for _ in range(1, m):
for j in range(1, n):
dp[j] += dp[j - 1]
return dp[n - 1]
| Solution |
python | geekcomputers__Python | venv/Lib/site-packages/pip/_internal/index/package_finder.py | {
"start": 12144,
"end": 12365
} | class ____:
"""
Encapsulates some of the preferences for filtering and sorting
InstallationCandidate objects.
"""
prefer_binary: bool = False
allow_all_prereleases: bool = False
| CandidatePreferences |
python | gevent__gevent | src/gevent/tests/test__pywsgi.py | {
"start": 3026,
"end": 6582
} | class ____(object):
def __init__(self, status_line, headers):
self.status_line = status_line
self.headers = headers
self.body = None
self.chunks = False
try:
version, code, self.reason = status_line[:-2].split(' ', 2)
self.code = int(code)
... | Response |
python | vyperlang__vyper | vyper/exceptions.py | {
"start": 7712,
"end": 7806
} | class ____(VyperException):
"""Invalid variable declaration."""
| VariableDeclarationException |
python | django__django | django/template/library.py | {
"start": 340,
"end": 9345
} | class ____:
"""
A class for registering template tags and filters. Compiled filter and
template tag functions are stored in the filters and tags attributes.
The filter, simple_tag, and inclusion_tag methods provide a convenient
way to register callables as tags.
"""
def __init__(self):
... | Library |
python | wandb__wandb | wandb/vendor/pygments/lexers/jvm.py | {
"start": 38639,
"end": 40417
} | class ____(RegexLexer):
"""
For `Tea <http://teatrove.org/>`_ source code. Only used within a
TeaTemplateLexer.
.. versionadded:: 1.5
"""
flags = re.MULTILINE | re.DOTALL
tokens = {
'root': [
# method names
(r'^(\s*(?:[a-zA-Z_][\w\.\[\]]*\s+)+?)' # return ... | TeaLangLexer |
python | PrefectHQ__prefect | src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py | {
"start": 339134,
"end": 339497
} | class ____(sgqlc.types.Type):
"""
See source code for more info.
"""
__schema__ = graphql_schema
__field_names__ = ("cursor", "node")
cursor = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name="cursor")
node = sgqlc.types.Field("EnterpriseServerUserAccountsUpload", graphql_name="... | EnterpriseServerUserAccountsUploadEdge |
python | getsentry__sentry | src/sentry/users/api/serializers/userrole.py | {
"start": 352,
"end": 538
} | class ____(TypedDict):
id: str
name: str
permissions: list[str]
dateCreated: datetime | None
dateUpdated: datetime | None
@register(UserRole)
| UserRoleSerializerResponse |
python | django__django | tests/ordering/models.py | {
"start": 1733,
"end": 1888
} | class ____(models.Model):
name = models.CharField(max_length=30)
class Meta:
ordering = [models.functions.Lower("name")]
| OrderedByExpression |
python | openai__openai-python | src/openai/types/beta/realtime/session_create_params.py | {
"start": 6612,
"end": 6918
} | class ____(TypedDict, total=False):
type: Literal["near_field", "far_field"]
"""Type of noise reduction.
`near_field` is for close-talking microphones such as headphones, `far_field` is
for far-field microphones such as laptop or conference room microphones.
"""
| InputAudioNoiseReduction |
python | wandb__wandb | wandb/vendor/pygments/lexers/javascript.py | {
"start": 32547,
"end": 41335
} | class ____(RegexLexer):
"""
For Objective-J source code with preprocessor directives.
.. versionadded:: 1.3
"""
name = 'Objective-J'
aliases = ['objective-j', 'objectivej', 'obj-j', 'objj']
filenames = ['*.j']
mimetypes = ['text/x-objective-j']
#: optional Comment or Whitespace
... | ObjectiveJLexer |
python | scipy__scipy | scipy/linalg/tests/test_cython_lapack.py | {
"start": 132,
"end": 796
} | class ____:
def test_slamch(self):
for c in [b'e', b's', b'b', b'p', b'n', b'r', b'm', b'u', b'l', b'o']:
assert_allclose(cython_lapack._test_slamch(c),
lapack.slamch(c))
def test_dlamch(self):
for c in [b'e', b's', b'b', b'p', b'n', b'r', b'm', b'u', b'... | TestLamch |
python | getsentry__sentry-python | tests/integrations/litellm/test_litellm.py | {
"start": 2649,
"end": 2827
} | class ____:
def __init__(self, embedding=None):
self.embedding = embedding or [0.1, 0.2, 0.3]
self.index = 0
self.object = "embedding"
| MockEmbeddingData |
python | ray-project__ray | rllib/core/rl_module/torch/tests/test_torch_rl_module.py | {
"start": 453,
"end": 3732
} | class ____(unittest.TestCase):
def test_compilation(self):
env = gym.make("CartPole-v1")
module = VPGTorchRLModule(
observation_space=env.observation_space,
action_space=env.action_space,
model_config={"hidden_dim": 32},
)
self.assertIsInstance(m... | TestRLModule |
python | vyperlang__vyper | vyper/ast/nodes.py | {
"start": 23840,
"end": 24624
} | class ____(VyperNode):
__slots__ = ("_expr_info",)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._expr_info = None
def to_dict(self):
ret = super().to_dict()
if self.has_folded_value and self.get_folded_value() != self:
ret["folded... | ExprNode |
python | fastai__fastai | fastai/tabular/core.py | {
"start": 15915,
"end": 16587
} | class ____(TfmdDL):
"A transformed `DataLoader` for Tabular data"
def __init__(self, dataset, bs=16, shuffle=False, after_batch=None, num_workers=0, **kwargs):
if after_batch is None: after_batch = L(TransformBlock().batch_tfms)+ReadTabBatch(dataset)
super().__init__(dataset, bs=bs, shuffle=shuf... | TabDataLoader |
python | python-visualization__folium | folium/map.py | {
"start": 562,
"end": 768
} | class ____:
def __init__(self, f):
self.f = f
def __get__(self, obj, owner):
return self.f(owner)
if TYPE_CHECKING:
from folium.features import CustomIcon, DivIcon
| classproperty |
python | keras-team__keras | keras/src/saving/saving_lib_test.py | {
"start": 3569,
"end": 3776
} | class ____(keras.Sequential):
def compile(self, *args, **kwargs):
super().compile(*args, **kwargs)
@keras.saving.register_keras_serializable(package="my_custom_package")
| CompileOverridingSequential |
python | PrefectHQ__prefect | src/prefect/client/orchestration/_logs/client.py | {
"start": 1654,
"end": 2996
} | class ____(BaseAsyncClient):
async def create_logs(
self, logs: Iterable[Union["LogCreate", dict[str, Any]]]
) -> None:
"""
Create logs for a flow or task run
Args:
logs: An iterable of `LogCreate` objects or already json-compatible dicts
"""
from pre... | LogAsyncClient |
python | pandas-dev__pandas | pandas/tests/indexing/test_partial.py | {
"start": 24131,
"end": 25040
} | class ____:
def test_slice_irregular_datetime_index_with_nan(self):
# GH36953
index = pd.to_datetime(["2012-01-01", "2012-01-02", "2012-01-03", None])
df = DataFrame(range(len(index)), index=index)
expected = DataFrame(range(len(index[:3])), index=index[:3])
with pytest.raise... | TestStringSlicing |
python | plotly__plotly.py | plotly/graph_objs/bar/_marker.py | {
"start": 233,
"end": 25123
} | class ____(_BaseTraceHierarchyType):
_parent_path_str = "bar"
_path_str = "bar.marker"
_valid_props = {
"autocolorscale",
"cauto",
"cmax",
"cmid",
"cmin",
"color",
"coloraxis",
"colorbar",
"colorscale",
"colorsrc",
"corn... | Marker |
python | bottlepy__bottle | bottle.py | {
"start": 135656,
"end": 135848
} | class ____(ServerAdapter):
def run(self, handler):
from waitress import serve
serve(handler, host=self.host, port=self.port, _quiet=self.quiet, **self.options)
| WaitressServer |
python | PyCQA__pylint | doc/data/messages/i/invalid-format-returned/good.py | {
"start": 0,
"end": 126
} | class ____:
"""__format__ returns <type 'str'>"""
def __format__(self, format_spec):
return "hello!"
| CustomFormat |
python | pypa__pip | src/pip/_internal/models/pylock.py | {
"start": 893,
"end": 1083
} | class ____:
type: str
url: str | None
# (not supported) path: Optional[str]
requested_revision: str | None
commit_id: str
subdirectory: str | None
@dataclass
| PackageVcs |
python | zostera__django-bootstrap4 | example/app/views.py | {
"start": 476,
"end": 579
} | class ____:
storage = default_storage
fieldfile = FieldFile(None, FakeField, "dummy.txt")
| FakeField |
python | airbytehq__airbyte | airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/test/models.py | {
"start": 155,
"end": 1835
} | class ____(BaseModel):
poe_tasks: Set[str] = Field(..., description="List of unique poe tasks to run")
required_environment_variables: Set[str] = Field(
set(), description="List of unique required environment variables to pass to the container running the poe task"
)
poetry_extras: Set[str] = Fi... | AirbyteCiPackageConfiguration |
python | Netflix__metaflow | metaflow/events.py | {
"start": 673,
"end": 5300
} | class ____(object):
"""
Defines a container of event triggers' metadata.
"""
def __init__(self, _meta=None):
if _meta is None:
_meta = []
_meta.sort(key=lambda x: x.get("timestamp") or float("-inf"), reverse=True)
self._runs = None
self._events = [
... | Trigger |
python | readthedocs__readthedocs.org | readthedocs/rtd_tests/tests/test_project.py | {
"start": 1381,
"end": 9605
} | class ____(ProjectMixin, TestCase):
def test_subprojects(self):
r = self.client.get("/api/v2/project/6/subprojects/", {})
resp = json.loads(r.content)
self.assertEqual(r.status_code, 200)
self.assertEqual(resp["subprojects"][0]["id"], 23)
@patch("readthedocs.projects.models.Proj... | TestProject |
python | pikepdf__pikepdf | src/pikepdf/canvas.py | {
"start": 4270,
"end": 15411
} | class ____(DimensionedFont):
"""Font implementation designed to work with Type 1 Fonts and TrueType fonts.
As described in section 9.6 of the PDF spec.
See also section 9.8: Font Descriptors.
The PDF spec also considers Type3 fonts to be "Simple Fonts", but Type3 fonts are
not implemented here.
... | SimpleFont |
python | sqlalchemy__sqlalchemy | test/orm/test_attributes.py | {
"start": 91649,
"end": 97728
} | class ____(fixtures.ORMTest):
@testing.fixture
def dict_collection(self):
class Foo(BasicEntity):
pass
class Bar(BasicEntity):
def __init__(self, name):
self.name = name
instrumentation.register_class(Foo)
instrumentation.register_class(B... | CollectionKeyTest |
python | kubernetes-client__python | kubernetes/client/models/v1_success_policy_rule.py | {
"start": 383,
"end": 7177
} | 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... | V1SuccessPolicyRule |
python | huggingface__transformers | tests/models/clip/test_modeling_clip.py | {
"start": 23324,
"end": 24176
} | class ____(CLIPModelTester):
def __init__(self, parent):
super().__init__(parent)
self.batch_size = self.vision_model_tester.batch_size
self.num_hidden_layers = self.vision_model_tester.num_hidden_layers
self.hidden_size = self.vision_model_tester.hidden_size
self.seq_length ... | CLIPForImageClassificationModelTester |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/solver30.py | {
"start": 409,
"end": 776
} | class ____(Iterator[Z]):
def __init__(self, a: Callable[[Z], Any], b: Iterable[Z]) -> None: ...
def __next__(self) -> Z: ...
def func4(a: Callable[[Z], Any], b: Iterable[Z]) -> Iterator[Z]: ...
func1(func2(func3(lambda x: reveal_type(x.foo, expected_text="bool"), items)))
func1(func2(func4(lambda x: revea... | func3 |
python | Netflix__metaflow | test/core/tests/timeout_decorator.py | {
"start": 72,
"end": 1328
} | class ____(MetaflowTest):
"""
Test that checks that the timeout decorator works as intended.
"""
PRIORITY = 2
SKIP_GRAPHS = [
"simple_switch",
"nested_switch",
"branch_in_switch",
"foreach_in_switch",
"switch_in_branch",
"switch_in_foreach",
"... | TimeoutDecoratorTest |
python | python-poetry__poetry | src/poetry/inspection/lazy_wheel.py | {
"start": 3663,
"end": 5741
} | class ____:
"""Stateful bookkeeping to merge interval graphs."""
def __init__(self, *, left: Iterable[int] = (), right: Iterable[int] = ()) -> None:
self._left = list(left)
self._right = list(right)
def __repr__(self) -> str:
return (
f"{type(self).__name__}"
... | MergeIntervals |
python | allegroai__clearml | examples/frameworks/keras/keras_tensorboard.py | {
"start": 744,
"end": 4356
} | class ____(TensorBoard):
@staticmethod
def make_image(tensor):
from PIL import Image
import io
tensor = np.stack((tensor, tensor, tensor), axis=2)
height, width, channels = tensor.shape
image = Image.fromarray(tensor)
output = io.BytesIO()
image.save(outpu... | TensorBoardImage |
python | keras-team__keras | keras/src/layers/normalization/rms_normalization_test.py | {
"start": 121,
"end": 1982
} | class ____(testing.TestCase):
@pytest.mark.requires_trainable_backend
def test_ln_basics(self):
self.run_layer_test(
layers.RMSNormalization,
init_kwargs={},
input_shape=(4, 2),
expected_output_shape=(4, 2),
expected_num_trainable_weights=1,
... | RMSNormalizationTest |
python | readthedocs__readthedocs.org | readthedocs/projects/migrations/0140_addons_options_base_version.py | {
"start": 183,
"end": 1310
} | class ____(migrations.Migration):
safe = Safe.before_deploy()
dependencies = [
("builds", "0059_add_version_date_index"),
("projects", "0139_addons_filetreediff_field"),
]
operations = [
migrations.AddField(
model_name="addonsconfig",
name="options_base_... | Migration |
python | sqlalchemy__sqlalchemy | lib/sqlalchemy/sql/elements.py | {
"start": 178068,
"end": 178186
} | class ____(_IdentifiedClause):
__visit_name__ = "release_savepoint"
inherit_cache = False
| ReleaseSavepointClause |
python | pypa__pip | tests/unit/test_resolution_legacy_resolver.py | {
"start": 2441,
"end": 4732
} | class ____:
"""
Test _add_requirement_to_set().
"""
def test_unsupported_wheel_link_requirement_raises(
self, monkeypatch: pytest.MonkeyPatch
) -> None:
# GIVEN
resolver = make_test_resolver(monkeypatch, [])
requirement_set = RequirementSet(check_supported_wheels=Tru... | TestAddRequirement |
python | numba__numba | numba/core/typing/builtins.py | {
"start": 22217,
"end": 22382
} | class ____(AttributeTemplate):
key = types.NPDatetime
def resolve___class__(self, ty):
return types.NumberClass(ty)
@infer_getattr
| NPDatetimeAttribute |
python | spack__spack | lib/spack/spack/dependency.py | {
"start": 362,
"end": 2851
} | class ____:
"""Class representing metadata for a dependency on a package.
This class differs from ``spack.spec.DependencySpec`` because it
represents metadata at the ``Package`` level.
``spack.spec.DependencySpec`` is a descriptor for an actual package
configuration, while ``Dependency`` is a descr... | Dependency |
python | encode__django-rest-framework | tests/test_bound_fields.py | {
"start": 76,
"end": 3660
} | class ____:
def test_empty_bound_field(self):
class ExampleSerializer(serializers.Serializer):
text = serializers.CharField(max_length=100)
amount = serializers.IntegerField()
serializer = ExampleSerializer()
assert serializer['text'].value == ''
assert seri... | TestSimpleBoundField |
python | pennersr__django-allauth | allauth/headless/mfa/inputs.py | {
"start": 633,
"end": 719
} | class ____(GenerateRecoveryCodesForm, inputs.Input):
pass
| GenerateRecoveryCodesInput |
python | sympy__sympy | sympy/physics/quantum/tests/test_state.py | {
"start": 1198,
"end": 6748
} | class ____(TimeDepKet):
@classmethod
def default_args(self):
return ("r", "theta", "phi", "t")
def test_ket():
k = Ket('0')
assert isinstance(k, Ket)
assert isinstance(k, KetBase)
assert isinstance(k, StateBase)
assert isinstance(k, QExpr)
assert k.label == (Symbol('0'),)
... | CustomTimeDepKetMultipleLabels |
python | fastai__fastai | fastai/torch_core.py | {
"start": 23540,
"end": 23749
} | class ____(Int, ShowTitle):
_show_args = {'label': 'text'}
def show(self, ctx=None, **kwargs):
"Show self"
return show_title(str(self), ctx=ctx, **merge(self._show_args, kwargs))
| TitledInt |
python | numpy__numpy | tools/swig/test/testSuperTensor.py | {
"start": 13937,
"end": 14252
} | class ____(SuperTensorTestCase):
def __init__(self, methodName="runTest"):
SuperTensorTestCase.__init__(self, methodName)
self.typeStr = "long"
self.typeCode = "l"
#self.result = int(self.result)
######################################################################
| longTestCase |
python | mlflow__mlflow | tests/langgraph/sample_code/langgraph_diy.py | {
"start": 581,
"end": 1104
} | class ____(TypedDict):
# The add_messages function defines how an update should be processed
# Default is to replace. add_messages says "append"
messages: Annotated[Sequence[BaseMessage], add_messages]
workflow = StateGraph(AgentState)
workflow.add_node("generate", generate)
workflow.add_edge(START, "gene... | AgentState |
python | getsentry__sentry | src/sentry/organizations/services/organization/model.py | {
"start": 3675,
"end": 3947
} | class ____(RpcModel):
id: int = -1
organization_id: int = -1
user_id: int | None = None # This can be null when the user is deleted.
flags: RpcOrganizationMemberFlags = Field(default_factory=lambda: RpcOrganizationMemberFlags())
| RpcOrganizationMemberSummary |
python | Netflix__metaflow | test/unit/inheritance/test_inheritance.py | {
"start": 8705,
"end": 12561
} | class ____:
"""Test comprehensive multiple inheritance from independent hierarchies"""
def test_flow_completes(self, comprehensive_multi_hierarchy_run):
"""Test that multi-hierarchy flow completes"""
assert comprehensive_multi_hierarchy_run.successful
assert comprehensive_multi_hierarch... | TestComprehensiveMultiHierarchy |
python | langchain-ai__langchain | libs/langchain_v1/tests/unit_tests/agents/test_system_message.py | {
"start": 31828,
"end": 37638
} | class ____:
"""Test integration of SystemMessage with middleware chain."""
def test_multiple_middleware_can_modify_system_message(self) -> None:
"""Test that multiple middleware can modify system message in sequence."""
def first_middleware(request: ModelRequest) -> ModelRequest:
"... | TestSystemMessageMiddlewareIntegration |
python | pytorch__pytorch | test/functorch/test_control_flow.py | {
"start": 319718,
"end": 323125
} | class ____(torch.nn.Module):
def forward(self, x):
x: "f32[s77, 3]";
x, = fx_pytree.tree_flatten_spec(([x], {}), self._in_spec)
_guards_fn = self._guards_fn(x); _guards_fn = None
sym_size_int_1: "Sym(s77)" = torch.ops.aten.sym_size.int(x, 0)
while_loop_cond_graph_0 = self.... | GraphModule |
python | getsentry__sentry | src/sentry/workflow_engine/endpoints/validators/incident_groupopenperiod.py | {
"start": 41,
"end": 816
} | class ____(serializers.Serializer):
incident_id = serializers.IntegerField(required=False)
incident_identifier = serializers.IntegerField(required=False)
group_id = serializers.IntegerField(required=False)
open_period_id = serializers.IntegerField(required=False)
def validate(self, attrs):
... | IncidentGroupOpenPeriodValidator |
python | PrefectHQ__prefect | src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py | {
"start": 38066,
"end": 38260
} | class ____(sgqlc.types.Enum):
"""
See source code for more info.
"""
__schema__ = graphql_schema
__choices__ = ("CRITICAL", "HIGH", "LOW", "MODERATE")
| SecurityAdvisorySeverity |
python | mlflow__mlflow | mlflow/types/responses.py | {
"start": 1763,
"end": 2369
} | class ____(Response):
"""Response object for ResponsesAgent.
Args:
output: List of output items. See examples at
https://mlflow.org/docs/latest/genai/flavors/responses-agent-intro#creating-agent-output.
reasoning: Reasoning parameters
usage: Usage information
custom_... | ResponsesAgentResponse |
python | davidhalter__jedi | jedi/inference/gradual/base.py | {
"start": 14655,
"end": 15554
} | class ____(LazyValueWrapper):
def __init__(self, parent_context, class_value, tree_name, generics_manager):
self.inference_state = class_value.inference_state
self.parent_context = parent_context
self._class_value = class_value
self._tree_name = tree_name
self._generics_manag... | BaseTypingInstance |
python | weaviate__weaviate-python-client | weaviate/proto/v1/v5261/v1/weaviate_pb2_grpc.py | {
"start": 8597,
"end": 14420
} | class ____(object):
"""Missing associated documentation comment in .proto file."""
@staticmethod
def Search(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wai... | Weaviate |
python | sympy__sympy | sympy/integrals/meijerint.py | {
"start": 12436,
"end": 80775
} | class ____(ValueError):
"""
Exception raised by _get_coeff_exp, for internal use only.
"""
pass
def _get_coeff_exp(expr, x):
"""
When expr is known to be of the form c*x**b, with c and/or b possibly 1,
return c, b.
Examples
========
>>> from sympy.abc import x, a, b
>>> f... | _CoeffExpValueError |
python | openai__openai-python | tests/api_resources/vector_stores/test_file_batches.py | {
"start": 9434,
"end": 19028
} | class ____:
parametrize = pytest.mark.parametrize(
"async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"]
)
@parametrize
async def test_method_create(self, async_client: AsyncOpenAI) -> None:
file_batch = await async_client.vector_st... | TestAsyncFileBatches |
python | walkccc__LeetCode | solutions/394. Decode String/394-2.py | {
"start": 0,
"end": 492
} | class ____:
def decodeString(self, s: str) -> str:
ans = ''
while self.i < len(s) and s[self.i] != ']':
if s[self.i].isdigit():
k = 0
while self.i < len(s) and s[self.i].isdigit():
k = k * 10 + int(s[self.i])
self.i += 1
self.i += 1 # '['
decodedStri... | Solution |
python | tornadoweb__tornado | tornado/test/websocket_test.py | {
"start": 1331,
"end": 1938
} | class ____(WebSocketHandler):
"""Base class for testing handlers that exposes the on_close event.
This allows for tests to see the close code and reason on the
server side.
"""
def initialize(self, close_future=None, compression_options=None):
self.close_future = close_future
self... | TestWebSocketHandler |
python | agronholm__apscheduler | src/apscheduler/datastores/sqlalchemy.py | {
"start": 3295,
"end": 3550
} | class ____:
job_id: UUID
outcome: JobOutcome
task_id: str
schedule_id: str | None
scheduled_fire_time: datetime | None
result_expires_at: datetime
exception: Exception | None = None
@attrs.define(eq=False, repr=False)
| _JobDiscard |
python | charliermarsh__ruff | crates/ruff_linter/resources/test/fixtures/flake8_pyi/PYI032.py | {
"start": 39,
"end": 177
} | class ____:
def __eq__(self, other: Any) -> bool: ... # PYI032
def __ne__(self, other: typing.Any) -> typing.Any: ... # PYI032
| Bad |
python | huggingface__transformers | src/transformers/models/idefics2/configuration_idefics2.py | {
"start": 829,
"end": 4850
} | class ____(PreTrainedConfig):
r"""
This is the configuration class to store the configuration of a [`Idefics2VisionModel`]. It is used to instantiate a
Idefics2 vision encoder according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yiel... | Idefics2VisionConfig |
python | squidfunk__mkdocs-material | material/plugins/projects/builder/watcher/handler.py | {
"start": 2813,
"end": 3874
} | class ____(FileSystemEventHandler):
# Initialize event handler
def __init__(self, project: Project, handler: Callable):
self.project = project
self.handler = handler
# Handle file creation event
def on_created(self, event: FileSystemEvent):
self._handle(event)
# Handle fil... | ProjectAddedOrRemoved |
python | huggingface__transformers | src/transformers/models/tapas/tokenization_tapas.py | {
"start": 1930,
"end": 2054
} | class ____:
rows: list[list[list[str]]]
selected_tokens: list[TokenCoordinates]
@dataclass(frozen=True)
| TokenizedTable |
python | pytorch__pytorch | test/mobile/model_test/nn_ops.py | {
"start": 9823,
"end": 11522
} | class ____(torch.nn.Module):
def __init__(self) -> None:
super().__init__()
self.x = torch.FloatTensor([[0.1, 0.2, 0.4, 0.8]])
self.y = torch.LongTensor([[3, 0, -1, 1]])
def forward(self):
a = torch.randn(3, 2)
b = torch.rand(3, 2)
c = torch.rand(3)
log_p... | NNLossFunctionModule |
python | pydantic__pydantic | tests/mypy/modules/plugin_fail.py | {
"start": 1877,
"end": 2191
} | class ____(BaseModel):
undefined: Undefined # noqa F821
UndefinedAnnotationModel()
Model.model_construct(x=1)
Model.model_construct(_fields_set={'x'}, x=1, y='2')
Model.model_construct(x='1', y='2')
# Strict mode fails
inheriting = InheritingModel(x='1', y='1')
Model(x='1', y='2')
| UndefinedAnnotationModel |
python | great-expectations__great_expectations | tests/integration/data_sources_and_expectations/expectations/test_expect_column_values_to_not_match_like_pattern.py | {
"start": 1041,
"end": 4394
} | class ____:
@pytest.mark.parametrize(
"expectation",
[
pytest.param(
gxe.ExpectColumnValuesToNotMatchLikePattern(column=COL_A, like_pattern="z%"),
id="no_matches",
),
pytest.param(
gxe.ExpectColumnValuesToNotMatchLik... | TestNormalSql |
python | ApeWorX__ape | src/ape/managers/config.py | {
"start": 767,
"end": 7412
} | class ____(ExtraAttributesMixin, BaseManager):
"""
An Ape configuration manager, controlled by ``ape-config.yaml``
files. **NOTE**: This is a singleton wrapper class that
points to the local project's config. For the config field
definitions, see :class:`~ape.api.config.ApeConfig`.
"""
def ... | ConfigManager |
python | django__django | tests/apps/tests.py | {
"start": 19535,
"end": 21561
} | class ____(SimpleTestCase):
# We need nsapp to be top-level so our multiple-paths tests can add another
# location for it (if its inside a normal package with an __init__.py that
# isn't possible). In order to avoid cluttering the already-full tests/ dir
# (which is on sys.path), we add these new entrie... | NamespacePackageAppTests |
python | kamyu104__LeetCode-Solutions | Python/find-the-maximum-length-of-valid-subsequence-i.py | {
"start": 447,
"end": 779
} | class ____(object):
def maximumLength(self, nums):
"""
:type nums: List[int]
:type k: int
:rtype: int
"""
return max(sum(x%2 == 0 for x in nums),
sum(x%2 == 1 for x in nums),
sum(nums[i]%2 != nums[i+1]%2 for i in xrange(len(nums)-... | Solution2 |
python | getsentry__sentry | tests/sentry/data_export/processors/test_discover.py | {
"start": 319,
"end": 5832
} | class ____(TestCase, SnubaTestCase):
def setUp(self) -> None:
super().setUp()
self.user = self.create_user()
self.org = self.create_organization(owner=self.user)
self.project1 = self.create_project(organization=self.org)
self.project2 = self.create_project(organization=self.o... | DiscoverProcessorTest |
python | tensorflow__tensorflow | tensorflow/python/kernel_tests/linalg/linear_operator_circulant_test.py | {
"start": 10123,
"end": 13292
} | class ____(
LinearOperatorCirculantBaseTest,
linear_operator_test_util.SquareLinearOperatorDerivedClassTest):
"""Test of LinearOperatorCirculant when operator is self-adjoint.
Real spectrum <==> Self adjoint operator.
Note that when the spectrum is real, the operator may still be complex.
"""
@stati... | LinearOperatorCirculantTestSelfAdjointOperator |
python | getsentry__sentry | src/sentry/shared_integrations/exceptions/__init__.py | {
"start": 4558,
"end": 4675
} | class ____(ApiError):
@property
def content_type(self) -> str:
return self.text
| UnsupportedResponseType |
python | weaviate__weaviate-python-client | weaviate/gql/filter.py | {
"start": 5357,
"end": 7222
} | class ____(Filter):
"""NearVector class used to filter weaviate objects."""
def __init__(self, content: dict):
"""Initialize a NearVector class instance.
Args:
content: The content of the `nearVector` clause.
Raises:
TypeError: If 'content' is not of type dict.... | NearVector |
python | chroma-core__chroma | sample_apps/generative_benchmarking/functions/types.py | {
"start": 400,
"end": 470
} | class ____:
text: str
embedding: List[float]
@dataclass
| QueryItem |
python | paramiko__paramiko | paramiko/ssh_exception.py | {
"start": 1252,
"end": 1415
} | class ____(AuthenticationException):
"""
Exception raised when a password is needed to unlock a private key file.
"""
pass
| PasswordRequiredException |
python | gevent__gevent | src/greentest/3.14/test_context.py | {
"start": 558,
"end": 16711
} | class ____(unittest.TestCase):
def test_context_var_new_1(self):
with self.assertRaisesRegex(TypeError, 'takes exactly 1'):
contextvars.ContextVar()
with self.assertRaisesRegex(TypeError, 'must be a str'):
contextvars.ContextVar(1)
c = contextvars.ContextVar('aaa')
... | ContextTest |
python | dagster-io__dagster | python_modules/libraries/dagster-airlift/kitchen-sink/kitchen_sink/airflow_dags/dag_level_custom_callback.py | {
"start": 838,
"end": 1251
} | class ____(DefaultProxyDAGToDagsterOperator):
@classmethod
def build_from_dag(cls, dag):
return CustomProxyDagToDagsterOperator(dag=dag, task_id="OVERRIDDEN")
proxying_to_dagster(
proxied_state=load_proxied_state_from_yaml(Path(__file__).parent / "proxied_state"),
global_vars=globals(),
bu... | CustomProxyDagToDagsterOperator |
python | pytorch__pytorch | torch/_inductor/ir.py | {
"start": 36390,
"end": 39910
} | class ____(Pointwise):
output_indexer: Callable[[Sequence[Expr]], Expr]
scatter_mode: StoreMode = None
def constant_to_device(self, device: torch.device) -> IRNode:
"""Move this to a given device. Requires that all reads are to constants."""
loader = self.make_loader()
loader = patc... | Scatter |
python | modin-project__modin | modin/core/dataframe/algebra/map.py | {
"start": 1072,
"end": 2603
} | class ____(Operator):
"""Builder class for Map operator."""
@classmethod
def register(
cls,
function: Callable[..., pandas.DataFrame],
*call_args: tuple,
**call_kwds: dict,
) -> Callable[..., PandasQueryCompiler]:
"""
Build Map operator that will be perfo... | Map |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 1208909,
"end": 1209713
} | class ____(sgqlc.types.Type, Node):
"""Represents a 'labeled' event on a given issue or pull request."""
__schema__ = github_schema
__field_names__ = ("actor", "created_at", "label", "labelable")
actor = sgqlc.types.Field(Actor, graphql_name="actor")
"""Identifies the actor who performed the event.... | LabeledEvent |
python | getsentry__sentry | src/sentry/deletions/defaults/grouphash.py | {
"start": 129,
"end": 441
} | class ____(ModelDeletionTask[GroupHash]):
def get_child_relations(self, instance: GroupHash) -> list[BaseRelation]:
from sentry.models.grouphashmetadata import GroupHashMetadata
return [
ModelRelation(GroupHashMetadata, {"grouphash_id": instance.id}),
]
| GroupHashDeletionTask |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.