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 | yaml__pyyaml | lib/yaml/emitter.py | {
"start": 967,
"end": 43006
} | class ____:
DEFAULT_TAG_PREFIXES = {
'!' : '!',
'tag:yaml.org,2002:' : '!!',
}
def __init__(self, stream, canonical=None, indent=None, width=None,
allow_unicode=None, line_break=None):
# The stream should have the methods `write` and possibly `flush`.
self.stre... | Emitter |
python | kamyu104__LeetCode-Solutions | Python/online-majority-element-in-subarray.py | {
"start": 1170,
"end": 2769
} | class ____(object):
def __init__(self, arr):
"""
:type arr: List[int]
"""
self.__arr = arr
self.__inv_idx = collections.defaultdict(list)
for i, x in enumerate(self.__arr):
self.__inv_idx[x].append(i)
self.__bound = int(round((len(arr)**0.5)))
... | MajorityChecker2 |
python | geekcomputers__Python | venv/Lib/site-packages/pip/_internal/network/download.py | {
"start": 3794,
"end": 4825
} | class ____:
def __init__(
self,
session: PipSession,
progress_bar: str,
) -> None:
self._session = session
self._progress_bar = progress_bar
def __call__(self, link: Link, location: str) -> Tuple[str, str]:
"""Download the file given by link into location."""... | Downloader |
python | huggingface__transformers | tests/models/videomae/test_modeling_videomae.py | {
"start": 6592,
"end": 16495
} | class ____(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
"""
Here we also overwrite some of the tests of test_modeling_common.py, as VideoMAE does not use input_ids, inputs_embeds,
attention_mask and seq_length.
"""
all_model_classes = (
(VideoMAEModel, VideoMAEForPreTraining, ... | VideoMAEModelTest |
python | scrapy__scrapy | scrapy/exceptions.py | {
"start": 326,
"end": 564
} | class ____(TypeError):
"""
Indicates an invalid value has been returned by a middleware's processing method.
Internal and undocumented, it should not be raised or caught by user code.
"""
# HTTP and crawling
| _InvalidOutput |
python | spack__spack | var/spack/test_repos/spack_repo/builtin_mock/packages/dtuse/package.py | {
"start": 217,
"end": 459
} | class ____(Package):
"""Simple package which uses dttop"""
homepage = "http://www.example.com"
url = "http://www.example.com/dtuse-1.0.tar.gz"
version("1.0", md5="0123456789abcdef0123456789abcdef")
depends_on("dttop")
| Dtuse |
python | pytorch__pytorch | test/test_dispatch.py | {
"start": 1559,
"end": 39166
} | class ____(TestCase):
namespace_index = 0
def test_all_invariants(self):
# Check that the regular stuff is OK!
C._dispatch_check_all_invariants()
# You probably don't want to call this directly; if your constructors
# don't commute, you can still run commute with a fixed ctor_order
... | TestDispatch |
python | airbytehq__airbyte | airbyte-ci/connectors/connectors_qa/tests/unit_tests/test_checks/test_security.py | {
"start": 3713,
"end": 5281
} | class ____:
def test_fail_when_dockerfile_exists(self, mocker, tmp_path):
# Arrange
connector = mocker.MagicMock(code_directory=tmp_path)
dockerfile = tmp_path / "Dockerfile"
dockerfile.touch()
# Act
result = security.CheckConnectorUsesPythonBaseImage()._run(connecto... | TestCheckConnectorUsesPythonBaseImage |
python | django-extensions__django-extensions | tests/management/commands/test_sync_s3.py | {
"start": 8335,
"end": 8979
} | class ____(SyncS3TestsMixin, TestCase):
@override_settings(
AWS_ACCESS_KEY_ID="access_key_id",
AWS_SECRET_ACCESS_KEY="secret_access_key",
AWS_BUCKET_NAME="bucket_name",
)
@patch("sys.stdout", new_callable=StringIO)
def test_should_raise_CommandError_when_medi(self, m_stdout):
... | SyncS3CommandTests |
python | donnemartin__interactive-coding-challenges | math_probability/check_prime/test_check_prime.py | {
"start": 18,
"end": 536
} | class ____(unittest.TestCase):
def test_check_prime(self):
math = Math()
self.assertRaises(TypeError, math.check_prime, None)
self.assertRaises(TypeError, math.check_prime, 98.6)
self.assertEqual(math.check_prime(0), False)
self.assertEqual(math.check_prime(1), False)
... | TestMath |
python | PyCQA__pydocstyle | src/tests/test_cases/expected.py | {
"start": 0,
"end": 617
} | class ____:
"""Hold expectation for pep257 violations in tests."""
def __init__(self):
self.expected = set()
def expect(self, *args, arg_count=0, func_name=""):
"""Decorator that expects a certain PEP 257 violation."""
# The `arg_count` parameter helps the decorator
# with ... | Expectation |
python | langchain-ai__langchain | libs/langchain/langchain_classic/base_memory.py | {
"start": 702,
"end": 3599
} | class ____(Serializable, ABC):
"""Abstract base class for memory in Chains.
Memory refers to state in Chains. Memory can be used to store information about
past executions of a Chain and inject that information into the inputs of
future executions of the Chain. For example, for conversational C... | BaseMemory |
python | getsentry__sentry | tests/sentry/hybridcloud/tasks/test_deliver_webhooks.py | {
"start": 22067,
"end": 31321
} | class ____(TestCase):
@responses.activate
def test_drain_missing_payload(self) -> None:
drain_mailbox_parallel(99)
assert len(responses.calls) == 0
@responses.activate
def test_drain_unknown_region(self) -> None:
webhook_one = self.create_webhook_payload(
mailbox_nam... | DrainMailboxParallelTest |
python | qdrant__qdrant-client | qdrant_client/http/models/models.py | {
"start": 34205,
"end": 34431
} | class ____(BaseModel, extra="forbid"):
left: "Expression" = Field(..., description="")
right: "Expression" = Field(..., description="")
by_zero_default: Optional[float] = Field(default=None, description="")
| DivParams |
python | pypa__warehouse | warehouse/manage/forms.py | {
"start": 17376,
"end": 18428
} | class ____(wtforms.Form):
__params__ = ["organization"]
organization = wtforms.SelectField(
"Select organization",
choices=[("", "Select organization")],
validators=[
wtforms.validators.InputRequired(message="Select organization"),
],
)
def __init__(self, *a... | TransferOrganizationProjectForm |
python | ray-project__ray | python/ray/tests/test_placement_group_3.py | {
"start": 5189,
"end": 23886
} | class ____:
def ready(self):
return True
for bundle_index in range(2):
actor = Actor.options(lifetime="detached",
scheduling_strategy=PlacementGroupSchedulingStrategy(placement_group=pg,
placement_group_bundle_index=bundle_index)).remote()
ray.get(actor.ready.remote())
ray.... | Actor |
python | allegroai__clearml | clearml/backend_api/services/v2_20/tasks.py | {
"start": 381435,
"end": 383088
} | class ____(Request):
"""
Set the script requirements for a task
:param task: Task ID
:type task: str
:param requirements: A JSON object containing requirements strings by key
:type requirements: dict
"""
_service = "tasks"
_action = "set_requirements"
_version = "2.20"
_sch... | SetRequirementsRequest |
python | neetcode-gh__leetcode | python/1029-two-city-scheduling.py | {
"start": 0,
"end": 385
} | class ____:
def twoCitySchedCost(self, costs: List[List[int]]) -> int:
diffs = []
for c1, c2 in costs:
diffs.append([c2 - c1, c1, c2])
diffs.sort()
res = 0
for i in range(len(diffs)):
if i < len(diffs) / 2:
res += diffs[i][2]
... | Solution |
python | scrapy__scrapy | scrapy/contracts/default.py | {
"start": 991,
"end": 1353
} | class ____(Contract):
"""Contract to set metadata arguments for the request.
The value should be JSON-encoded dictionary, e.g.:
@meta {"arg1": "some value"}
"""
name = "meta"
def adjust_request_args(self, args: dict[str, Any]) -> dict[str, Any]:
args["meta"] = json.loads(" ".join(self... | MetadataContract |
python | walkccc__LeetCode | solutions/3248. Snake in Matrix/3248.py | {
"start": 0,
"end": 343
} | class ____:
def finalPositionOfSnake(self, n: int, commands: list[str]) -> int:
directions = {
"UP": (-1, 0),
"RIGHT": (0, 1),
"DOWN": (1, 0),
"LEFT": (0, -1),
}
i = 0
j = 0
for command in commands:
dx, dy = directions[command]
i += dx
j += dy
... | Solution |
python | fastapi__sqlmodel | docs_src/tutorial/code_structure/tutorial001/models.py | {
"start": 306,
"end": 652
} | class ____(SQLModel, table=True):
id: Optional[int] = Field(default=None, primary_key=True)
name: str = Field(index=True)
secret_name: str
age: Optional[int] = Field(default=None, index=True)
team_id: Optional[int] = Field(default=None, foreign_key="team.id")
team: Optional[Team] = Relationship... | Hero |
python | plotly__plotly.py | plotly/graph_objs/scattermap/_marker.py | {
"start": 233,
"end": 31049
} | class ____(_BaseTraceHierarchyType):
_parent_path_str = "scattermap"
_path_str = "scattermap.marker"
_valid_props = {
"allowoverlap",
"angle",
"anglesrc",
"autocolorscale",
"cauto",
"cmax",
"cmid",
"cmin",
"color",
"coloraxis",
... | Marker |
python | networkx__networkx | networkx/linalg/tests/test_laplacian.py | {
"start": 103,
"end": 13953
} | class ____:
@classmethod
def setup_class(cls):
deg = [3, 2, 2, 1, 0]
cls.G = nx.havel_hakimi_graph(deg)
cls.WG = nx.Graph(
(u, v, {"weight": 0.5, "other": 0.3}) for (u, v) in cls.G.edges()
)
cls.WG.add_node(4)
cls.MG = nx.MultiGraph(cls.G)
# G... | TestLaplacian |
python | dask__dask | dask/_task_spec.py | {
"start": 27057,
"end": 27119
} | class ____(NestedContainer):
constructor = klass = list
| List |
python | apache__airflow | airflow-core/src/airflow/exceptions.py | {
"start": 4224,
"end": 4330
} | class ____(AirflowNotFoundException):
"""Raise when a DAG is not available in the system."""
| DagNotFound |
python | qdrant__qdrant-client | qdrant_client/qdrant_remote.py | {
"start": 1352,
"end": 109008
} | class ____(QdrantBase):
DEFAULT_GRPC_TIMEOUT = 5 # seconds
DEFAULT_GRPC_POOL_SIZE = 3
def __init__(
self,
url: Optional[str] = None,
port: Optional[int] = 6333,
grpc_port: int = 6334,
prefer_grpc: bool = False,
https: Optional[bool] = None,
api_key: ... | QdrantRemote |
python | wandb__wandb | wandb/sdk/internal/_generated/server_features_query.py | {
"start": 210,
"end": 335
} | class ____(GQLResult):
server_info: Optional[ServerFeaturesQueryServerInfo] = Field(alias="serverInfo")
| ServerFeaturesQuery |
python | huggingface__transformers | src/transformers/models/llava_onevision/modeling_llava_onevision.py | {
"start": 32119,
"end": 44951
} | class ____(LlavaOnevisionPreTrainedModel, GenerationMixin):
_checkpoint_conversion_mapping = {
r"^language_model.model": "model.language_model",
r"^vision_tower": "model.vision_tower",
r"^multi_modal_projector": "model.multi_modal_projector",
r"^image_newline": "model.image_newline",... | LlavaOnevisionForConditionalGeneration |
python | catalyst-team__catalyst | catalyst/contrib/datasets/misc_cv.py | {
"start": 184,
"end": 2476
} | class ____(ImageFolderDataset):
"""
Base class for datasets with the following structure:
.. code-block:: bash
path/to/dataset/
|-- train/
| |-- class1/ # folder of N images
| | |-- train_image11
| | |-- train_image12
| | ...
| | `... | ImageClassificationDataset |
python | fastapi__sqlmodel | docs_src/tutorial/connect/select/tutorial004.py | {
"start": 254,
"end": 2190
} | class ____(SQLModel, table=True):
id: Optional[int] = Field(default=None, primary_key=True)
name: str = Field(index=True)
secret_name: str
age: Optional[int] = Field(default=None, index=True)
team_id: Optional[int] = Field(default=None, foreign_key="team.id")
sqlite_file_name = "database.db"
sqli... | Hero |
python | django__django | django/contrib/postgres/constraints.py | {
"start": 557,
"end": 664
} | class ____(IndexExpression):
template = "%(expressions)s WITH %(operator)s"
| ExclusionConstraintExpression |
python | yaml__pyyaml | lib/yaml/tokens.py | {
"start": 1915,
"end": 2112
} | class ____(Token):
id = '<anchor>'
def __init__(self, value, start_mark, end_mark):
self.value = value
self.start_mark = start_mark
self.end_mark = end_mark
| AnchorToken |
python | google__jax | tests/pallas/mosaic_gpu_test.py | {
"start": 5874,
"end": 89740
} | class ____(PallasTest):
def test_jitted_function_containing_multiple_pallas_calls(self):
# This test aims to ensure that execution works correctly inside CUDA
# graphs. This is complementary to the test in
# jaxlib/mosaic/gpu/custom_call_test.cc that checks that such jitted
# functions do invoke CUDA... | PallasCallTest |
python | dagster-io__dagster | python_modules/dagster/dagster/_core/execution/context/logger.py | {
"start": 389,
"end": 2170
} | class ____:
"""The context object available as the argument to the initialization function of a :py:class:`dagster.LoggerDefinition`.
Users should not instantiate this object directly. To construct an
`InitLoggerContext` for testing purposes, use :py:func:`dagster.
build_init_logger_context`.
Exam... | InitLoggerContext |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/uninitializedVariable2.py | {
"start": 989,
"end": 1021
} | class ____(IAbstract):
p3: int
| I |
python | django__django | tests/generic_inline_admin/tests.py | {
"start": 11126,
"end": 11400
} | class ____(SimpleTestCase):
def test_no_deletion(self):
inline = MediaPermanentInline(EpisodePermanent, admin_site)
fake_request = object()
formset = inline.get_formset(fake_request)
self.assertFalse(formset.can_delete)
| NoInlineDeletionTest |
python | pytorch__pytorch | torch/distributed/fsdp/api.py | {
"start": 2904,
"end": 5102
} | class ____(Enum):
"""
This configures explicit backward prefetching, which improves throughput by
enabling communication and computation overlap in the backward pass at the
cost of slightly increased memory usage.
- ``BACKWARD_PRE``: This enables the most overlap but increases memory
usage th... | BackwardPrefetch |
python | davidhalter__jedi | test/completion/usages.py | {
"start": 2590,
"end": 2826
} | class ____(object):
#< 8 (0,8), (2,13)
def a_method(self):
#< 13 (-2,8), (0,13)
self.a_method()
#< 13 (2,8), (0,13), (3,13)
self.b_method()
def b_method(self):
self.b_method
| TestMethods |
python | pytorch__pytorch | torch/utils/benchmark/op_fuzzers/unary.py | {
"start": 321,
"end": 3154
} | class ____(Fuzzer):
def __init__(self, seed, dtype=torch.float32, cuda=False) -> None:
super().__init__(
parameters=[
# Dimensionality of x. (e.g. 1D, 2D, or 3D.)
FuzzedParameter("dim", distribution={1: 0.3, 2: 0.4, 3: 0.3}, strict=True),
# Shapes... | UnaryOpFuzzer |
python | huggingface__transformers | src/transformers/models/qwen3_omni_moe/modeling_qwen3_omni_moe.py | {
"start": 85587,
"end": 104927
} | class ____(
Qwen3OmniMoePreTrainedModelForConditionalGeneration, GenerationMixin
):
config: Qwen3OmniMoeThinkerConfig
base_model_prefix = "thinker"
_tied_weights_keys = {"lm_head.weight": "model.embed_tokens.weight"}
_no_split_modules = [
"Qwen3OmniMoeAudioEncoderLayer",
"Qwen3OmniMo... | Qwen3OmniMoeThinkerForConditionalGeneration |
python | pallets__werkzeug | examples/i18nurls/application.py | {
"start": 1836,
"end": 2865
} | class ____:
def __init__(self):
from i18nurls import views
self.not_found = views.page_not_found
def __call__(self, environ, start_response):
urls = map.bind_to_environ(environ)
req = Request(environ, urls)
try:
endpoint, args = urls.match(req.path)
... | Application |
python | keras-team__keras | keras/src/layers/reshaping/zero_padding1d_test.py | {
"start": 157,
"end": 2719
} | class ____(testing.TestCase):
@parameterized.parameters(
{"data_format": "channels_first"},
{"data_format": "channels_last"},
)
def test_zero_padding_1d(self, data_format):
inputs = np.random.rand(1, 2, 3)
outputs = layers.ZeroPadding1D(padding=(1, 2), data_format=data_format... | ZeroPadding1DTest |
python | huggingface__transformers | src/transformers/models/falcon_mamba/modular_falcon_mamba.py | {
"start": 11078,
"end": 25556
} | class ____(MambaMixer):
def warn_slow_implementation(self):
causal_conv1d = lazy_load_kernel("causal-conv1d")
causal_conv1d_update, causal_conv1d_fn = (
(causal_conv1d.causal_conv1d_update, causal_conv1d.causal_conv1d_fn)
if causal_conv1d is not None
else (None, N... | FalconMambaMixer |
python | fastai__fastai | fastai/vision/models/unet.py | {
"start": 783,
"end": 2091
} | class ____(Module):
"A quasi-UNet block, using `PixelShuffle_ICNR upsampling`."
@delegates(ConvLayer.__init__)
def __init__(self, up_in_c, x_in_c, hook, final_div=True, blur=False, act_cls=defaults.activation,
self_attention=False, init=nn.init.kaiming_normal_, norm_type=None, **kwargs):
... | UnetBlock |
python | django-extensions__django-extensions | tests/management/commands/test_list_signals.py | {
"start": 118,
"end": 845
} | class ____(TestCase):
"""Tests for list_signals command."""
def setUp(self):
self.out = StringIO()
def test_should_print_all_signals(self):
expected_result = """django.contrib.sites.models.Site (site)
pre_delete
django.contrib.sites.models.clear_site_cache #
pre_save
... | ListSignalsTests |
python | doocs__leetcode | solution/3700-3799/3746.Minimum String Length After Balanced Removals/Solution.py | {
"start": 0,
"end": 143
} | class ____:
def minLengthAfterRemovals(self, s: str) -> int:
a = s.count("a")
b = len(s) - a
return abs(a - b)
| Solution |
python | networkx__networkx | networkx/generators/tests/test_geometric.py | {
"start": 170,
"end": 2527
} | class ____:
"""Unit tests for :func:`~networkx.random_geometric_graph`"""
def test_number_of_nodes(self):
G = nx.random_geometric_graph(50, 0.25, seed=42)
assert len(G) == 50
G = nx.random_geometric_graph(range(50), 0.25, seed=42)
assert len(G) == 50
def test_distances(self... | TestRandomGeometricGraph |
python | apache__airflow | providers/amazon/src/airflow/providers/amazon/aws/operators/dms.py | {
"start": 6712,
"end": 8512
} | class ____(AwsBaseOperator[DmsHook]):
"""
Describes AWS DMS replication tasks.
.. seealso::
For more information on how to use this operator, take a look at the guide:
:ref:`howto/operator:DmsDescribeTasksOperator`
:param describe_tasks_kwargs: Describe tasks command arguments
:par... | DmsDescribeTasksOperator |
python | mlflow__mlflow | tests/transformers/test_transformers_llm_inference_utils.py | {
"start": 2476,
"end": 10776
} | class ____(NamedTuple):
data: Any
params: Any
expected_data: Any
expected_params: Any
@pytest.mark.parametrize(
"case",
[
# Case 0: Data only includes prompt
_TestCase(
data=pd.DataFrame({"prompt": ["Hello world!"]}),
params={},
expected_data... | _TestCase |
python | pytorch__pytorch | torch/_functorch/_aot_autograd/descriptors.py | {
"start": 16243,
"end": 16584
} | class ____(DifferentiableAOTInput):
"""The input is a buffer, whose FQN is target"""
target: str
def expr(self) -> str:
return f"self.get_buffer({self.target!r})"
def is_param(self) -> bool:
return False
def is_buffer(self) -> bool:
return True
@dataclasses.dataclass(fr... | BufferAOTInput |
python | walkccc__LeetCode | solutions/97. Interleaving String/97.py | {
"start": 0,
"end": 717
} | class ____:
def isInterleave(self, s1: str, s2: str, s3: str) -> bool:
m = len(s1)
n = len(s2)
if m + n != len(s3):
return False
# dp[i][j] := true if s3[0..i + j) is formed by the interleaving of
# s1[0..i) and s2[0..j)
dp = [[False] * (n + 1) for _ in range(m + 1)]
dp[0][0] = True... | Solution |
python | doocs__leetcode | solution/0400-0499/0494.Target Sum/Solution.py | {
"start": 0,
"end": 496
} | class ____:
def findTargetSumWays(self, nums: List[int], target: int) -> int:
s = sum(nums)
if s < target or (s - target) % 2:
return 0
m, n = len(nums), (s - target) // 2
f = [[0] * (n + 1) for _ in range(m + 1)]
f[0][0] = 1
for i, x in enumerate(nums, 1)... | Solution |
python | django__django | tests/auth_tests/urls.py | {
"start": 2797,
"end": 2964
} | class ____(View):
def get(self, request, *args, **kwargs):
return HttpResponse()
@method_decorator(login_not_required, name="dispatch")
| EmptyResponseBaseView |
python | huggingface__transformers | src/transformers/models/deberta/configuration_deberta.py | {
"start": 778,
"end": 7173
} | class ____(PreTrainedConfig):
r"""
This is the configuration class to store the configuration of a [`DebertaModel`]. It is
used to instantiate a DeBERTa model according to the specified arguments, defining the model architecture.
Instantiating a configuration with the defaults will yield a similar confi... | DebertaConfig |
python | getsentry__sentry | src/sentry/api/fields/serializedfile.py | {
"start": 292,
"end": 425
} | class ____(SentryAPIException):
status_code = 413
default_detail = "File too large"
default_code = "too_large"
| FileTooLarge |
python | neetcode-gh__leetcode | python/0001-two-sum.py | {
"start": 0,
"end": 287
} | class ____:
def twoSum(self, nums: List[int], target: int) -> List[int]:
prevMap = {} # val -> index
for i, n in enumerate(nums):
diff = target - n
if diff in prevMap:
return [prevMap[diff], i]
prevMap[n] = i
| Solution |
python | getsentry__sentry | src/sentry/api/serializers/models/dashboard.py | {
"start": 12113,
"end": 12476
} | class ____(Serializer):
def serialize(self, obj, attrs, user, **kwargs) -> OnDemandResponse:
return {
"enabled": obj.extraction_enabled(),
"extractionState": obj.extraction_state,
"dashboardWidgetQueryId": obj.dashboard_widget_query_id,
}
@register(DashboardWidg... | DashboardWidgetQueryOnDemandSerializer |
python | jmcnamara__XlsxWriter | xlsxwriter/test/comparison/test_chart_theme07.py | {
"start": 350,
"end": 2146
} | class ____(ExcelComparisonTest):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.set_filename("chart_theme07.xlsx")
def test_create_file(self):
"""Test the creation of an XlsxWriter file with chart formatting."""
workbook = Wo... | TestCompareXLSXFiles |
python | doocs__leetcode | solution/2900-2999/2913.Subarrays Distinct Element Sum of Squares I/Solution.py | {
"start": 0,
"end": 267
} | class ____:
def sumCounts(self, nums: List[int]) -> int:
ans, n = 0, len(nums)
for i in range(n):
s = set()
for j in range(i, n):
s.add(nums[j])
ans += len(s) * len(s)
return ans
| Solution |
python | getsentry__sentry | tests/sentry/hybridcloud/test_organization.py | {
"start": 10576,
"end": 15103
} | class ____(TestCase):
def test_get_audit_log_metadata(self) -> None:
org = self.create_organization(owner=self.user)
user = self.create_user(email="foobar@sentry.io")
member = self.create_member(user_id=user.id, role="owner", organization_id=org.id)
self.create_team(organization=org,... | RpcOrganizationMemberTest |
python | xlwings__xlwings | xlwings/constants.py | {
"start": 32653,
"end": 32915
} | class ____:
xlCalculationAutomatic = -4105 # from enum XlCalculation
xlCalculationManual = -4135 # from enum XlCalculation
xlCalculationSemiautomatic = 2 # from enum XlCalculation
calculations = ("automatic", "manual", "semiautomatic")
| Calculation |
python | apache__avro | lang/py/avro/test/test_io.py | {
"start": 14692,
"end": 16114
} | class ____(unittest.TestCase):
def __init__(self, write_type: str, read_type: str) -> None:
"""Ignore the normal signature for unittest.TestCase because we are generating
many test cases from this one class. This is safe as long as the autoloader
ignores this class. The autoloader will ignor... | SchemaPromotionTestCase |
python | modin-project__modin | asv_bench/benchmarks/benchmarks.py | {
"start": 38778,
"end": 39145
} | class ____:
params = [get_benchmark_shapes("TimeIsnull")]
param_names = ["shape"]
def setup(self, shape):
sample = np.array([np.nan, 1.0])
data = np.random.choice(sample, (shape[0], shape[1]))
self.df = IMPL.DataFrame(data)
execute(self.df)
def time_isnull(self, shape):... | TimeIsnull |
python | huggingface__transformers | src/transformers/models/ernie4_5_moe/modular_ernie4_5_moe.py | {
"start": 1717,
"end": 2159
} | class ____(Qwen3MoeMLP):
def __init__(self, config, intermediate_size=None):
super().__init__(config, intermediate_size)
self.gate_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=config.use_bias)
self.up_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=config.... | Ernie4_5_MoeMLP |
python | keras-team__keras | keras/src/backend/jax/core_test.py | {
"start": 570,
"end": 2433
} | class ____(testing.TestCase):
def setup(self):
super().setup()
class NNXModel(nnx.Module):
def __init__(self, rngs):
self.linear = nnx.Linear(2, 3, rngs=rngs)
# Use NnxVariable directly as KerasJaxVariable
# might be JaxVariable if NNX is ... | NnxVariableTest |
python | pydantic__pydantic | pydantic-core/tests/test_errors.py | {
"start": 30162,
"end": 33009
} | class ____(enum.Enum):
CAUSE = enum.auto()
NO_CAUSE = enum.auto()
IMPORT_ERROR = enum.auto()
@pytest.mark.parametrize(
'desc,config,expected_result',
[ # Without the backport should still work after 3.10 as not needed:
(
'Enabled',
CoreConfig(validation_error_cause... | CauseResult |
python | getsentry__sentry | src/sentry/relay/types/rule_condition.py | {
"start": 1173,
"end": 1296
} | class ____(TypedDict):
"""Less than condition"""
op: Literal["lt"]
name: str
value: Value | None
| LtCondition |
python | numba__numba | numba/core/debuginfo.py | {
"start": 571,
"end": 1528
} | class ____(metaclass=abc.ABCMeta):
@abc.abstractmethod
def mark_variable(self, builder, allocavalue, name, lltype, size, line,
datamodel=None, argidx=None):
"""Emit debug info for the variable.
"""
pass
@abc.abstractmethod
def mark_location(self, builder, l... | AbstractDIBuilder |
python | walkccc__LeetCode | solutions/2149. Rearrange Array Elements by Sign/2149.py | {
"start": 0,
"end": 247
} | class ____:
def rearrangeArray(self, nums: list[int]) -> list[int]:
ans = []
pos = []
neg = []
for num in nums:
(pos if num > 0 else neg).append(num)
for p, n in zip(pos, neg):
ans += [p, n]
return ans
| Solution |
python | doocs__leetcode | solution/0300-0399/0331.Verify Preorder Serialization of a Binary Tree/Solution.py | {
"start": 0,
"end": 347
} | class ____:
def isValidSerialization(self, preorder: str) -> bool:
stk = []
for c in preorder.split(","):
stk.append(c)
while len(stk) > 2 and stk[-1] == stk[-2] == "#" and stk[-3] != "#":
stk = stk[:-3]
stk.append("#")
return len(stk) ... | Solution |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/solver15.py | {
"start": 438,
"end": 543
} | class ____: ...
E = TypeVar("E", bound=F)
def coercer_method(value: E | str, enum: type[E]) -> E: ...
| F |
python | arrow-py__arrow | arrow/locales.py | {
"start": 84997,
"end": 87267
} | class ____(Locale):
names = ["hu", "hu-hu"]
past = "{0} ezelőtt"
future = "{0} múlva"
timeframes: ClassVar[Mapping[TimeFrameLiteral, Union[str, Mapping[str, str]]]] = {
"now": "éppen most",
"second": {"past": "egy második", "future": "egy második"},
"seconds": {"past": "{0} más... | HungarianLocale |
python | huggingface__transformers | src/transformers/models/csm/modeling_csm.py | {
"start": 6352,
"end": 9343
} | class ____(nn.Module):
inv_freq: torch.Tensor # fix linting for `register_buffer`
def __init__(self, config: CsmConfig, device=None):
super().__init__()
self.max_seq_len_cached = config.max_position_embeddings
self.original_max_seq_len = config.max_position_embeddings
self.con... | CsmRotaryEmbedding |
python | tensorflow__tensorflow | tensorflow/python/keras/engine/training_v1.py | {
"start": 3544,
"end": 125150
} | class ____(training_lib.Model):
"""`Model` groups layers into an object with training and inference features.
There are two ways to instantiate a `Model`:
1 - With the "functional API", where you start from `Input`,
you chain layer calls to specify the model's forward pass,
and finally you create your model... | Model |
python | RaRe-Technologies__gensim | gensim/models/hdpmodel.py | {
"start": 4149,
"end": 5037
} | class ____:
"""Stores sufficient statistics for the current chunk of document(s) whenever Hdp model is updated with new corpus.
These stats are used when updating lambda and top level sticks. The statistics include number of documents in the
chunk, length of words in the documents and top level truncation l... | SuffStats |
python | ray-project__ray | python/ray/tests/test_client_reconnect.py | {
"start": 3630,
"end": 7642
} | class ____(ray_client_pb2_grpc.RayletDriverServicer):
"""
Forwards all requests to the raylet driver servicer. Useful for injecting
errors between a client and server pair.
"""
def __init__(
self, on_request: Optional[Hook] = None, on_response: Optional[Hook] = None
):
"""
... | MiddlemanRayletServicer |
python | encode__django-rest-framework | tests/test_bound_fields.py | {
"start": 3717,
"end": 8368
} | class ____:
def test_nested_empty_bound_field(self):
class Nested(serializers.Serializer):
more_text = serializers.CharField(max_length=100)
amount = serializers.IntegerField()
class ExampleSerializer(serializers.Serializer):
text = serializers.CharField(max_leng... | TestNestedBoundField |
python | kubernetes-client__python | kubernetes/client/models/v1_daemon_set_status.py | {
"start": 383,
"end": 15485
} | 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... | V1DaemonSetStatus |
python | numba__numba | numba/core/typing/setdecl.py | {
"start": 2669,
"end": 3209
} | class ____(AbstractTemplate):
def generic(self, args, kws):
if len(args) != 2:
return
a, b = args
if isinstance(a, types.Set) and isinstance(b, types.Set) and a == b:
return signature(types.boolean, *args)
for op_key in (operator.add, operator.invert):
@infer_g... | SetComparison |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 309599,
"end": 310107
} | class ____(sgqlc.types.Input):
"""Ways in which team discussion comment connections can be ordered."""
__schema__ = github_schema
__field_names__ = ("field", "direction")
field = sgqlc.types.Field(sgqlc.types.non_null(TeamDiscussionCommentOrderField), graphql_name="field")
"""The field by which to ... | TeamDiscussionCommentOrder |
python | spyder-ide__spyder | spyder/plugins/statusbar/plugin.py | {
"start": 794,
"end": 8390
} | class ____(SpyderPluginV2):
"""Status bar plugin."""
NAME = 'statusbar'
REQUIRES = [Plugins.Preferences]
CONTAINER_CLASS = StatusBarContainer
CONF_SECTION = NAME
CONF_FILE = False
CONF_WIDGET_CLASS = StatusBarConfigPage
STATUS_WIDGETS = {}
EXTERNAL_RIGHT_WIDGETS = {}
EXTERNAL_L... | StatusBar |
python | dask__dask | dask/tests/test_task_spec.py | {
"start": 5878,
"end": 11933
} | class ____:
deserialized = False
serialized = False
def __getstate__(self):
if SerializeOnlyOnce.serialized:
raise RuntimeError()
SerializeOnlyOnce.serialized = True
return {}
def __setstate__(self, state):
if SerializeOnlyOnce.deserialized:
rais... | SerializeOnlyOnce |
python | huggingface__transformers | src/transformers/models/longformer/modeling_longformer.py | {
"start": 9855,
"end": 12713
} | class ____(ModelOutput):
r"""
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Total span extraction loss is the sum of a Cross-Entropy for the start and end positions.
attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=Tru... | LongformerQuestionAnsweringModelOutput |
python | doocs__leetcode | solution/1300-1399/1331.Rank Transform of an Array/Solution.py | {
"start": 0,
"end": 157
} | class ____:
def arrayRankTransform(self, arr: List[int]) -> List[int]:
t = sorted(set(arr))
return [bisect_right(t, x) for x in arr]
| Solution |
python | matplotlib__matplotlib | lib/matplotlib/patches.py | {
"start": 41622,
"end": 44411
} | class ____(Patch):
"""Wedge shaped patch."""
def __str__(self):
pars = (self.center[0], self.center[1], self.r,
self.theta1, self.theta2, self.width)
fmt = "Wedge(center=(%g, %g), r=%g, theta1=%g, theta2=%g, width=%s)"
return fmt % pars
@_docstring.interpd
def _... | Wedge |
python | fastapi__sqlmodel | docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial001_py39.py | {
"start": 114,
"end": 353
} | class ____(SQLModel, table=True):
id: Optional[int] = Field(default=None, primary_key=True)
name: str = Field(index=True)
headquarters: str
heroes: list["Hero"] = Relationship(back_populates="team", cascade_delete=True)
| Team |
python | fluentpython__example-code-2e | 24-class-metaprog/tinyenums/microenum.py | {
"start": 728,
"end": 1084
} | class ____(dict):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.__next_value = 0
def __missing__(self, key):
if key.startswith('__') and key.endswith('__'):
raise KeyError(key)
self[key] = value = self.__next_value
self.__next_va... | WilyDict |
python | scipy__scipy | benchmarks/benchmarks/go_benchmark_functions/go_funcs_M.py | {
"start": 218,
"end": 1197
} | class ____(Benchmark):
r"""
Matyas objective function.
This class defines the Matyas [1]_ global optimization problem. This is a
multimodal minimization problem defined as follows:
.. math::
f_{\text{Matyas}}(x) = 0.26(x_1^2 + x_2^2) - 0.48 x_1 x_2
with :math:`x_i \in [-10, 10]` fo... | Matyas |
python | kubernetes-client__python | kubernetes/client/models/v1beta1_ip_address.py | {
"start": 383,
"end": 6626
} | 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... | V1beta1IPAddress |
python | fastai__fastai | fastai/callback/schedule.py | {
"start": 3661,
"end": 7825
} | class ____(Callback):
"Schedule hyper-parameters according to `scheds`"
order,run_valid = 60,False
def __init__(self, scheds): self.scheds = scheds
def before_fit(self): self.hps = {p:[] for p in self.scheds.keys()}
def before_batch(self): self._update_val(self.pct_train)
def _update_val(self,... | ParamScheduler |
python | apache__airflow | airflow-ctl/src/airflowctl/api/datamodels/generated.py | {
"start": 37441,
"end": 38187
} | class ____(BaseModel):
"""
Request body for bulk update, and delete task instances.
"""
model_config = ConfigDict(
extra="forbid",
)
new_state: TaskInstanceState | None = None
note: Annotated[Note | None, Field(title="Note")] = None
include_upstream: Annotated[bool | None, Field... | BulkTaskInstanceBody |
python | allegroai__clearml | clearml/backend_api/services/v2_13/workers.py | {
"start": 25100,
"end": 28049
} | class ____(NonStrictDataModel):
"""
:param id: ID
:type id: str
:param name: Name
:type name: str
:param running_time: Task running time
:type running_time: int
:param last_iteration: Last task iteration
:type last_iteration: int
"""
_schema = {
"properties": {
... | CurrentTaskEntry |
python | pola-rs__polars | py-polars/src/polars/datatypes/classes.py | {
"start": 32079,
"end": 35530
} | class ____(NestedType):
"""
Fixed length list type.
Parameters
----------
inner
The `DataType` of the values within each array.
shape
The shape of the arrays.
width
The length of the arrays.
.. deprecated:: 0.20.31
The `width` parameter for `Arra... | Array |
python | run-llama__llama_index | llama-index-experimental/llama_index/experimental/param_tuner/base.py | {
"start": 3789,
"end": 6374
} | class ____(BaseParamTuner):
"""
Async Parameter tuner.
Args:
param_dict(Dict): A dictionary of parameters to iterate over.
Example param_dict:
{
"num_epochs": [10, 20],
"batch_size": [8, 16, 32],
}
fixed_param_dict(Dict): A... | AsyncParamTuner |
python | sympy__sympy | sympy/codegen/ast.py | {
"start": 36897,
"end": 40787
} | class ____(FloatBaseType):
""" Represents a floating point type with fixed bit width.
Base 2 & one sign bit is assumed.
Parameters
==========
name : str
Name of the type.
nbits : integer
Number of bits used (storage).
nmant : integer
Number of bits used to represen... | FloatType |
python | allegroai__clearml | clearml/backend_api/services/v2_23/dataviews.py | {
"start": 148373,
"end": 173123
} | class ____(Request):
"""
Get dataview information
:param dataview: Datatview ID
:type dataview: str
:param name: Dataview name
:type name: str
:param description: Dataview description
:type description: str
:param project: Project ID of the project to which this task is assigned
... | UpdateRequest |
python | PyCQA__pylint | tests/functional/m/membership_protocol.py | {
"start": 1590,
"end": 1833
} | class ____:
valid_values = None
def validate(self, value):
if self.valid_values is None:
return True
else:
# error should not be emitted here
return value in self.valid_values
| BaseThing |
python | urllib3__urllib3 | src/urllib3/exceptions.py | {
"start": 2161,
"end": 2910
} | class ____(RequestError):
"""Raised when the maximum number of retries is exceeded.
:param pool: The connection pool
:type pool: :class:`~urllib3.connectionpool.HTTPConnectionPool`
:param str url: The requested Url
:param reason: The underlying error
:type reason: :class:`Exception`
"""
... | MaxRetryError |
python | openai__openai-python | src/openai/resources/images.py | {
"start": 47429,
"end": 93923
} | class ____(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncImagesWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.git... | AsyncImages |
python | pytorch__pytorch | torch/fx/passes/backends/cudagraphs.py | {
"start": 354,
"end": 2079
} | class ____(OperatorSupport):
# TODO: why is submodules passed here
def is_node_supported(self, submodules, node: torch.fx.Node) -> bool:
if node.op not in CALLABLE_NODE_OPS:
return False
if node.target is torch.ops.aten.embedding_dense_backward.default:
return False
... | CudaGraphsSupport |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.