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 | Textualize__textual | docs/examples/guide/widgets/fizzbuzz01.py | {
"start": 110,
"end": 479
} | class ____(Static):
def on_mount(self) -> None:
table = Table("Number", "Fizz?", "Buzz?")
for n in range(1, 16):
fizz = not n % 3
buzz = not n % 5
table.add_row(
str(n),
"fizz" if fizz else "",
"buzz" if buzz else ""... | FizzBuzz |
python | doocs__leetcode | lcof/面试题48. 最长不含重复字符的子字符串/Solution2.py | {
"start": 0,
"end": 309
} | class ____:
def lengthOfLongestSubstring(self, s: str) -> int:
vis = set()
ans = j = 0
for i, c in enumerate(s):
while c in vis:
vis.remove(s[j])
j += 1
vis.add(c)
ans = max(ans, i - j + 1)
return ans
| Solution |
python | coleifer__peewee | tests/regressions.py | {
"start": 3794,
"end": 3865
} | class ____(TestModel):
a = ForeignKeyField(DiA)
b = TextField()
| DiB |
python | tensorflow__tensorflow | tensorflow/python/keras/layers/pooling.py | {
"start": 30487,
"end": 33142
} | class ____(Pooling3D):
"""Average pooling operation for 3D data (spatial or spatio-temporal).
Downsamples the input along its spatial dimensions (depth, height, and width)
by taking the average value over an input window
(of size defined by `pool_size`) for each channel of the input.
The window is shifted by... | AveragePooling3D |
python | python__mypy | mypyc/ir/ops.py | {
"start": 41478,
"end": 42294
} | class ____(RegisterOp):
"""Load a low-level global variable/pointer.
Note that can't be used to directly load Python module-level
global variable, since they are stored in a globals dictionary
and accessed using dictionary operations.
"""
error_kind = ERR_NEVER
is_borrowed = True
def ... | LoadGlobal |
python | doocs__leetcode | solution/3300-3399/3380.Maximum Area Rectangle With Point Constraints I/Solution.py | {
"start": 0,
"end": 783
} | class ____:
def maxRectangleArea(self, points: List[List[int]]) -> int:
def check(x1: int, y1: int, x2: int, y2: int) -> bool:
cnt = 0
for x, y in points:
if x < x1 or x > x2 or y < y1 or y > y2:
continue
if (x == x1 or x == x2) and... | Solution |
python | huggingface__transformers | tests/models/plbart/test_modeling_plbart.py | {
"start": 16856,
"end": 18302
} | class ____(AbstractSeq2SeqIntegrationTest):
checkpoint_name = "uclanlp/plbart-base"
src_text = ["Is 0 the first Fibonacci number ?", "Find the sum of all prime numbers ."]
tgt_text = ["0 the first Fibonacci number?", "the sum of all prime numbers.......... the the"]
def test_base_generate(self):
... | PLBartBaseIntegrationTest |
python | getsentry__sentry | src/sentry/api/endpoints/release_thresholds/release_threshold_status_index.py | {
"start": 2197,
"end": 2377
} | class ____(TypedDict, total=False):
start: datetime
end: datetime
environment: list[str]
projectSlug: list[str]
release: list[str]
| ReleaseThresholdStatusIndexData |
python | pypa__setuptools | setuptools/_static.py | {
"start": 3984,
"end": 4855
} | class ____(packaging.specifiers.SpecifierSet, Static):
"""Not exactly a built-in type but useful for ``requires-python``"""
T = TypeVar("T")
def noop(value: T) -> T:
"""
>>> noop(42)
42
"""
return value
_CONVERSIONS = {str: Str, tuple: Tuple, list: List, dict: Dict}
def attempt_conversio... | SpecifierSet |
python | coleifer__peewee | peewee.py | {
"start": 26489,
"end": 29688
} | class ____(_HashableSource, BaseTable):
def __init__(self, name, columns=None, primary_key=None, schema=None,
alias=None, _model=None, _database=None):
self.__name__ = name
self._columns = columns
self._primary_key = primary_key
self._schema = schema
self._pa... | Table |
python | astropy__astropy | astropy/cosmology/_src/tests/test_utils.py | {
"start": 1278,
"end": 2388
} | class ____:
@pytest.mark.parametrize(
"z, expect",
list(
zip(
valid_zs,
[0, 1, 1100, np.float64(3300), 2.0, 3.0, z_arr, z_arr, z_arr, z_arr],
)
),
)
def test_valid(self, z, expect):
"""Test :func:`astropy.cosmology._src.... | Test_aszarr |
python | django__django | tests/proxy_models/models.py | {
"start": 2107,
"end": 2226
} | class ____(MyPersonProxy):
status = models.CharField(max_length=80)
objects = models.Manager()
| LowerStatusPerson |
python | huggingface__transformers | tests/models/deepseek_vl_hybrid/test_modeling_deepseek_vl_hybrid.py | {
"start": 5299,
"end": 10819
} | class ____(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (
(DeepseekVLHybridModel, DeepseekVLHybridForConditionalGeneration) if is_torch_available() else ()
)
pipeline_model_mapping = (
{
"feature-extraction": DeepseekVLHybr... | DeepseekVLHybridModelTest |
python | PyCQA__pylint | tests/functional/r/regression/regression_4723.py | {
"start": 191,
"end": 271
} | class ____:
@contextlib.contextmanager
def get(self):
yield self
| A |
python | Unity-Technologies__ml-agents | ml-agents-trainer-plugin/mlagents_trainer_plugin/a2c/a2c_optimizer.py | {
"start": 1285,
"end": 7052
} | class ____(TorchOptimizer):
def __init__(self, policy: TorchPolicy, trainer_settings: TrainerSettings):
"""
Takes a Policy and a Dict of trainer parameters and creates an Optimizer around the policy.
The A2C optimizer has a value estimator and a loss function.
:param policy: A TorchP... | A2COptimizer |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-shopify/source_shopify/shopify_graphql/bulk/job.py | {
"start": 805,
"end": 1111
} | class ____(Enum):
"""
Possible error codes that can be returned by BulkOperationUserError.
https://shopify.dev/docs/api/admin-graphql/latest/enums/BulkOperationUserErrorCode
"""
INVALID = "INVALID"
OPERATION_IN_PROGRESS = "OPERATION_IN_PROGRESS"
@dataclass
| BulkOperationUserErrorCode |
python | neetcode-gh__leetcode | python/2971-find-polygon-with-the-largest-perimeter.py | {
"start": 327,
"end": 622
} | class ____:
def largestPerimeter(self, nums: List[int]) -> int:
curSum = sum(nums)
heapq._heapify_max(nums)
while nums and curSum <= nums[0] * 2:
curSum -= heapq._heappop_max(nums)
return curSum if len(nums) > 2 else -1
| Solution |
python | mlflow__mlflow | mlflow/gateway/config.py | {
"start": 6781,
"end": 6877
} | class ____(AWSBaseConfig):
aws_role_arn: str
session_length_seconds: int = 15 * 60
| AWSRole |
python | getsentry__sentry | src/sentry/integrations/slack/analytics.py | {
"start": 646,
"end": 816
} | class ____(analytics.Event):
provider: str
actor_id: int
actor_type: str
@analytics.eventclass("integrations.slack.chart_unfurl")
| SlackIntegrationIdentityLinked |
python | PrefectHQ__prefect | src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py | {
"start": 607609,
"end": 607952
} | 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("ReviewDismissalAllowance", graphql_name="node")
| ReviewDismissalAllowanceEdge |
python | doocs__leetcode | solution/0800-0899/0892.Surface Area of 3D Shapes/Solution.py | {
"start": 0,
"end": 414
} | class ____:
def surfaceArea(self, grid: List[List[int]]) -> int:
ans = 0
for i, row in enumerate(grid):
for j, v in enumerate(row):
if v:
ans += 2 + v * 4
if i:
ans -= min(v, grid[i - 1][j]) * 2
... | Solution |
python | tensorflow__tensorflow | tensorflow/python/framework/immutable_dict.py | {
"start": 917,
"end": 1563
} | class ____(collections.abc.Mapping):
"""Immutable `Mapping`."""
# Note: keys, items, values, get, __eq__, and __ne__ are implemented by
# the `Mapping` base class.
def __init__(self, *args, **kwargs):
self._dict = dict(*args, **kwargs)
def __getitem__(self, key):
return self._dict[key]
def __cont... | ImmutableDict |
python | Pylons__pyramid | src/pyramid/exceptions.py | {
"start": 3513,
"end": 3844
} | class ____(ConfigurationError):
"""An error occurred during execution of a configuration action"""
def __init__(self, etype, evalue, info):
self.etype, self.evalue, self.info = etype, evalue, info
def __str__(self):
return f"{self.etype}: {self.evalue}\n in:\n {self.info}"
| ConfigurationExecutionError |
python | doocs__leetcode | lcp/LCP 33. 蓄水/Solution.py | {
"start": 0,
"end": 332
} | class ____:
def storeWater(self, bucket: List[int], vat: List[int]) -> int:
mx = max(vat)
if mx == 0:
return 0
ans = inf
for x in range(1, mx + 1):
y = sum(max(0, (v + x - 1) // x - b) for v, b in zip(vat, bucket))
ans = min(ans, x + y)
ret... | Solution |
python | pandas-dev__pandas | pandas/tests/indexes/numeric/test_indexing.py | {
"start": 15986,
"end": 17373
} | class ____:
@pytest.mark.parametrize(
"index",
[
Index(np.arange(5, dtype="float64")),
Index(range(0, 20, 2), dtype=np.int64),
Index(np.arange(5, dtype="uint64")),
],
)
def test_where(self, listlike_box, index):
cond = [True] * len(index)
... | TestWhere |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/protocolModule2.py | {
"start": 1630,
"end": 1809
} | class ____(Protocol[_T1]):
def func_1(self, a: int, b: _T1) -> _T1: ...
def func4(x: P5[_T1]) -> _T1: ...
v5 = func4(protocolModule1)
reveal_type(v5, expected_text="str")
| P5 |
python | plotly__plotly.py | plotly/graph_objs/densitymapbox/_hoverlabel.py | {
"start": 233,
"end": 11283
} | class ____(_BaseTraceHierarchyType):
_parent_path_str = "densitymapbox"
_path_str = "densitymapbox.hoverlabel"
_valid_props = {
"align",
"alignsrc",
"bgcolor",
"bgcolorsrc",
"bordercolor",
"bordercolorsrc",
"font",
"namelength",
"namele... | Hoverlabel |
python | PrefectHQ__prefect | src/prefect/client/schemas/events.py | {
"start": 290,
"end": 1541
} | class ____(PrefectBaseModel):
"""a single page of events returned from the API"""
events: list[ReceivedEvent] = Field(description="the events matching the query")
total: int = Field(description="the total number of matching events")
next_page: AnyHttpUrl | None = Field(
description="the URL for... | EventPage |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 558130,
"end": 558629
} | class ____(sgqlc.types.Type):
"""Autogenerated return type of DeleteProjectV2Field"""
__schema__ = github_schema
__field_names__ = ("client_mutation_id", "project_v2_field")
client_mutation_id = sgqlc.types.Field(String, graphql_name="clientMutationId")
"""A unique identifier for the client perform... | DeleteProjectV2FieldPayload |
python | readthedocs__readthedocs.org | readthedocs/api/v2/serializers.py | {
"start": 1389,
"end": 3162
} | class ____(ProjectSerializer):
"""
Project serializer for admin only access.
Includes special internal fields that don't need to be exposed through the
general API, mostly for fields used in the build process
"""
features = serializers.SlugRelatedField(
many=True,
read_only=Tru... | ProjectAdminSerializer |
python | qdrant__qdrant-client | qdrant_client/http/exceptions.py | {
"start": 1497,
"end": 1616
} | class ____(ApiException):
def __init__(self, source: Exception):
self.source = source
| ResponseHandlingException |
python | pytorch__pytorch | tools/stats/upload_utilization_stats/upload_utilization_stats.py | {
"start": 801,
"end": 3734
} | class ____:
"""
generates test segment from utilization records, currently it only generate segments on python commands level
segment_delta_threshold is the threshold to determine if a segment is continuous or not, default is 60 seconds.
"""
def generate(
self, records: list[UtilizationReco... | SegmentGenerator |
python | apache__airflow | providers/google/tests/unit/google/cloud/log/test_gcs_task_handler.py | {
"start": 1324,
"end": 13340
} | class ____:
@pytest.fixture(autouse=True)
def task_instance(self, create_task_instance, session):
self.ti = ti = create_task_instance(
dag_id="dag_for_testing_gcs_task_handler",
task_id="task_for_testing_gcs_task_handler",
logical_date=datetime(2020, 1, 1),
... | TestGCSTaskHandler |
python | jmcnamara__XlsxWriter | xlsxwriter/test/comparison/test_image_anchor02.py | {
"start": 315,
"end": 1246
} | class ____(ExcelComparisonTest):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.set_filename("image_anchor02.xlsx")
def test_create_file(self):
"""Test the creation of a simple XlsxWriter file with image(s)."""
workbook = Wo... | TestCompareXLSXFiles |
python | ansible__ansible | lib/ansible/plugins/doc_fragments/vars_plugin_staging.py | {
"start": 196,
"end": 896
} | class ____(object):
DOCUMENTATION = r"""
options:
stage:
description:
- Control when this vars plugin may be executed.
- Setting this option to V(all) will run the vars plugin after importing inventory and whenever it is demanded by a task.
- Setting this option to V(task) will only run the... | ModuleDocFragment |
python | pydantic__pydantic | pydantic/v1/errors.py | {
"start": 10375,
"end": 10548
} | class ____(PydanticValueError):
def __init__(self, *, limit_value: Union[int, float, Decimal]) -> None:
super().__init__(limit_value=limit_value)
| _NumberBoundError |
python | gevent__gevent | src/greentest/3.10/test_socket.py | {
"start": 169722,
"end": 169989
} | class ____(SendmsgStreamTests, SendrecvmsgSCTPStreamTestBase):
pass
@requireAttrs(socket.socket, "recvmsg")
@unittest.skipIf(AIX, "IPPROTO_SCTP: [Errno 62] Protocol not supported on AIX")
@requireSocket("AF_INET", "SOCK_STREAM", "IPPROTO_SCTP")
| SendmsgSCTPStreamTest |
python | apache__airflow | providers/common/compat/src/airflow/providers/common/compat/lineage/entities.py | {
"start": 1181,
"end": 1443
} | class ____:
"""User entity. Identifies a user."""
email: str = attr.ib()
first_name: str | None = None
last_name: str | None = None
template_fields: ClassVar = ("email", "first_name", "last_name")
@attr.s(auto_attribs=True, kw_only=True)
| User |
python | scipy__scipy | scipy/sparse/tests/test_64bit.py | {
"start": 3364,
"end": 3976
} | class ____:
def _check_resiliency(self, cls, method_name, **kw):
# Resiliency test, to check that sparse matrices deal reasonably
# with varying index data types.
@with_64bit_maxval_limit(**kw)
def check(cls, method_name):
instance = cls()
if hasattr(instance... | RunAll64Bit |
python | PyCQA__pylint | doc/data/messages/m/multiple-class-sub-patterns/good.py | {
"start": 0,
"end": 275
} | class ____:
__match_args__ = ("title", "year")
def __init__(self, title, year):
self.title = title
self.year = year
def func(item: Book):
match item:
case Book(title="abc"):
...
case Book(year=2000):
...
| Book |
python | tensorflow__tensorflow | tensorflow/python/keras/utils/generic_utils.py | {
"start": 5497,
"end": 6879
} | class ____(object):
"""A context manager for keeping track of loaded objects.
During the deserialization process, we may come across objects that are
shared across multiple layers. In order to accurately restore the network
structure to its original state, `SharedObjectLoadingScope` allows us to
re-use share... | SharedObjectLoadingScope |
python | tensorflow__tensorflow | tensorflow/python/keras/mixed_precision/test_util.py | {
"start": 8267,
"end": 8420
} | class ____(regularizers.Regularizer):
def __call__(self, x):
return math_ops.reduce_sum(x)
def get_config(self):
return {}
| ReduceSumRegularizer |
python | django__django | tests/known_related_objects/models.py | {
"start": 495,
"end": 740
} | class ____(models.Model):
name = models.CharField(max_length=30)
pool = models.OneToOneField(Pool, models.CASCADE)
another_pool = models.OneToOneField(
Pool, models.CASCADE, null=True, related_name="another_style"
)
| PoolStyle |
python | pyinstaller__pyinstaller | bootloader/waflib/Tools/glib2.py | {
"start": 1085,
"end": 4722
} | class ____(Task.Task):
vars = ['GLIB_GENMARSHAL_PREFIX', 'GLIB_GENMARSHAL']
color = 'BLUE'
ext_out = ['.h']
def run(self):
bld = self.generator.bld
get = self.env.get_flat
cmd1 = "%s %s --prefix=%s --header > %s" % (
get('GLIB_GENMARSHAL'), self.inputs[0].srcpath(), ... | glib_genmarshal |
python | sphinx-doc__sphinx | tests/roots/test-ext-autodoc/target/enums.py | {
"start": 1758,
"end": 1892
} | class ____:
def say_hello(self):
"""inherited"""
@classmethod
def say_goodbye(cls):
"""inherited"""
| Greeter |
python | numba__numba | numba/tests/test_array_exprs.py | {
"start": 617,
"end": 2081
} | class ____(dict):
def __getattr__(s, k):
return s[k] if k in s else super(Namespace, s).__getattr__(k)
def axy(a, x, y):
return a * x + y
def ax2(a, x, y):
return a * x + y
def pos_root(As, Bs, Cs):
return (-Bs + (((Bs ** 2.) - (4. * As * Cs)) ** 0.5)) / (2. * As)
def neg_root_common_subexpr... | Namespace |
python | openai__openai-python | src/openai/types/beta/realtime/realtime_client_event.py | {
"start": 1061,
"end": 1839
} | class ____(BaseModel):
type: Literal["output_audio_buffer.clear"]
"""The event type, must be `output_audio_buffer.clear`."""
event_id: Optional[str] = None
"""The unique ID of the client event used for error handling."""
RealtimeClientEvent: TypeAlias = Annotated[
Union[
ConversationItemC... | OutputAudioBufferClear |
python | yaml__pyyaml | tests/legacy_tests/canonical.py | {
"start": 110,
"end": 6850
} | class ____:
def __init__(self, data):
if isinstance(data, bytes):
try:
data = data.decode('utf-8')
except UnicodeDecodeError:
raise CanonicalError("utf-8 stream is expected")
self.data = data+'\0'
self.index = 0
self.tokens = [... | CanonicalScanner |
python | pandas-dev__pandas | pandas/_testing/__init__.py | {
"start": 8860,
"end": 9534
} | class ____(Series):
_metadata = ["testattr", "name"]
@property
def _constructor(self):
# For testing, those properties return a generic callable, and not
# the actual class. In this case that is equivalent, but it is to
# ensure we don't rely on the property returning a class
... | SubclassedSeries |
python | huggingface__transformers | src/transformers/models/qwen3_vl/modular_qwen3_vl.py | {
"start": 61319,
"end": 71782
} | class ____(Qwen2VLProcessor):
r"""
Constructs a Qwen3VL processor which wraps a Qwen3VL image processor and a Qwen2 tokenizer into a single processor.
[`Qwen3VLProcessor`] offers all the functionalities of [`Qwen2VLImageProcessor`] and [`Qwen2TokenizerFast`]. See the
[`~Qwen3VLProcessor.__call__`] and [... | Qwen3VLProcessor |
python | doocs__leetcode | solution/0400-0499/0413.Arithmetic Slices/Solution.py | {
"start": 0,
"end": 317
} | class ____:
def numberOfArithmeticSlices(self, nums: List[int]) -> int:
ans = cnt = 0
d = 3000
for a, b in pairwise(nums):
if b - a == d:
cnt += 1
else:
d = b - a
cnt = 0
ans += cnt
return ans
| Solution |
python | google__pytype | pytype/pytd/serialize_ast.py | {
"start": 1718,
"end": 2244
} | class ____(visitors.Visitor):
"""Visitor to clear out the lookup caches of TypeDeclUnits and Classes.
The lookup caches of TypeDeclUnits and Classes do not need to be serialized.
Ideally, these would be private fields but those are not yet implemented.
(https://github.com/jcrist/msgspec/issues/199)
"""
de... | ClearLookupCache |
python | PrefectHQ__prefect | tests/runner/test_runner.py | {
"start": 140465,
"end": 141256
} | class ____:
def test_adds_default_registry_url(self):
with temporary_settings(
{PREFECT_DEFAULT_DOCKER_BUILD_NAMESPACE: "alltheimages.com/my-org"}
):
image = DockerImage(name="test-image")
assert image.name == "alltheimages.com/my-org/test-image"
def test_ove... | TestDockerImage |
python | huggingface__transformers | src/transformers/tokenization_python.py | {
"start": 15034,
"end": 60713
} | class ____(PreTrainedTokenizerBase):
"""
Base class for all slow tokenizers.
Inherits from [`~tokenization_utils_base.PreTrainedTokenizerBase`].
Handle all the shared methods for tokenization and special tokens as well as methods downloading/caching/loading
pretrained tokenizers as well as adding ... | PythonBackend |
python | pymupdf__PyMuPDF | src/__init__.py | {
"start": 525361,
"end": 532514
} | class ____:
def __abs__(self):
if self.is_empty:
return 0.0
return abs(self.ul - self.ur) * abs(self.ul - self.ll)
def __add__(self, q):
if hasattr(q, "__float__"):
return Quad(self.ul + q, self.ur + q, self.ll + q, self.lr + q)
if len(q) != 4:
... | Quad |
python | openai__openai-python | src/openai/types/realtime/realtime_response_create_mcp_tool.py | {
"start": 490,
"end": 998
} | class ____(BaseModel):
read_only: Optional[bool] = None
"""Indicates whether or not a tool modifies data or is read-only.
If an MCP server is
[annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
it will match this filter.
... | AllowedToolsMcpToolFilter |
python | bokeh__bokeh | src/bokeh/models/tickers.py | {
"start": 13286,
"end": 14489
} | class ____(CompositeTicker):
''' Generate nice ticks across different date and time scales.
'''
# explicit __init__ to support Init signatures
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)
num_minor_ticks = Override(default=0)
# TODO: (bev) ... | TimedeltaTicker |
python | great-expectations__great_expectations | contrib/capitalone_dataprofiler_expectations/capitalone_dataprofiler_expectations/expectations/expect_profile_numeric_columns_diff_between_inclusive_threshold_range.py | {
"start": 919,
"end": 5731
} | class ____(
DataProfilerProfileMetricProvider
):
metric_name = "data_profiler.profile_numeric_columns_diff_between_inclusive_threshold_range"
value_keys = (
"profile_path",
"limit_check_report_keys",
"numerical_diff_statistics",
)
@metric_value(engine=PandasExecutionEngine)... | DataProfilerProfileNumericColumnsDiffBetweenInclusiveThresholdRange |
python | pyparsing__pyparsing | examples/simpleBool.py | {
"start": 737,
"end": 983
} | class ____:
def __init__(self, t):
self.label = t[0]
self.value = eval(t[0])
def __bool__(self) -> bool:
return self.value
def __str__(self) -> str:
return self.label
__repr__ = __str__
| BoolOperand |
python | ray-project__ray | python/ray/serve/metrics.py | {
"start": 7063,
"end": 9272
} | class ____(metrics.Histogram):
"""Tracks the size and number of events in buckets.
Histograms allow you to calculate aggregate quantiles
such as 25, 50, 95, 99 percentile latency for an RPC.
This corresponds to Prometheus' histogram metric:
https://prometheus.io/docs/concepts/metric_types/#histogr... | Histogram |
python | numba__numba | numba/cuda/tests/cudapy/test_dispatcher.py | {
"start": 388,
"end": 3652
} | class ____(CUDATestCase):
def _test_no_double_specialize(self, dispatcher, ty):
with self.assertRaises(RuntimeError) as e:
dispatcher.specialize(ty)
self.assertIn('Dispatcher already specialized', str(e.exception))
def test_no_double_specialize_sig_same_types(self):
# Atte... | TestDispatcherSpecialization |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/assignment3.py | {
"start": 1229,
"end": 1348
} | class ____:
@classmethod
def method1(cls):
cls.v1: list[Literal[0]] = [] if issubclass(cls, int) else [0]
| A |
python | doocs__leetcode | solution/2400-2499/2408.Design SQL/Solution.py | {
"start": 0,
"end": 603
} | class ____:
def __init__(self, names: List[str], columns: List[int]):
self.tables = defaultdict(list)
def insertRow(self, name: str, row: List[str]) -> None:
self.tables[name].append(row)
def deleteRow(self, name: str, rowId: int) -> None:
pass
def selectCell(self, name: str, ... | SQL |
python | getsentry__sentry | src/sentry/relay/config/__init__.py | {
"start": 48890,
"end": 49012
} | class ____(TypedDict):
limit: int
TransactionNameStrategy = Literal["strict", "clientBased"]
| CustomMeasurementSettings |
python | allegroai__clearml | clearml/backend_api/api_proxy.py | {
"start": 2041,
"end": 3192
} | class ____(ApiServiceProxy):
_extra_services_modules = []
def _import_module(self, name: str, _: Optional[str]) -> Any:
for module_path in self._get_services_modules():
try:
return importlib.import_module(name, package=module_path)
except ImportError:
... | ExtApiServiceProxy |
python | pydantic__pydantic | pydantic/_internal/_decorators.py | {
"start": 14910,
"end": 33950
} | class ____:
"""Mapping of name in the class namespace to decorator info.
note that the name in the class namespace is the function or attribute name
not the field name!
"""
validators: dict[str, Decorator[ValidatorDecoratorInfo]] = field(default_factory=dict)
field_validators: dict[str, Decora... | DecoratorInfos |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 298224,
"end": 299044
} | class ____(sgqlc.types.Input):
"""Autogenerated input type of SetOrganizationInteractionLimit"""
__schema__ = github_schema
__field_names__ = ("organization_id", "limit", "expiry", "client_mutation_id")
organization_id = sgqlc.types.Field(sgqlc.types.non_null(ID), graphql_name="organizationId")
"""... | SetOrganizationInteractionLimitInput |
python | pypa__pip | src/pip/_vendor/packaging/_elffile.py | {
"start": 673,
"end": 3286
} | class ____:
"""
Representation of an ELF executable.
"""
def __init__(self, f: IO[bytes]) -> None:
self._f = f
try:
ident = self._read("16B")
except struct.error as e:
raise ELFInvalid("unable to parse identification") from e
magic = bytes(ident[... | ELFFile |
python | huggingface__transformers | src/transformers/models/nllb_moe/modeling_nllb_moe.py | {
"start": 29855,
"end": 30396
} | class ____(PreTrainedModel):
config: NllbMoeConfig
base_model_prefix = "model"
supports_gradient_checkpointing = True
_no_split_modules = ["NllbMoeEncoderLayer", "NllbMoeDecoderLayer"]
# TODO: If anyone is up to it to make sure tests pass etc
# Flash attention has problems due to not preparing m... | NllbMoePreTrainedModel |
python | django-extensions__django-extensions | tests/auth/test_mixins.py | {
"start": 657,
"end": 1604
} | class ____(TestCase):
factory = RequestFactory()
User = get_user_model()
@classmethod
def setUpTestData(cls):
cls.user = cls.User.objects.create(username="Joe", password="pass")
cls.ownerModel = HasOwnerModel.objects.create(owner=cls.user)
# Test if owner model has access
def t... | ModelUserFieldPermissionMixinTests |
python | RaRe-Technologies__gensim | gensim/models/word2vec.py | {
"start": 101920,
"end": 107465
} | class ____(namedtuple('Heapitem', 'count, index, left, right')):
def __lt__(self, other):
return self.count < other.count
def _build_heap(wv):
heap = list(Heapitem(wv.get_vecattr(i, 'count'), i, None, None) for i in range(len(wv.index_to_key)))
heapq.heapify(heap)
for i in range(len(wv) - 1):
... | Heapitem |
python | HypothesisWorks__hypothesis | hypothesis-python/src/hypothesis/internal/conjecture/providers.py | {
"start": 36464,
"end": 40483
} | class ____(PrimitiveProvider):
lifetime = "test_case"
def __init__(
self, conjecturedata: Optional["ConjectureData"], /, *, bytestring: bytes
):
super().__init__(conjecturedata)
self.bytestring = bytestring
self.index = 0
self.drawn = bytearray()
def _draw_bits(... | BytestringProvider |
python | getsentry__sentry | src/sentry/api/serializers/release_details_types.py | {
"start": 948,
"end": 1388
} | class ____(TypedDict, total=False):
durationP50: float | None
durationP90: float | None
crashFreeUsers: float | None
crashFreeSessions: float | None
totalUsers: int | None
totalUsers24h: int | None
totalProjectUsers24h: int | None
totalSessions: int | None
totalSessions24h: int | Non... | HealthDataOptional |
python | Netflix__metaflow | metaflow/plugins/cards/card_client.py | {
"start": 501,
"end": 3903
} | class ____:
"""
`Card` represents an individual Metaflow Card, a single HTML file, produced by
the card `@card` decorator. `Card`s are contained by `CardContainer`, returned by
`get_cards`.
Note that the contents of the card, an HTML file, is retrieved lazily when you call
`Card.get` for the fi... | Card |
python | tiangolo__fastapi | tests/test_security_api_key_cookie.py | {
"start": 217,
"end": 2004
} | class ____(BaseModel):
username: str
def get_current_user(oauth_header: str = Security(api_key)):
user = User(username=oauth_header)
return user
@app.get("/users/me")
def read_current_user(current_user: User = Depends(get_current_user)):
return current_user
def test_security_api_key():
client ... | User |
python | spack__spack | lib/spack/spack/fetch_strategy.py | {
"start": 52042,
"end": 64822
} | class ____(URLFetchStrategy):
"""Fetch strategy that verifies the content digest during fetching,
as well as after expanding it."""
def __init__(self, url, archive_sha256: str, expanded_sha256: str):
super().__init__(url=url, checksum=archive_sha256)
self.expanded_sha256 = expanded_sha256
... | FetchAndVerifyExpandedFile |
python | sanic-org__sanic | sanic/cli/inspector.py | {
"start": 884,
"end": 3266
} | class ____(ArgumentParser):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
_add_shared(self)
if not self.description:
self.description = ""
self.description = get_logo(True) + self.description
def make_inspector_parser(parser: ArgumentParser) -> ... | InspectorSubParser |
python | airbytehq__airbyte | airbyte-ci/connectors/pipelines/pipelines/models/contexts/python_registry_publish.py | {
"start": 517,
"end": 5038
} | class ____(PipelineContext):
def __init__(
self,
python_registry_token: Secret,
registry_check_url: str,
package_path: str,
report_output_prefix: str,
is_local: bool,
git_branch: str,
git_revision: str,
diffed_branch: str,
git_repo_url:... | PythonRegistryPublishContext |
python | apache__airflow | providers/google/tests/unit/google/cloud/operators/test_alloy_db.py | {
"start": 31254,
"end": 45403
} | class ____:
def setup_method(self):
self.operator = AlloyDBCreateInstanceOperator(
task_id=TEST_TASK_ID,
instance_id=TEST_INSTANCE_ID,
cluster_id=TEST_CLUSTER_ID,
instance_configuration=TEST_INSTANCE,
is_secondary=TEST_IS_SECONDARY,
pro... | TestAlloyDBCreateInstanceOperator |
python | pyinstaller__pyinstaller | bootloader/waflib/Tools/glib2.py | {
"start": 10021,
"end": 10929
} | class ____(Task.Task):
color = 'BLUE'
base_cmd = '${GLIB_COMPILE_RESOURCES} --sourcedir=${SRC[0].parent.srcpath()} --sourcedir=${SRC[0].bld_dir()}'
def scan(self):
bld = self.generator.bld
kw = {}
kw['cwd'] = self.get_cwd()
kw['quiet'] = Context.BOTH
cmd = Utils.subs... | glib_gresource_base |
python | getsentry__sentry | tests/sentry/runner/commands/test_killswitches.py | {
"start": 263,
"end": 5410
} | class ____(CliTestCase):
command = killswitches
@mock.patch(
"sentry.killswitches.ALL_KILLSWITCH_OPTIONS",
{
OPTION: KillswitchInfo(
description="the description", fields={"project_id": "hey", "event_type": "ho"}
)
},
)
def test_basic(self... | KillswitchesTest |
python | sqlalchemy__sqlalchemy | test/sql/test_types.py | {
"start": 98239,
"end": 102851
} | class ____(fixtures.TestBase):
def setup_test(self):
metadata = MetaData()
self.test_table = Table(
"test_table",
metadata,
Column("id", Integer, primary_key=True),
Column("test_column", JSON),
)
self.jsoncol = self.test_table.c.test_co... | JSONTest |
python | huggingface__transformers | src/transformers/models/glm4v/configuration_glm4v.py | {
"start": 5545,
"end": 11972
} | class ____(PreTrainedConfig):
r"""
This is the configuration class to store the configuration of a [`Glm4vModel`]. It is used to instantiate a
GLM-4.1V model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yield a similar config... | Glm4vTextConfig |
python | getsentry__sentry | src/sentry/integrations/repository/metric_alert.py | {
"start": 1803,
"end": 2808
} | class ____(BaseNewNotificationMessage):
incident_id: int | None = None
trigger_action_id: int | None = None
def get_validation_error(self) -> Exception | None:
error = super().get_validation_error()
if error is not None:
return error
if self.message_identifier is not No... | NewMetricAlertNotificationMessage |
python | numba__numba | numba/tests/test_datamodel.py | {
"start": 4548,
"end": 5260
} | class ____(unittest.TestCase):
def setUp(self):
self.dmm = datamodel.default_manager
def test_number(self):
ty = types.int32
dm = self.dmm[ty]
self.assertFalse(dm.contains_nrt_meminfo())
def test_array(self):
ty = types.int32[:]
dm = self.dmm[ty]
sel... | TestMemInfo |
python | coleifer__peewee | tests/regressions.py | {
"start": 11411,
"end": 13561
} | class ____(ModelTestCase):
requires = [User, Tweet]
def test_returning_integration_subqueries(self):
_create_users_tweets(self.database)
# We can use a correlated subquery in the RETURNING clause.
subq = (Tweet
.select(fn.COUNT(Tweet.id).alias('ct'))
.wh... | TestReturningIntegrationRegressions |
python | OmkarPathak__pygorithm | tests/test_sorting.py | {
"start": 2650,
"end": 2839
} | class ____(unittest.TestCase, TestSortingAlgorithm):
inplace = True
alph_support = True
@staticmethod
def sort(arr):
return selection_sort.sort(arr)
| TestSelectionSort |
python | spack__spack | lib/spack/spack/vendor/ruamel/yaml/loader.py | {
"start": 1850,
"end": 2412
} | class ____(Reader, Scanner, Parser, Composer, Constructor, VersionedResolver):
def __init__(self, stream, version=None, preserve_quotes=None):
# type: (StreamTextType, Optional[VersionType], Optional[bool]) -> None
self.comment_handling = None
Reader.__init__(self, stream, loader=self)
... | Loader |
python | tensorflow__tensorflow | tensorflow/python/eager/polymorphic_function/concrete_function.py | {
"start": 43541,
"end": 45210
} | class ____(object):
"""Holds the state of a function call between execution and recording."""
__slots__ = [
"_functions", "_inference_args", "_input_tangents", "_tape_watching"
]
def __init__(self, functions, inference_args, input_tangents, tape_watching):
"""Collects information about the function ... | _ForwardBackwardCall |
python | ethereum__web3.py | web3/types.py | {
"start": 15129,
"end": 15319
} | class ____(TypedDict, total=False):
address: (
Address | ChecksumAddress | ENS | Sequence[Address | ChecksumAddress | ENS]
)
topics: Sequence[TopicFilter]
| LogsSubscriptionArg |
python | huggingface__transformers | src/transformers/models/pvt/modeling_pvt.py | {
"start": 5985,
"end": 6426
} | class ____(nn.Module):
def __init__(self, config: PvtConfig, hidden_size: int):
super().__init__()
self.dense = nn.Linear(hidden_size, hidden_size)
self.dropout = nn.Dropout(config.hidden_dropout_prob)
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
hidden_states... | PvtSelfOutput |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-genesys/source_genesys/source.py | {
"start": 2125,
"end": 2407
} | class ____(GenesysStream):
"""
API Docs: https://developer.genesys.cloud/routing/routing/
"""
page_size = 200
primary_key = "id"
cursor_field = "dateModified"
def path(self, **kwargs) -> str:
return "routing/assessments"
| RoutingRoutingAssessments |
python | apache__airflow | airflow-core/src/airflow/api_fastapi/core_api/datamodels/common.py | {
"start": 1578,
"end": 1724
} | class ____(enum.Enum):
"""Bulk Action to be taken if the entity does not exist."""
FAIL = "fail"
SKIP = "skip"
| BulkActionNotOnExistence |
python | rq__rq | tests/fixtures.py | {
"start": 3185,
"end": 3257
} | class ____:
def __repr__(self):
return 'é'
| UnicodeStringObject |
python | airbytehq__airbyte | airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/migrate_to_manifest_only/declarative_component_schema.py | {
"start": 40179,
"end": 40519
} | class ____(BaseModel):
type: Literal["AddFields"]
fields: List[AddedFieldDefinition] = Field(
...,
description="List of transformations (path and corresponding value) that will be added to the record.",
title="Fields",
)
parameters: Optional[Dict[str, Any]] = Field(None, alias="$... | AddFields |
python | django__django | tests/prefetch_related/models.py | {
"start": 2769,
"end": 2947
} | class ____(models.QuerySet):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._iterable_class = ModelIterableSubclass
| TeacherQuerySet |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-file/source_file/client.py | {
"start": 1268,
"end": 9890
} | class ____:
"""Class to manage read from file located at different providers
Supported examples of URL this class can accept are as follows:
```
s3://my_bucket/my_key
s3://my_key:my_secret@my_bucket/my_key
gs://my_bucket/my_blob
hdfs:///path/file (not tested)
hdfs://... | URLFile |
python | facebook__pyre-check | tools/incremental_test/tests/test_environment.py | {
"start": 457,
"end": 627
} | class ____:
working_directory: Path
command: str
stdin: Final[Optional[str]] = None
MockExecuteCallable = Callable[[CommandInput], CommandOutput]
| CommandInput |
python | huggingface__transformers | src/transformers/models/apertus/modeling_apertus.py | {
"start": 14794,
"end": 15345
} | class ____(PreTrainedModel):
config: ApertusConfig
base_model_prefix = "model"
supports_gradient_checkpointing = True
_no_split_modules = ["ApertusDecoderLayer"]
_skip_keys_device_placement = ["past_key_values"]
_supports_flash_attn = True
_supports_sdpa = True
_supports_flex_attn = True... | ApertusPreTrainedModel |
python | lepture__authlib | authlib/integrations/django_client/apps.py | {
"start": 321,
"end": 1170
} | class ____:
def save_authorize_data(self, request, **kwargs):
state = kwargs.pop("state", None)
if state:
self.framework.set_state_data(request.session, state, kwargs)
else:
raise RuntimeError("Missing state value")
def authorize_redirect(self, request, redirect_... | DjangoAppMixin |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.