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 | tests/unit/bokeh/core/test_has_props.py | {
"start": 14695,
"end": 14818
} | class ____(hp.HasProps, hp.Local):
f0 = String(default="xyz")
f1 = List(String, default=["x", "y", "z"])
| Some1HasProps |
python | kamyu104__LeetCode-Solutions | Python/zigzag-conversion.py | {
"start": 29,
"end": 523
} | class ____(object):
def convert(self, s, numRows):
"""
:type s: str
:type numRows: int
:rtype: str
"""
if numRows == 1:
return s
step, zigzag = 2 * numRows - 2, ""
for i in xrange(numRows):
for j in xrange(i, len(s), step):
... | Solution |
python | dagster-io__dagster | python_modules/libraries/dagster-dg-cli/dagster_dg_cli/api_layer/api/schedule.py | {
"start": 442,
"end": 1787
} | class ____:
"""API for schedule operations."""
client: IGraphQLClient
def list_schedules(
self,
repository_location_name: Optional[str] = None,
repository_name: Optional[str] = None,
) -> "DgApiScheduleList":
"""List all schedules, optionally filtered by code location a... | DgApiScheduleApi |
python | huggingface__transformers | tests/generation/test_flash_attention_parity.py | {
"start": 890,
"end": 5686
} | class ____(unittest.TestCase):
# From https://github.com/sgl-project/sglang/blob/main/python/sglang/test/test_utils.py
def _lcs(self, X, Y):
m = len(X)
n = len(Y)
L = [[0] * (n + 1) for _ in range(m + 1)]
for i in range(m + 1):
for j in range(n + 1):
... | FlashAttentionParityTest |
python | davidhalter__jedi | test/completion/goto.py | {
"start": 1014,
"end": 1290
} | class ____():
x = 3
#! ['x = 3']
ClassVar.x
#! ['x = 3']
ClassVar().x
# before assignments
#! 10 ['x = 3']
ClassVar.x = ''
#! 12 ['x = 3']
ClassVar().x = ''
# Recurring use of the same var name, github #315
def f(t=None):
#! 9 ['param t=None']
t = t or 1
| ClassVar |
python | allegroai__clearml | clearml/backend_api/services/v2_20/projects.py | {
"start": 79370,
"end": 82731
} | class ____(Response):
"""
Response of projects.get_by_id endpoint.
:param project: Project info
:type project: Project
"""
_service = "projects"
_action = "get_by_id"
_version = "2.20"
_schema = {
"definitions": {
"project": {
"properties": {
... | GetByIdResponse |
python | ansible__ansible | test/integration/targets/collections/collection_root_user/ansible_collections/testns/testcoll/plugins/action/subclassed_normal.py | {
"start": 109,
"end": 335
} | class ____(NormalAction):
def run(self, *args, **kwargs):
result = super(ActionModule, self).run(*args, **kwargs)
result['hacked'] = 'I got run under a subclassed normal, yay'
return result
| ActionModule |
python | ipython__ipython | tests/test_completer.py | {
"start": 6954,
"end": 7117
} | class ____:
def __init__(self, things=()):
self.things = things
def _ipython_key_completions_(self):
return list(self.things)
| KeyCompletable |
python | vyperlang__vyper | vyper/exceptions.py | {
"start": 9360,
"end": 9431
} | class ____(VyperException):
"""Module was not found"""
| ModuleNotFound |
python | django__django | tests/auth_tests/test_views.py | {
"start": 28580,
"end": 29480
} | class ____(AuthViewsTestCase):
def test_user_password_change_updates_session(self):
"""
#21649 - Ensure contrib.auth.views.password_change updates the user's
session auth hash after a password change so the session isn't logged
out.
"""
self.login()
original_s... | SessionAuthenticationTests |
python | google__jax | tests/hijax_test.py | {
"start": 4493,
"end": 4951
} | class ____(HiPrimitive):
def abstract_eval(_, lo_aval):
return QArrayTy(lo_aval.shape), set()
def to_lojax(_, lo_val):
m, _ = lo_val.shape
scale = lo_val.max(1) / 32.
return QArray((lo_val / scale[:, None]).astype('int8'), scale)
def jvp(_, primals, tangents):
(x,), (xdot,) = primals, tangen... | ToQ |
python | joke2k__faker | faker/providers/geo/cs_CZ/__init__.py | {
"start": 41,
"end": 11409
} | class ____(GeoProvider):
# Source:
# https://www.latlong.net/category/cities-59-15.html
# https://github.com/33bcdd/souradnice-mest
land_coords = (
("50.50301", "13.63617", "Most", "CZ", "Europe/Prague"),
("50.23271", "12.87117", "Karlovy Vary", "CZ", "Europe/Prague"),
("50.0... | Provider |
python | scrapy__scrapy | tests/test_commands.py | {
"start": 2890,
"end": 3382
} | class ____(TestProjectBase):
"""Test that the command uses the expected kind of *CrawlerProcess
and produces expected errors when needed."""
name = "crawl"
NORMAL_MSG = "Using CrawlerProcess"
ASYNC_MSG = "Using AsyncCrawlerProcess"
@pytest.fixture(autouse=True)
def create_files(self, proj_... | TestCommandCrawlerProcess |
python | scipy__scipy | scipy/stats/tests/test_mstats_basic.py | {
"start": 814,
"end": 2138
} | class ____:
def test_mquantiles_limit_keyword(self):
# Regression test for Trac ticket #867
data = np.array([[6., 7., 1.],
[47., 15., 2.],
[49., 36., 3.],
[15., 39., 4.],
[42., 40., -999.],
... | TestMquantiles |
python | boto__boto3 | boto3/resources/factory.py | {
"start": 953,
"end": 22708
} | class ____:
"""
A factory to create new :py:class:`~boto3.resources.base.ServiceResource`
classes from a :py:class:`~boto3.resources.model.ResourceModel`. There are
two types of lookups that can be done: one on the service itself (e.g. an
SQS resource) and another on models contained within the serv... | ResourceFactory |
python | huggingface__transformers | tests/models/wav2vec2_conformer/test_modeling_wav2vec2_conformer.py | {
"start": 15226,
"end": 24858
} | class ____(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (
(
Wav2Vec2ConformerForCTC,
Wav2Vec2ConformerModel,
Wav2Vec2ConformerForSequenceClassification,
Wav2Vec2ConformerForPreTraining,
Wav2Vec2ConformerForAudioFra... | Wav2Vec2ConformerModelTest |
python | doocs__leetcode | solution/3300-3399/3305.Count of Substrings Containing Every Vowel and K Consonants I/Solution.py | {
"start": 0,
"end": 698
} | class ____:
def countOfSubstrings(self, word: str, k: int) -> int:
def f(k: int) -> int:
cnt = Counter()
ans = l = x = 0
for c in word:
if c in "aeiou":
cnt[c] += 1
else:
x += 1
while ... | Solution |
python | sympy__sympy | sympy/codegen/cfunctions.py | {
"start": 9676,
"end": 10829
} | class ____(Function): # 'cbrt' already defined in sympy.functions.elementary.miscellaneous
"""
Represents the cube root function.
Explanation
===========
The reason why one would use ``Cbrt(x)`` over ``cbrt(x)``
is that the latter is internally represented as ``Pow(x, Rational(1, 3))`` which
... | Cbrt |
python | allegroai__clearml | clearml/backend_api/services/v2_23/datasets.py | {
"start": 162455,
"end": 164434
} | class ____(Request):
"""
Get the field names that can be used in lucene query for the given dataset versions
:param versions: The IDs of the versions. Either dataset or versions should be
specified
:type versions: Sequence[str]
:param dataset: The ID of the dataset. Either dataset or versio... | GetSchemaKeysRequest |
python | run-llama__llama_index | llama-index-integrations/tools/llama-index-tools-scrapegraph/examples/scrapegraph-agentic-scraper-llama-index.py | {
"start": 725,
"end": 896
} | class ____(BaseModel):
"""Schema for representing multiple products."""
products: List[ProductInfo] = Field(description="List of products found")
| ProductsListSchema |
python | astropy__astropy | astropy/io/votable/exceptions.py | {
"start": 48314,
"end": 48570
} | class ____(VOWarning, ValueError):
"""
The table had *x* fields defined, but the data itself has only *y*
columns.
"""
message_template = "Data has fewer columns ({}) than are defined in the header ({})"
default_args = ("x", "y")
| E21 |
python | facebook__pyre-check | client/commands/pyre_server_options.py | {
"start": 1013,
"end": 4596
} | class ____:
server_start_command: frontend_configuration.ServerStartCommand
project_identifier: str
start_arguments: start.Arguments
language_server_features: features.LanguageServerFeatures
strict_default: bool
excludes: Sequence[str]
flavor: identifiers.PyreFlavor
def get_socket_path(... | PyreServerOptions |
python | tensorflow__tensorflow | tensorflow/python/debug/lib/debug_events_reader.py | {
"start": 25206,
"end": 26496
} | class ____(BaseDigest):
"""Light-weight summary of a intra-graph tensor execution event.
Use `DebugDataReader.read_graph_execution_trace()` on this object to read more
detailed data (`GraphExecutionTrace`).
Properties (beyond the base class):
op_type: Type name of the executed op (e.g., "Conv2D").
op_... | GraphExecutionTraceDigest |
python | instagram__MonkeyType | tests/test_typing.py | {
"start": 24945,
"end": 25168
} | class ____(TypeRewriter):
"""Dummy rewriter for testing."""
def rewrite_List(self, lst):
return int
def rewrite_type_variable(self, type_variable):
return Dict[str, type_variable]
| RewriteListToInt |
python | sqlalchemy__sqlalchemy | lib/sqlalchemy/dialects/postgresql/pg8000.py | {
"start": 8388,
"end": 8706
} | class ____(PGExecutionContext):
def create_server_side_cursor(self):
ident = "c_%s_%s" % (hex(id(self))[2:], hex(_server_side_id())[2:])
return ServerSideCursor(self._dbapi_connection.cursor(), ident)
def pre_exec(self):
if not self.compiled:
return
| PGExecutionContext_pg8000 |
python | MongoEngine__mongoengine | mongoengine/fields.py | {
"start": 36407,
"end": 38500
} | class ____(ComplexBaseField):
"""A dictionary field that wraps a standard Python dictionary. This is
similar to an embedded document, but the structure is not defined.
.. note::
Required means it cannot be empty - as the default for DictFields is {}
"""
def __init__(self, field=None, *args... | DictField |
python | pydantic__pydantic | tests/mypy/outputs/mypy-default_ini/plugin_success.py | {
"start": 2408,
"end": 2949
} | class ____(BaseModel):
x: str = Field(alias='x_alias')
y: str = Field(validation_alias='y_alias')
z: str = Field(validation_alias='z_alias', alias='unused')
alias_model = AliasModel(x_alias='a', y_alias='a', z_alias='a')
# MYPY: error: Unexpected keyword argument "y_alias" for "AliasModel"; did you mean "... | AliasModel |
python | google__jax | jax/_src/errors.py | {
"start": 18225,
"end": 23837
} | class ____(JAXTypeError):
"""
This error occurs when you use a JAX value that has leaked out of a function.
What does it mean to leak a value? If you use a JAX transformation on a
function ``f`` that stores, in some scope outside of ``f``, a reference to
an intermediate value, that value is considered to have... | UnexpectedTracerError |
python | scikit-learn__scikit-learn | sklearn/random_projection.py | {
"start": 20841,
"end": 28400
} | class ____(BaseRandomProjection):
"""Reduce dimensionality through sparse random projection.
Sparse random matrix is an alternative to dense random
projection matrix that guarantees similar embedding quality while being
much more memory efficient and allowing faster computation of the
projected dat... | SparseRandomProjection |
python | has2k1__plotnine | plotnine/scales/scale_identity.py | {
"start": 1081,
"end": 1266
} | class ____(scale_color_identity):
"""
No color scaling
"""
_aesthetics = ["fill"]
_: KW_ONLY
guide: Literal["legend"] | None = None
@dataclass
| scale_fill_identity |
python | apache__airflow | providers/fab/src/airflow/providers/fab/auth_manager/views/user_edit.py | {
"start": 1408,
"end": 1788
} | class ____(ResetMyPasswordView):
"""Customize permission names for FAB's builtin ResetMyPasswordView."""
class_permission_name = permissions.RESOURCE_MY_PASSWORD
method_permission_name = {
"this_form_get": "read",
"this_form_post": "edit",
}
base_permissions = [permissions.ACTION_CA... | CustomResetMyPasswordView |
python | PyCQA__pylint | tests/functional/s/super/super_init_not_called.py | {
"start": 1224,
"end": 1410
} | class ____(ParentWithoutInit):
def __init__(self): # [super-init-not-called]
...
# Regression test as reported in
# https://github.com/pylint-dev/pylint/issues/6027
| ChildThree |
python | kamyu104__LeetCode-Solutions | Python/subarrays-distinct-element-sum-of-squares-i.py | {
"start": 133,
"end": 2015
} | class ____(object):
def sumCounts(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
MOD = 10**9+7
class BIT(object): # 0-indexed.
def __init__(self, n):
self.__bit = [0]*(n+1) # Extra one for dummy node.
def add(self, i,... | Solution |
python | encode__django-rest-framework | tests/test_versioning.py | {
"start": 1673,
"end": 2118
} | class ____(RequestVersionView):
def determine_version(self, request, *args, **kwargs):
scheme = self.versioning_class()
scheme.allowed_versions = ('v1', 'v2', None)
scheme.default_version = 'v2'
return (scheme.determine_version(request, *args, **kwargs), scheme)
factory = APIReques... | AllowedWithNoneAndDefaultVersionsView |
python | keras-team__keras | keras/src/ops/numpy.py | {
"start": 100403,
"end": 101153
} | class ____(Operation):
def call(self, x1, x2):
return backend.numpy.equal(x1, x2)
def compute_output_spec(self, x1, x2):
x1_shape = getattr(x1, "shape", [])
x2_shape = getattr(x2, "shape", [])
output_shape = broadcast_shapes(x1_shape, x2_shape)
return KerasTensor(output_... | Equal |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/dataclassHash1.py | {
"start": 332,
"end": 437
} | class ____:
a: int
# This should generate an error.
v3: Hashable = DC3(0)
@dataclass(frozen=True)
| DC3 |
python | SmileyChris__easy-thumbnails | easy_thumbnails/files.py | {
"start": 4696,
"end": 4956
} | class ____:
name = 'fake'
def __init__(self, storage=None):
if storage is None:
storage = default_storage
self.storage = storage
def generate_filename(self, instance, name, *args, **kwargs):
return name
| FakeField |
python | joke2k__faker | tests/providers/test_ssn.py | {
"start": 40178,
"end": 41214
} | class ____(unittest.TestCase):
num_sample_runs = 10
def setUp(self):
Faker.seed(0)
self.fake = Faker("tr_TR")
self.samples = [self.fake.ssn() for _ in range(self.num_sample_runs)]
def test_first_part_non_zero(self):
for sample in self.samples:
self.assertNotEqua... | TestTrTr |
python | plotly__plotly.py | plotly/graph_objs/layout/yaxis/_title.py | {
"start": 235,
"end": 4975
} | class ____(_BaseLayoutHierarchyType):
_parent_path_str = "layout.yaxis"
_path_str = "layout.yaxis.title"
_valid_props = {"font", "standoff", "text"}
@property
def font(self):
"""
Sets this axis' title font.
The 'font' property is an instance of Font
that may be spec... | Title |
python | huggingface__transformers | src/transformers/models/arcee/modular_arcee.py | {
"start": 1110,
"end": 8221
} | class ____(LlamaConfig):
r"""
This is the configuration class to store the configuration of a [`ArceeModel`]. It is used to instantiate an Arcee
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar configuration... | ArceeConfig |
python | fluentpython__example-code-2e | 24-class-metaprog/metabunch/pre3.6/bunch.py | {
"start": 1348,
"end": 1391
} | class ____(metaclass=MetaBunch):
pass
| Bunch |
python | squidfunk__mkdocs-material | material/plugins/tags/structure/mapping/storage/__init__.py | {
"start": 1683,
"end": 6407
} | class ____:
"""
A mapping storage.
The mapping storage allows to save and load mappings to and from a JSON
file, which allows for sharing tags across multiple MkDocs projects.
"""
def __init__(self, config: TagsConfig):
"""
Initialize the mapping storage.
Arguments:
... | MappingStorage |
python | huggingface__transformers | src/transformers/models/decision_transformer/modeling_decision_transformer.py | {
"start": 26670,
"end": 27437
} | class ____(ModelOutput):
r"""
state_preds (`torch.FloatTensor` of shape `(batch_size, sequence_length, state_dim)`):
Environment state predictions
action_preds (`torch.FloatTensor` of shape `(batch_size, sequence_length, action_dim)`):
Model action predictions
return_preds (`torch.FloatT... | DecisionTransformerOutput |
python | PyCQA__pylint | doc/data/messages/d/deprecated-decorator/bad.py | {
"start": 13,
"end": 116
} | class ____:
@abc.abstractclassmethod # [deprecated-decorator]
def breath(cls):
pass
| Animal |
python | huggingface__transformers | src/transformers/models/deepseek_v3/modular_deepseek_v3.py | {
"start": 12161,
"end": 12796
} | class ____(LlamaDecoderLayer):
def __init__(self, config: DeepseekV3Config, layer_idx: int):
nn.Module.__init__(self)
self.hidden_size = config.hidden_size
self.self_attn = DeepseekV3Attention(config=config, layer_idx=layer_idx)
if layer_idx >= config.first_k_dense_replace:
... | DeepseekV3DecoderLayer |
python | huggingface__transformers | src/transformers/models/decision_transformer/modeling_decision_transformer.py | {
"start": 16690,
"end": 18034
} | class ____(PreTrainedModel):
config: DecisionTransformerConfig
base_model_prefix = "transformer"
supports_gradient_checkpointing = True
_can_compile_fullgraph = False
def __init__(self, *inputs, **kwargs):
super().__init__(*inputs, **kwargs)
@torch.no_grad()
def _init_weights(self... | DecisionTransformerGPT2PreTrainedModel |
python | PyCQA__pylint | tests/functional/i/init_not_called.py | {
"start": 219,
"end": 307
} | class ____:
"""ancestor 1"""
def __init__(self):
print("init", self)
| AAAA |
python | numpy__numpy | numpy/random/tests/test_random.py | {
"start": 68318,
"end": 71278
} | class ____:
def _create_arrays(self):
return np.array([2]), np.array([3]), np.array([4]), (1,)
def test_one_arg_funcs(self):
argOne, _, _, tgtShape = self._create_arrays()
funcs = (np.random.exponential, np.random.standard_gamma,
np.random.chisquare, np.random.standard_... | TestSingleEltArrayInput |
python | huggingface__transformers | src/transformers/models/longcat_flash/modular_longcat_flash.py | {
"start": 1878,
"end": 2275
} | class ____(DeepseekV3MLP):
def __init__(self, config, hidden_size=None, intermediate_size=None):
super().__init__(config)
self.hidden_size = config.hidden_size if hidden_size is None else hidden_size
self.intermediate_size = config.ffn_hidden_size if intermediate_size is None else intermedia... | LongcatFlashMLP |
python | django-compressor__django-compressor | compressor/tests/test_utils.py | {
"start": 1734,
"end": 2153
} | class ____(TestCase):
def test_get_class_import_exception(self):
with self.assertRaises(FilterError) as context:
get_class("common.uglify.JsUglifySourcemapCompressor")
self.assertTrue(
(
"Failed to import common.uglify.JsUglifySourcemapCompressor. "
... | TestGetClass |
python | sympy__sympy | sympy/physics/secondquant.py | {
"start": 4075,
"end": 4130
} | class ____(Expr):
is_commutative = True
| TensorSymbol |
python | kamyu104__LeetCode-Solutions | Python/maximum-total-reward-using-operations-i.py | {
"start": 81,
"end": 526
} | class ____(object):
def maxTotalReward(self, rewardValues):
"""
:type rewardValues: List[int]
:rtype: int
"""
mx = max(rewardValues)
dp = 1
mask = (1<<mx)-1
for v in sorted(set(rewardValues)):
x = dp&((1<<v)-1)
dp |= (x<<v)&mask... | Solution |
python | mlflow__mlflow | dev/clint/src/clint/rules/markdown_link.py | {
"start": 36,
"end": 249
} | class ____(Rule):
def _message(self) -> str:
return (
"Markdown link is not supported in docstring. "
"Use reST link instead (e.g., `Link text <link URL>`_)."
)
| MarkdownLink |
python | python-poetry__poetry | src/poetry/puzzle/exceptions.py | {
"start": 509,
"end": 788
} | class ____(Exception):
def __init__(self, *overrides: dict[Package, dict[str, Dependency]]) -> None:
self._overrides = overrides
@property
def overrides(self) -> tuple[dict[Package, dict[str, Dependency]], ...]:
return self._overrides
| OverrideNeededError |
python | dagster-io__dagster | python_modules/automation/automation/dagster_docs/docstring_rules/base.py | {
"start": 312,
"end": 766
} | class ____:
"""Context information for validation rules."""
docstring: str
symbol_path: str
processed_rst: Optional[str] = None
def with_processed_rst(self, rst: str) -> "ValidationContext":
"""Return a new context with processed RST content."""
return ValidationContext(
... | ValidationContext |
python | huggingface__transformers | src/transformers/models/edgetam_video/modeling_edgetam_video.py | {
"start": 7325,
"end": 9965
} | class ____(nn.Module):
"""
Vision Rotary Position Embedding for SAM2, following transformers library standards.
Supports 2D (axial) rotary embeddings for spatial dimensions.
"""
def __init__(self, config: EdgeTamVideoConfig, end_x: Optional[int] = None, end_y: Optional[int] = None):
super()... | EdgeTamVideoVisionRotaryEmbedding |
python | dagster-io__dagster | python_modules/libraries/dagster-papertrail/dagster_papertrail/loggers.py | {
"start": 91,
"end": 2420
} | class ____(logging.Filter):
hostname = socket.gethostname()
def filter(self, record):
record.hostname = ContextFilter.hostname
return True
@logger(
{
"log_level": Field(StringSource, is_required=False, default_value="INFO"),
"name": Field(StringSource, is_required=False, d... | ContextFilter |
python | getsentry__sentry | src/sentry/grouping/grouptype.py | {
"start": 831,
"end": 1289
} | class ____(GroupType):
type_id = DEFAULT_TYPE_ID
slug = "error"
description = "Error"
category = GroupCategory.ERROR.value
category_v2 = GroupCategory.ERROR.value
default_priority = PriorityLevel.MEDIUM
released = True
detector_settings = DetectorSettings(
handler=ErrorDetectorHa... | ErrorGroupType |
python | gevent__gevent | src/greentest/3.10/test_asyncore.py | {
"start": 26608,
"end": 26753
} | class ____(TestAPI_UseUnixSockets, unittest.TestCase):
use_poll = True
if __name__ == "__main__":
unittest.main()
| TestAPI_UseUnixSocketsPoll |
python | ray-project__ray | python/ray/_private/log_monitor.py | {
"start": 1422,
"end": 4066
} | class ____:
def __init__(
self,
filename=None,
size_when_last_opened=None,
file_position=None,
file_handle=None,
is_err_file=False,
job_id=None,
worker_pid=None,
):
assert (
filename is not None
and size_when_last_op... | LogFileInfo |
python | great-expectations__great_expectations | contrib/great_expectations_zipcode_expectations/great_expectations_zipcode_expectations/expectations/expect_column_values_to_be_valid_tennessee_zip.py | {
"start": 752,
"end": 1759
} | class ____(ColumnMapMetricProvider):
# This is the id string that will be used to reference your metric.
condition_metric_name = "column_values.valid_tennessee_zip"
# This method implements the core logic for the PandasExecutionEngine
@column_condition_partial(engine=PandasExecutionEngine)
def _pan... | ColumnValuesToBeValidTennesseeZip |
python | huggingface__transformers | src/transformers/models/align/modeling_align.py | {
"start": 13543,
"end": 16560
} | class ____(nn.Module):
r"""
This corresponds to the block module of original the EfficientNet vision encoder implementation.
Args:
config ([`AlignVisionConfig`]):
Model configuration class.
in_dim (`int`):
Number of input channels.
out_dim (`int`):
... | AlignVisionBlock |
python | django__django | tests/admin_views/models.py | {
"start": 20143,
"end": 20319
} | class ____(models.Model):
name = models.CharField(max_length=100)
age = models.PositiveIntegerField()
is_employee = models.BooleanField(null=True)
| ComplexSortedPerson |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 464336,
"end": 464873
} | class ____(sgqlc.types.Type):
"""Autogenerated return type of AddEnterpriseOrganizationMember"""
__schema__ = github_schema
__field_names__ = ("client_mutation_id", "users")
client_mutation_id = sgqlc.types.Field(String, graphql_name="clientMutationId")
"""A unique identifier for the client perform... | AddEnterpriseOrganizationMemberPayload |
python | sympy__sympy | sympy/matrices/immutable.py | {
"start": 3917,
"end": 5591
} | class ____(SparseRepMatrix, ImmutableRepMatrix): # type:ignore
"""Create an immutable version of a sparse matrix.
Examples
========
>>> from sympy import eye, ImmutableSparseMatrix
>>> ImmutableSparseMatrix(1, 1, {})
Matrix([[0]])
>>> ImmutableSparseMatrix(eye(3))
Matrix([
[1, 0, ... | ImmutableSparseMatrix |
python | getsentry__sentry | src/sentry/auth/access.py | {
"start": 29826,
"end": 40230
} | class ____(OrganizationlessAccess):
def __init__(self) -> None:
super().__init__(
auth_state=RpcAuthState(
sso_state=RpcMemberSsoState(is_required=False, is_valid=True),
permissions=[],
),
)
def from_request_org_and_scopes(
*,
request... | NoAccess |
python | apache__airflow | task-sdk/src/airflow/sdk/exceptions.py | {
"start": 1484,
"end": 1659
} | class ____(AirflowException):
"""Raise when the requested object/resource is not available in the system."""
status_code = HTTPStatus.NOT_FOUND
| AirflowNotFoundException |
python | charliermarsh__ruff | crates/ruff_python_formatter/resources/test/fixtures/ruff/statement/top_level.py | {
"start": 47,
"end": 115
} | class ____:
def __init__(self):
pass
def foo():
pass
| B |
python | pytorch__pytorch | torch/_library/fake_impl.py | {
"start": 4765,
"end": 8772
} | class ____:
"""
Context object for writing fake implementations for custom operators.
"""
def __init__(self, _fake_mode, _op):
self._fake_mode = _fake_mode
self._shape_env = _fake_mode.shape_env
self._op = _op
@deprecated(
"`create_unbacked_symint` is deprecated, pl... | FakeImplCtx |
python | huggingface__transformers | src/transformers/models/minimax/modular_minimax.py | {
"start": 28917,
"end": 29215
} | class ____(MixtralForQuestionAnswering):
pass
__all__ = [
"MiniMaxConfig",
"MiniMaxPreTrainedModel",
"MiniMaxModel",
"MiniMaxForCausalLM",
"MiniMaxForSequenceClassification",
"MiniMaxForTokenClassification",
"MiniMaxForQuestionAnswering",
]
| MiniMaxForQuestionAnswering |
python | ray-project__ray | python/ray/_private/thirdparty/pynvml/pynvml.py | {
"start": 65411,
"end": 65785
} | class ____(_PrintableStructure):
_fields_ = [
('vgpuInstance', _nvmlVgpuInstance_t),
('pid', c_uint),
('processName', c_char * NVML_VGPU_NAME_BUFFER_SIZE),
('timeStamp', c_ulonglong),
('smUtil', c_uint),
('memUtil', c_uint),
('encUtil', c_uint),
('decU... | c_nvmlVgpuProcessUtilizationSample_t |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/genericType4.py | {
"start": 353,
"end": 571
} | class ____(Base2[float], Generic[T]):
pass
val2_1: Base2[float] = Derived2[int]()
# This should generate an error because Derived2[int]
# isn't assignable to Base2[int].
val2_2: Base2[int] = Derived2[int]()
| Derived2 |
python | Textualize__textual | tests/snapshot_tests/snapshot_apps/mount_style_fix.py | {
"start": 184,
"end": 669
} | class ____(App[None]):
CSS = """
Screen {
align: center middle;
}
Static {
width: 50%;
height: 50%;
border: solid;
}
Screen.go-red Static {
background: red;
}
"""
def compose(self) -> ComposeResult:
yield Static("This should have a r... | BrokenClassesApp |
python | astropy__astropy | astropy/visualization/tests/test_norm.py | {
"start": 1037,
"end": 7586
} | class ____:
def test_invalid_interval(self):
with pytest.raises(TypeError):
ImageNormalize(vmin=2.0, vmax=10.0, interval=ManualInterval, clip=True)
def test_invalid_vmin_vmax(self):
with pytest.raises(ValueError):
norm = ImageNormalize(vmin=10.0, vmax=2.0)
no... | TestNormalize |
python | ray-project__ray | python/ray/tests/unit/test_runtime_env_validation.py | {
"start": 6226,
"end": 7557
} | class ____:
def test_validate_conda_invalid_types(self):
with pytest.raises(TypeError):
parse_and_validate_conda(1)
with pytest.raises(TypeError):
parse_and_validate_conda(True)
def test_validate_conda_str(self):
assert parse_and_validate_conda("my_env_name") ==... | TestValidateConda |
python | huggingface__transformers | tests/models/colqwen2/test_modeling_colqwen2.py | {
"start": 10494,
"end": 15266
} | class ____(unittest.TestCase):
model_name: ClassVar[str] = "vidore/colqwen2-v1.0-hf"
def setUp(self):
self.processor = ColQwen2Processor.from_pretrained(self.model_name)
def tearDown(self):
cleanup(torch_device, gc_collect=True)
@require_bitsandbytes
@slow
def test_model_integ... | ColQwen2ModelIntegrationTest |
python | getsentry__sentry | src/sentry/api/endpoints/rule_snooze.py | {
"start": 10357,
"end": 12387
} | class ____(BaseRuleSnoozeEndpoint[AlertRule]):
owner = ApiOwner.ISSUES
publish_status = {
"DELETE": ApiPublishStatus.PRIVATE,
"POST": ApiPublishStatus.PRIVATE,
}
rule_field = "alert_rule"
@track_alert_endpoint_execution("POST", "sentry-api-0-metric-rule-snooze")
def post(self, r... | MetricRuleSnoozeEndpoint |
python | django__django | tests/defer_regress/models.py | {
"start": 2493,
"end": 2550
} | class ____(Base):
other_text = models.TextField()
| Derived |
python | pandas-dev__pandas | pandas/tests/arrays/categorical/test_repr.py | {
"start": 681,
"end": 27255
} | class ____:
def test_big_print(self):
codes = np.array([0, 1, 2, 0, 1, 2] * 100)
dtype = CategoricalDtype(categories=Index(["a", "b", "c"], dtype=object))
factor = Categorical.from_codes(codes, dtype=dtype)
expected = [
"['a', 'b', 'c', 'a', 'b', ..., 'b', 'c', 'a', 'b', ... | TestCategoricalRepr |
python | kubernetes-client__python | kubernetes/client/models/v1_csi_volume_source.py | {
"start": 383,
"end": 8057
} | 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... | V1CSIVolumeSource |
python | langchain-ai__langchain | libs/core/langchain_core/indexing/api.py | {
"start": 7651,
"end": 8994
} | class ____:
def __init__(self, *args: Any, **kwargs: Any) -> None:
"""Raise an error if this class is instantiated."""
msg = (
"_HashedDocument is an internal abstraction that was deprecated in "
" langchain-core 0.3.63. This abstraction is marked as private and "
... | _HashedDocument |
python | huggingface__transformers | src/transformers/models/perception_lm/modeling_perception_lm.py | {
"start": 4068,
"end": 5400
} | class ____(BaseModelOutputWithPast):
r"""
past_key_values (`Cache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`):
It is a [`~cache_utils.Cache`] instance. For more details, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache).
C... | PerceptionLMModelOutputWithPast |
python | getsentry__sentry | src/sentry/uptime/migrations/0048_delete_uptime_status_columns.py | {
"start": 240,
"end": 1722
} | 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 | ray-project__ray | python/ray/air/execution/resources/placement_group.py | {
"start": 554,
"end": 1374
} | class ____(AcquiredResources):
placement_group: PlacementGroup
def _annotate_remote_entity(
self, entity: RemoteRayEntity, bundle: Dict[str, float], bundle_index: int
) -> RemoteRayEntity:
bundle = bundle.copy()
num_cpus = bundle.pop("CPU", 0)
num_gpus = bundle.pop("GPU", 0)... | PlacementGroupAcquiredResources |
python | kamyu104__LeetCode-Solutions | Python/roman-to-integer.py | {
"start": 29,
"end": 475
} | class ____(object):
# @return an integer
def romanToInt(self, s):
numeral_map = {"I": 1, "V": 5, "X": 10, "L": 50, "C":100, "D": 500, "M": 1000}
decimal = 0
for i in xrange(len(s)):
if i > 0 and numeral_map[s[i]] > numeral_map[s[i - 1]]:
decimal += numeral_map... | Solution |
python | spack__spack | lib/spack/spack/spec.py | {
"start": 51954,
"end": 53800
} | class ____:
def __init__(self) -> None:
self.original_spec_format = SPECFILE_FORMAT_VERSION
self.compiler_node_attribute: Optional["Spec"] = None
def with_spec_format(self, spec_format: int) -> "SpecAnnotations":
self.original_spec_format = spec_format
return self
def with_... | SpecAnnotations |
python | tensorflow__tensorflow | tensorflow/compiler/mlir/tfr/python/test_utils.py | {
"start": 795,
"end": 1803
} | class ____(test.TestCase):
"""Test utils."""
def _assertOpAndComposite(self, vars_, compute_op, compute_composite, kwargs,
op_kwargs=None):
if op_kwargs is None:
op_kwargs = kwargs
if test_util.IsMklEnabled():
self.skipTest("Not compatible with oneDNN custom ops.")
... | OpsDefsTest |
python | PrefectHQ__prefect | src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py | {
"start": 263776,
"end": 264157
} | 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(
"CreatedPullRequestReviewContribution", gra... | CreatedPullRequestReviewContributionEdge |
python | keras-team__keras | keras/src/ops/numpy.py | {
"start": 159520,
"end": 160298
} | class ____(Operation):
def call(self, x1, x2):
return backend.numpy.not_equal(x1, x2)
def compute_output_spec(self, x1, x2):
x1_shape = getattr(x1, "shape", [])
x2_shape = getattr(x2, "shape", [])
output_shape = broadcast_shapes(x1_shape, x2_shape)
return KerasTensor(out... | NotEqual |
python | Lightning-AI__lightning | tests/tests_pytorch/checkpointing/test_model_checkpoint.py | {
"start": 43274,
"end": 43483
} | class ____(Callback):
def on_before_optimizer_step(self, trainer, pl_module, optimizer):
if trainer.current_epoch == 1:
raise RuntimeError("Trouble!")
| TroubleCallbackOnBeforeOptimizerStep |
python | realpython__materials | python-guitar-synthesizer/source_code_final/demo/play_diablo.py | {
"start": 1111,
"end": 1278
} | class ____:
SLOW = Time.from_milliseconds(40)
FAST = Time.from_milliseconds(20)
SUPER_FAST = Time.from_milliseconds(5)
@dataclass(frozen=True)
| StrummingSpeed |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/typeVar9.py | {
"start": 2486,
"end": 2664
} | class ____(Generic[_T]):
# This should generate an error because _T can go unsolved.
def __init__(self, x: _T = ...) -> None: ...
_T2 = TypeVar("_T2", default=int)
| ClassA |
python | pydata__xarray | xarray/computation/rolling.py | {
"start": 47202,
"end": 50059
} | class ____(Coarsen["Dataset"]):
__slots__ = ()
_reduce_extra_args_docstring = """"""
@classmethod
def _reduce_method(
cls, func: Callable, include_skipna: bool = False, numeric_only: bool = False
) -> Callable[..., Dataset]:
"""
Return a wrapped function for injecting reduc... | DatasetCoarsen |
python | huggingface__transformers | src/transformers/models/granite/modeling_granite.py | {
"start": 5423,
"end": 8640
} | class ____(nn.Module):
"""Multi-headed attention from 'Attention Is All You Need' paper"""
def __init__(self, config: GraniteConfig, layer_idx: Optional[int] = None):
super().__init__()
self.config = config
self.layer_idx = layer_idx
self.head_dim = getattr(config, "head_dim", c... | GraniteAttention |
python | vyperlang__vyper | vyper/ast/nodes.py | {
"start": 36416,
"end": 36518
} | class ____(Operator):
__slots__ = ()
_description = "greater-or-equal"
_op = operator.ge
| GtE |
python | ansible__ansible | lib/ansible/module_utils/facts/network/sunos.py | {
"start": 856,
"end": 4650
} | class ____(GenericBsdIfconfigNetwork):
"""
This is the SunOS Network Class.
It uses the GenericBsdIfconfigNetwork.
Solaris can have different FLAGS and MTU for IPv4 and IPv6 on the same interface
so these facts have been moved inside the 'ipv4' and 'ipv6' lists.
"""
platform = 'SunOS'
... | SunOSNetwork |
python | realpython__materials | python-formatted-output/person.py | {
"start": 0,
"end": 425
} | class ____:
def __init__(self, name, age):
self.name = name
self.age = age
def __str__(self):
return f"I'm {self.name}, and I'm {self.age} years old."
def __repr__(self):
return f"{type(self).__name__}(name='{self.name}', age={self.age})"
jane = Person("Jane", 25)
print(f... | Person |
python | pytorch__pytorch | torch/testing/_internal/distributed/distributed_utils.py | {
"start": 220,
"end": 1871
} | class ____(dist.ProcessGroup):
def getBackendName(self):
return "mock_process_group"
def create_mock_pg(prefix_store, rank, world_size, timeout):
return MockProcessGroup(rank, world_size)
dist.Backend.register_backend("mock_process_group", create_mock_pg)
def mock_init_dist(rank, world_size):
... | MockProcessGroup |
python | huggingface__transformers | tests/quantization/mxfp4/test_mxfp4.py | {
"start": 1858,
"end": 3741
} | class ____(unittest.TestCase):
def test_basic_config_creation(self):
"""Test basic configuration creation with default values"""
config = Mxfp4Config()
self.assertEqual(config.quant_method.value, "mxfp4")
self.assertIsNone(config.modules_to_not_convert)
self.assertFalse(confi... | Mxfp4ConfigTest |
python | streamlit__streamlit | lib/tests/streamlit/runtime/state/widgets_test.py | {
"start": 12236,
"end": 13095
} | class ____(unittest.TestCase):
def test_get_widget_with_generated_key(self):
element_id = compute_and_register_element_id(
"button",
label="the label",
user_key="my_key",
dg=None,
key_as_main_identity=False,
)
assert element_id.star... | WidgetHelperTests |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.