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 | python-poetry__poetry | src/poetry/installation/wheel_installer.py | {
"start": 718,
"end": 2021
} | class ____(SchemeDictionaryDestination):
""" """
def write_to_fs(
self,
scheme: Scheme,
path: str,
stream: BinaryIO,
is_executable: bool,
) -> RecordEntry:
from installer.records import Hash
from installer.records import RecordEntry
from insta... | WheelDestination |
python | walkccc__LeetCode | solutions/3137. Minimum Number of Operations to Make Word K-Periodic/3137.py | {
"start": 0,
"end": 215
} | class ____:
def minimumOperationsToMakeKPeriodic(self, word: str, k: int) -> int:
count = collections.Counter(word[i:i + k] for i in range(0, len(word), k))
return len(word) // k - max(count.values())
| Solution |
python | vyperlang__vyper | vyper/builtins/functions.py | {
"start": 75797,
"end": 76251
} | class ____(BuiltinFunctionT):
_id = "breakpoint"
_inputs: list = []
_warned = False
def fetch_call_return(self, node):
if not self._warned:
vyper_warn("`breakpoint` should only be used for debugging!", node)
self._warned = True
return None
@process_inputs
... | Breakpoint |
python | huggingface__transformers | src/transformers/models/rembert/modeling_rembert.py | {
"start": 31710,
"end": 36112
} | class ____(RemBertPreTrainedModel, GenerationMixin):
def __init__(self, config):
super().__init__(config)
if not config.is_decoder:
logger.warning("If you want to use `RemBertForCausalLM` as a standalone, add `is_decoder=True.`")
self.rembert = RemBertModel(config, add_pooling_... | RemBertForCausalLM |
python | viewflow__viewflow | viewflow/forms/renderers.py | {
"start": 15418,
"end": 18510
} | class ____:
"""Default form layout."""
def append_non_field_errors(self, form: forms.Form, root: ElementTree.Element):
errors = form.non_field_errors()
errors.extend(
error
for bound_field in form.hidden_fields()
if bound_field.errors
for error in... | FormLayout |
python | wandb__wandb | wandb/sdk/artifacts/_generated/delete_artifact_portfolio.py | {
"start": 569,
"end": 869
} | class ____(GQLResult):
typename__: Typename[
Literal["ArtifactCollection", "ArtifactPortfolio", "ArtifactSequence"]
]
state: ArtifactCollectionState
DeleteArtifactPortfolio.model_rebuild()
DeleteArtifactPortfolioResult.model_rebuild()
| DeleteArtifactPortfolioResultArtifactCollection |
python | modin-project__modin | modin/tests/pandas/native_df_interoperability/test_compiler_caster.py | {
"start": 5634,
"end": 6220
} | class ____(CalculatorTestQc):
"Represents a query compiler with very few resources"
def get_backend(self):
return "Pico"
@classmethod
def max_cost(cls):
return QCCoercionCost.COST_LOW
def move_to_cost(self, other_qc_cls, api_cls_name, op, arguments):
return {
C... | PicoQC |
python | apache__airflow | providers/amazon/tests/unit/amazon/aws/utils/test_connection_wrapper.py | {
"start": 1633,
"end": 2787
} | class ____:
@pytest.mark.parametrize("extra", [{"foo": "bar", "spam": "egg"}, '{"foo": "bar", "spam": "egg"}', None])
def test_compat_with_connection(self, extra):
"""Simple compatibility test with `airflow.models.connection.Connection`."""
conn_kwargs = {
"conn_id": MOCK_AWS_CONN_ID... | TestsConnectionMetadata |
python | PrefectHQ__prefect | src/integrations/prefect-dbt/prefect_dbt/cloud/exceptions.py | {
"start": 899,
"end": 1004
} | class ____(DbtCloudException):
"""Raised when unable to retrieve dbt Cloud job."""
| DbtCloudGetJobFailed |
python | dask__dask | dask/dataframe/dask_expr/_expr.py | {
"start": 92044,
"end": 92119
} | class ____(Binop):
operation = operator.and_
_operator_repr = "&"
| And |
python | astropy__astropy | astropy/table/tests/test_masked.py | {
"start": 1350,
"end": 3614
} | class ____:
"""Test the filled method in MaskedColumn and Table"""
def setup_method(self, method):
mask = [True, False, False]
self.meta = {"a": 1, "b": [2, 3]}
self.a = MaskedColumn(
name="a", data=[1, 2, 3], fill_value=10, mask=mask, meta={"a": 1}
)
self.b ... | TestFilled |
python | pypa__virtualenv | src/virtualenv/create/via_global_ref/builtin/ref.py | {
"start": 2778,
"end": 3519
} | class ____(PathRef, ABC):
"""Base class that checks if a executable can be references via symlink/copy."""
def __init__(self, src, must=RefMust.NA, when=RefWhen.ANY) -> None:
super().__init__(src, must, when)
self._can_run = None
@property
def can_symlink(self):
if self.FS_SUPP... | ExePathRef |
python | joke2k__faker | faker/providers/file/en_US/__init__.py | {
"start": 42,
"end": 81
} | class ____(FileProvider):
pass
| Provider |
python | getsentry__sentry | src/sentry/uptime/types.py | {
"start": 2761,
"end": 3194
} | class ____:
"""
Represents a check entry response from the EAP API.
"""
uptime_check_id: str
timestamp: datetime
scheduled_check_time: datetime
check_status: CheckStatus
check_status_reason: CheckStatusReasonType | None
http_status_code: int | None
duration_ms: int
trace_id:... | EapCheckEntry |
python | pytorch__pytorch | test/test_datapipe.py | {
"start": 102337,
"end": 109144
} | class ____(TestCase):
class CustomIterDataPipe(IterDataPipe):
def add_v(self, x):
return x + self.v
def __init__(self, source_dp, v=1):
self._dp = source_dp.map(self.add_v)
self.v = 1
def __iter__(self):
yield from self._dp
def __has... | TestGraph |
python | Netflix__metaflow | metaflow/decorators.py | {
"start": 901,
"end": 1478
} | class ____(MetaflowException):
headline = "Syntax error"
def __init__(self, deco, func):
msg = (
"You tried to apply decorator '{deco}' on '{func}' which is "
"not declared as a @step. Make sure you apply this decorator "
"on a function which has @step on the line ju... | BadStepDecoratorException |
python | bokeh__bokeh | src/bokeh/models/widgets/sliders.py | {
"start": 4076,
"end": 4560
} | class ____(AbstractSlider):
""" Base class for numerical sliders. """
# explicit __init__ to support Init signatures
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)
format = Either(String, Instance(TickFormatter), help="""
""")
#-------------------... | NumericalSlider |
python | walkccc__LeetCode | solutions/1486. XOR Operation in an Array/1486.py | {
"start": 0,
"end": 174
} | class ____:
def xorOperation(self, n: int, start: int) -> int:
return functools.reduce(operator.xor,
[start + 2 * i for i in range(n)])
| Solution |
python | huggingface__transformers | src/transformers/models/data2vec/modular_data2vec_audio.py | {
"start": 4431,
"end": 4487
} | class ____(Wav2Vec2Adapter):
pass
| Data2VecAudioAdapter |
python | tiangolo__fastapi | tests/test_additional_responses_custom_model_in_callback.py | {
"start": 200,
"end": 5895
} | class ____(BaseModel):
a: int
app = FastAPI()
callback_router = APIRouter(default_response_class=JSONResponse)
@callback_router.get(
"{$callback_url}/callback/", responses={400: {"model": CustomModel}}
)
def callback_route():
pass # pragma: no cover
@app.post("/", callbacks=callback_router.routes)
d... | CustomModel |
python | anthropics__anthropic-sdk-python | src/anthropic/types/beta/beta_clear_tool_uses_20250919_edit_param.py | {
"start": 698,
"end": 1485
} | class ____(TypedDict, total=False):
type: Required[Literal["clear_tool_uses_20250919"]]
clear_at_least: Optional[BetaInputTokensClearAtLeastParam]
"""Minimum number of tokens that must be cleared when triggered.
Context will only be modified if at least this many tokens can be removed.
"""
cl... | BetaClearToolUses20250919EditParam |
python | kamyu104__LeetCode-Solutions | Python/course-schedule.py | {
"start": 950,
"end": 1670
} | class ____(object):
def canFinish(self, numCourses, prerequisites):
"""
:type numCourses: int
:type prerequisites: List[List[int]]
:rtype: List[int]
"""
adj = collections.defaultdict(list)
in_degree = collections.Counter()
for u, v in prerequisites:
... | Solution2 |
python | run-llama__llama_index | llama-index-integrations/evaluation/llama-index-evaluation-tonic-validate/llama_index/evaluation/tonic_validate/retrieval_precision.py | {
"start": 360,
"end": 2007
} | class ____(BaseEvaluator):
"""
Tonic Validate's retrieval precision metric.
The output score is a float between 0.0 and 1.0.
See https://docs.tonic.ai/validate/ for more details.
Args:
openai_service(OpenAIService): The OpenAI service to use. Specifies the chat
completion mode... | RetrievalPrecisionEvaluator |
python | pytorch__pytorch | torch/_inductor/fx_passes/control_dependencies.py | {
"start": 557,
"end": 7926
} | class ____(HigherOrderOperator):
"""
Higher-order operator that enforces ordering by making dependencies explicit.
Schema: control_deps(additional_deps, target, *args, **kwargs) -> result
where:
- additional_deps: tuple of tensors that must be computed before this op
- subgraph: GraphModule con... | ControlDeps |
python | kubernetes-client__python | kubernetes/client/models/v1_volume_error.py | {
"start": 383,
"end": 5618
} | 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... | V1VolumeError |
python | getsentry__sentry | src/sentry/api/helpers/group_index/validators/group.py | {
"start": 787,
"end": 4755
} | class ____(serializers.Serializer[Group]):
inbox = serializers.BooleanField(
help_text="If true, marks the issue as reviewed by the requestor."
)
status = serializers.ChoiceField(
help_text="Limit mutations to only issues with the given status.",
choices=list(zip(STATUS_UPDATE_CHOICE... | GroupValidator |
python | coleifer__peewee | tests/prefetch_tests.py | {
"start": 704,
"end": 808
} | class ____(TestModel):
note = ForeignKeyField(Note, backref='flags')
is_spam = BooleanField()
| Flag |
python | pandas-dev__pandas | pandas/io/html.py | {
"start": 3555,
"end": 16986
} | class ____:
"""
Base class for parsers that parse HTML into DataFrames.
Parameters
----------
io : str or file-like
This can be either a string path, a valid URL using the HTTP,
FTP, or FILE protocols or a file-like object.
match : str or regex
The text to match in the ... | _HtmlFrameParser |
python | pytorch__pytorch | test/ao/sparsity/test_kernels.py | {
"start": 9178,
"end": 9413
} | class ____(nn.Module):
def __init__(self, in_channels, out_channels):
super().__init__()
self.linear = nn.Linear(in_channels, out_channels)
def forward(self, x):
return self.linear(x)
| SparseQuantizedModel |
python | huggingface__transformers | tests/models/bert_japanese/test_tokenization_bert_japanese.py | {
"start": 17885,
"end": 18187
} | class ____(unittest.TestCase):
def test_tokenizer_bert_japanese(self):
EXAMPLE_BERT_JAPANESE_ID = "cl-tohoku/bert-base-japanese"
tokenizer = AutoTokenizer.from_pretrained(EXAMPLE_BERT_JAPANESE_ID)
self.assertIsInstance(tokenizer, BertJapaneseTokenizer)
| AutoTokenizerCustomTest |
python | PrefectHQ__prefect | src/prefect/server/database/orm_models.py | {
"start": 37132,
"end": 37323
} | class ____(Base):
key: Mapped[str] = mapped_column(index=True)
value: Mapped[dict[str, Any]] = mapped_column(JSON)
__table_args__: Any = (sa.UniqueConstraint("key"),)
| Configuration |
python | jmcnamara__XlsxWriter | xlsxwriter/test/comparison/test_escapes08.py | {
"start": 315,
"end": 1008
} | class ____(ExcelComparisonTest):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.set_filename("escapes08.xlsx")
def test_create_file(self):
"""Test the creation of a simple XlsxWriter file. Check encoding of url strings."""
w... | TestCompareXLSXFiles |
python | xlwings__xlwings | xlwings/constants.py | {
"start": 95443,
"end": 95692
} | class ____:
xlPivotLineBlank = 3 # from enum XlPivotLineType
xlPivotLineGrandTotal = 2 # from enum XlPivotLineType
xlPivotLineRegular = 0 # from enum XlPivotLineType
xlPivotLineSubtotal = 1 # from enum XlPivotLineType
| PivotLineType |
python | spyder-ide__spyder | spyder/widgets/emptymessage.py | {
"start": 764,
"end": 11593
} | class ____(QFrame, SvgToScaledPixmap, SpyderFontsMixin):
"""Widget to show a friendly message when another one is empty."""
def __init__(
self,
parent,
icon_filename: str | None = None,
text: str | None = None,
description: str | None = None,
top_stretch: int = 1... | EmptyMessageWidget |
python | Textualize__textual | docs/examples/widgets/header.py | {
"start": 80,
"end": 230
} | class ____(App):
def compose(self) -> ComposeResult:
yield Header()
if __name__ == "__main__":
app = HeaderApp()
app.run()
| HeaderApp |
python | sphinx-doc__sphinx | sphinx/domains/cpp/_ast.py | {
"start": 58974,
"end": 59910
} | class ____(ASTBase):
def __init__(self, value: ASTExpression) -> None:
self.value = value
def __eq__(self, other: object) -> bool:
if not isinstance(other, ASTTemplateArgConstant):
return NotImplemented
return self.value == other.value
def __hash__(self) -> int:
... | ASTTemplateArgConstant |
python | Pylons__pyramid | tests/test_traversal.py | {
"start": 30159,
"end": 32196
} | class ____(unittest.TestCase):
def _callFUT(self, resource, *elements):
from pyramid.traversal import resource_path_tuple
return resource_path_tuple(resource, *elements)
def test_it(self):
baz = DummyContext()
bar = DummyContext(baz)
foo = DummyContext(bar)
root... | ResourcePathTupleTests |
python | django-extensions__django-extensions | django_extensions/management/jobs.py | {
"start": 613,
"end": 661
} | class ____(BaseJob):
when = "weekly"
| WeeklyJob |
python | sqlalchemy__sqlalchemy | lib/sqlalchemy/testing/suite/test_reflection.py | {
"start": 12510,
"end": 13642
} | class ____(fixtures.TestBase):
__sparse_driver_backend__ = True
__requires__ = ("temp_table_reflection",)
@testing.fixture
def tablename(self):
return get_temp_table_name(
config, config.db, f"ident_tmp_{config.ident}"
)
@testing.requires.identity_columns
def test... | TempTableElementsTest |
python | doocs__leetcode | solution/2300-2399/2380.Time Needed to Rearrange a Binary String/Solution2.py | {
"start": 0,
"end": 246
} | class ____:
def secondsToRemoveOccurrences(self, s: str) -> int:
ans = cnt = 0
for c in s:
if c == '0':
cnt += 1
elif cnt:
ans = max(ans + 1, cnt)
return ans
| Solution |
python | django__django | tests/postgres_tests/models.py | {
"start": 1358,
"end": 1455
} | class ____(PostgreSQLModel):
field = ArrayField(models.CharField(max_length=10))
| CharArrayModel |
python | google__jax | jax/_src/interpreters/pxla.py | {
"start": 27200,
"end": 27427
} | class ____(NamedTuple):
sharded_avals: Sequence[core.AbstractValue]
out_sharded_avals: Sequence[core.ShapedArray]
global_sharded_avals: Sequence[core.AbstractValue]
num_local_shards: int
num_global_shards: int
| ShardInfo |
python | pytorch__pytorch | test/fx/test_pass_infra.py | {
"start": 439,
"end": 1206
} | class ____(PassBase):
def call(self, gm) -> PassResult:
modified = False
for node in gm.graph.nodes:
if node.op == "call_function" and node.target == torch.add:
node.target = torch.mul
modified = True
return PassResult(gm, modified)
# Pass that i... | ReplaceAddWithMulPass |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-microsoft-sharepoint/source_microsoft_sharepoint/utils.py | {
"start": 653,
"end": 4378
} | class ____(RemoteFile):
download_url: str
created_at: datetime
def filter_http_urls(files, logger):
for file in files:
if file.download_url.startswith("http") and not file.download_url.startswith("https"): # ignore-https-check
logger.error(f"Cannot open file {file.uri}. The URL return... | MicrosoftSharePointRemoteFile |
python | bokeh__bokeh | tests/unit/bokeh/core/test_has_props.py | {
"start": 14588,
"end": 14695
} | class ____(hp.HasProps, hp.Local):
f0 = Int(default=3)
f1 = List(Int, default=[3, 4, 5])
| Some0HasProps |
python | charliermarsh__ruff | crates/ruff_linter/resources/test/fixtures/pydoclint/DOC501_numpy.py | {
"start": 0,
"end": 3031
} | class ____(Exception):
...
# OK
def calculate_speed(distance: float, time: float) -> float:
"""
Calculate speed as distance divided by time.
Parameters
----------
distance : float
Distance traveled.
time : float
Time spent traveling.
Returns
-------
float
... | FasterThanLightError |
python | ray-project__ray | python/ray/train/v2/_internal/execution/train_fn_utils.py | {
"start": 835,
"end": 5488
} | class ____(ABC):
"""Utility class providing an abstraction layer between user-facing APIs
and :class:`~ray.train.v2.api.context.TrainContext`.
It should be set before the users' training function is called.
This class can be patched if new user APIs behaviors is wanted.
"""
@abstractmethod... | TrainFnUtils |
python | wandb__wandb | wandb/vendor/pygments/lexers/configs.py | {
"start": 20636,
"end": 23071
} | class ____(RegexLexer):
"""
Lexer for `terraformi .tf files <https://www.terraform.io/>`_.
.. versionadded:: 2.1
"""
name = 'Terraform'
aliases = ['terraform', 'tf']
filenames = ['*.tf']
mimetypes = ['application/x-tf', 'application/x-terraform']
tokens = {
'root': [
... | TerraformLexer |
python | pytorch__pytorch | torch/_export/utils.py | {
"start": 58257,
"end": 58835
} | class ____(torch.nn.Module):
def __init__(self, method):
super().__init__()
# share state of method's self module
_sync_state(method.__self__, self)
# redirect forward to method
self.forward = method
def wrap_method(method):
"""
Wrap a method as a module so that it ... | _WrappedMethod |
python | pydantic__pydantic | pydantic/_internal/_decorators.py | {
"start": 2120,
"end": 3050
} | class ____:
"""A container for data from `@field_validator` so that we can access it
while building the pydantic-core schema.
Attributes:
decorator_repr: A class variable representing the decorator string, '@field_validator'.
fields: A tuple of field names the validator should be called on.... | FieldValidatorDecoratorInfo |
python | airbytehq__airbyte | airbyte-ci/connectors/metadata_service/lib/metadata_service/models/generated/AirbyteInternal.py | {
"start": 221,
"end": 643
} | class ____(BaseModel):
class Config:
extra = Extra.allow
sl: Optional[Literal[0, 100, 200, 300]] = None
ql: Optional[Literal[0, 100, 200, 300, 400, 500, 600]] = None
isEnterprise: Optional[bool] = False
requireVersionIncrementsInPullRequests: Optional[bool] = Field(
True,
de... | AirbyteInternal |
python | huggingface__transformers | src/transformers/models/perceiver/modeling_perceiver.py | {
"start": 2443,
"end": 2845
} | class ____(ModelOutput):
r"""
logits (`torch.FloatTensor` of shape `(batch_size, num_labels)`):
Output of the basic decoder.
"""
logits: Optional[torch.FloatTensor] = None
cross_attentions: Optional[tuple[torch.FloatTensor]] = None
@dataclass
@auto_docstring(
custom_intro="""
Base... | PerceiverDecoderOutput |
python | Lightning-AI__lightning | tests/tests_pytorch/helpers/datasets.py | {
"start": 6677,
"end": 7179
} | class ____(Dataset):
def __init__(self, dataset_len=300, sequence_len=100):
self.dataset_len = dataset_len
self.sequence_len = sequence_len
self.input_seq = torch.randn(dataset_len, sequence_len, 10)
top, bottom = self.input_seq.chunk(2, -1)
self.output_seq = top + bottom.rol... | AverageDataset |
python | PrefectHQ__prefect | src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py | {
"start": 993117,
"end": 994503
} | class ____(sgqlc.types.Type, Node):
"""
See source code for more info.
"""
__schema__ = graphql_schema
__field_names__ = (
"created_at",
"is_one_time_payment",
"is_sponsor_opted_into_email",
"maintainer",
"privacy_level",
"sponsor",
"sponsor_e... | Sponsorship |
python | kamyu104__LeetCode-Solutions | Python/minimum-cost-to-make-array-equalindromic.py | {
"start": 2001,
"end": 2671
} | class ____(object):
def minimumCost(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
def nearest_palindromic(x):
n = str(x)
l = len(n)
result = {10**l+1, 10**(l-1)-1}
prefix = int(n[:(l+1)/2])
for i in map(str,... | Solution2 |
python | huggingface__transformers | src/transformers/models/kosmos2/modeling_kosmos2.py | {
"start": 3064,
"end": 5076
} | class ____(ModelOutput):
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).
Contains pre-... | Kosmos2ModelOutput |
python | pytorch__pytorch | test/profiler/test_record_function.py | {
"start": 1070,
"end": 8324
} | class ____(TestCase):
def _record_function_with_param(self):
u = torch.randn(3, 4, 5, requires_grad=True)
with _profile(
with_stack=True, use_kineto=kineto_available(), record_shapes=True
) as prof:
with record_function("## TEST 1 ##", "1, 2, 3"):
rf_h... | TestRecordFunction |
python | cython__cython | tests/run/py3k_super.py | {
"start": 352,
"end": 2105
} | class ____(A):
"""
>>> obj = B()
>>> obj.method()
1
>>> B.class_method()
2
>>> B.static_method(obj)
3
>>> list(obj.generator_test())
[1, 2, 3]
>>> obj.star_method()
1
>>> obj.starstar_method()
1
>>> obj.starstarstar_method()
1
>>> obj.star_class_method... | B |
python | walkccc__LeetCode | solutions/2672. Number of Adjacent Elements With the Same Color/2672.py | {
"start": 0,
"end": 544
} | class ____:
def colorTheArray(self, n: int, queries: list[list[int]]) -> list[int]:
ans = []
arr = [0] * n
sameColors = 0
for i, color in queries:
if i + 1 < n:
if arr[i + 1] > 0 and arr[i + 1] == arr[i]:
sameColors -= 1
if arr[i + 1] == color:
sameColors += ... | Solution |
python | celery__celery | celery/utils/threads.py | {
"start": 1028,
"end": 3213
} | class ____(threading.Thread):
"""Background service thread."""
def __init__(self, name=None, **kwargs):
super().__init__()
self.__is_shutdown = threading.Event()
self.__is_stopped = threading.Event()
self.daemon = True
self.name = name or self.__class__.__name__
def... | bgThread |
python | sphinx-doc__sphinx | sphinx/builders/gettext.py | {
"start": 4290,
"end": 4573
} | class ____(Tags):
"""Dummy tags module for I18nBuilder.
To ensure that all text inside ``only`` nodes is translated,
this class always returns ``True`` regardless the defined tags.
"""
def eval_condition(self, condition: Any) -> bool:
return True
| I18nTags |
python | openai__openai-python | tests/api_resources/audio/test_translations.py | {
"start": 393,
"end": 2283
} | class ____:
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
@parametrize
def test_method_create(self, client: OpenAI) -> None:
translation = client.audio.translations.create(
file=b"raw file contents",
model="whisper-1",... | TestTranslations |
python | pandas-dev__pandas | pandas/core/interchange/dataframe_protocol.py | {
"start": 2989,
"end": 4678
} | class ____(ABC):
"""
Data in the buffer is guaranteed to be contiguous in memory.
Note that there is no dtype attribute present, a buffer can be thought of
as simply a block of memory. However, if the column that the buffer is
attached to has a dtype that's supported by DLPack and ``__dlpack__`` is... | Buffer |
python | google__pytype | pytype/overlays/named_tuple.py | {
"start": 2629,
"end": 2848
} | class ____:
"""Args for both collections.namedtuple and typing.NamedTuple."""
name: str
field_names: list[str]
field_types: list[Any] | None = None
defaults: list[Any] | None = None
rename: bool = False
| _Args |
python | huggingface__transformers | tests/models/mobilevit/test_image_processing_mobilevit.py | {
"start": 1219,
"end": 3535
} | class ____:
def __init__(
self,
parent,
batch_size=7,
num_channels=3,
image_size=18,
min_resolution=30,
max_resolution=400,
do_resize=True,
size=None,
do_center_crop=True,
crop_size=None,
do_flip_channel_order=True,
... | MobileViTImageProcessingTester |
python | pyinstaller__pyinstaller | bootloader/waflib/Tools/asm.py | {
"start": 703,
"end": 1777
} | class ____(Task.Task):
color = 'BLUE'
run_str = '${AS} ${ASFLAGS} ${ASMPATH_ST:INCPATHS} ${DEFINES_ST:DEFINES} ${AS_SRC_F}${SRC} ${AS_TGT_F}${TGT}'
def scan(self):
if self.env.ASM_NAME == 'gas':
return c_preproc.scan(self)
Logs.warn('There is no dependency scanner for Nasm!'... | asm |
python | pydantic__pydantic | pydantic/v1/errors.py | {
"start": 14873,
"end": 14996
} | class ____(PydanticTypeError):
code = 'enum_instance'
msg_template = '{value} is not a valid Enum instance'
| EnumError |
python | apache__airflow | providers/fab/src/airflow/providers/fab/auth_manager/models/__init__.py | {
"start": 5410,
"end": 6277
} | class ____(Model):
"""Permission pair comprised of an Action + Resource combo."""
__tablename__ = "ab_permission_view"
__table_args__ = (UniqueConstraint("permission_id", "view_menu_id"),)
id: Mapped[int] = mapped_column(
Integer,
Sequence("ab_permission_view_id_seq", start=1, increment... | Permission |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 649076,
"end": 649488
} | class ____(sgqlc.types.Type):
"""An edge in a connection."""
__schema__ = github_schema
__field_names__ = ("cursor", "node")
cursor = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name="cursor")
"""A cursor for use in pagination."""
node = sgqlc.types.Field("EnterpriseRepositoryInfo"... | EnterpriseRepositoryInfoEdge |
python | hyperopt__hyperopt | hyperopt/mongoexp.py | {
"start": 39822,
"end": 49353
} | class ____(Ctrl):
"""
Attributes:
current_trial - current job document
jobs - MongoJobs object in which current_trial resides
read_only - True means don't change the db
"""
def __init__(self, trials, current_trial, read_only):
self.trials = trials
self.current_trial = curr... | MongoCtrl |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 857069,
"end": 858037
} | class ____(sgqlc.types.Type):
"""Iteration field configuration for a project."""
__schema__ = github_schema
__field_names__ = ("completed_iterations", "duration", "iterations", "start_day")
completed_iterations = sgqlc.types.Field(
sgqlc.types.non_null(sgqlc.types.list_of(sgqlc.types.non_null("... | ProjectV2IterationFieldConfiguration |
python | apache__airflow | providers/google/src/airflow/providers/google/cloud/operators/pubsub.py | {
"start": 32447,
"end": 39386
} | class ____(GoogleCloudBaseOperator):
"""
Pulls messages from a PubSub subscription and passes them through XCom.
If the queue is empty, returns empty list - never waits for messages.
If you do need to wait, please use :class:`airflow.providers.google.cloud.sensors.PubSubPullSensor`
instead.
..... | PubSubPullOperator |
python | dagster-io__dagster | python_modules/dagster-graphql/dagster_graphql/schema/partition_sets.py | {
"start": 21416,
"end": 22167
} | class ____(graphene.ObjectType):
name = graphene.NonNull(graphene.String)
partition_keys = non_null_list(graphene.String)
type = graphene.NonNull(GraphenePartitionDefinitionType)
class Meta:
name = "DimensionPartitionKeys"
types = [
GraphenePartition,
GraphenePartitionRunConfig,
G... | GrapheneDimensionPartitionKeys |
python | modin-project__modin | modin/core/execution/dask/implementations/pandas_on_dask/partitioning/partition_manager.py | {
"start": 1205,
"end": 2199
} | class ____(PandasDataframePartitionManager):
"""The class implements the interface in `PandasDataframePartitionManager`."""
# This object uses PandasOnDaskDataframePartition objects as the underlying store.
_partition_class = PandasOnDaskDataframePartition
_column_partitions_class = PandasOnDaskDatafra... | PandasOnDaskDataframePartitionManager |
python | tensorflow__tensorflow | tensorflow/python/feature_column/feature_column_v2.py | {
"start": 165551,
"end": 171895
} | class ____(
CategoricalColumn,
fc_old._SequenceCategoricalColumn, # pylint: disable=protected-access
collections.namedtuple('SequenceCategoricalColumn',
('categorical_column'))):
"""Represents sequences of categorical data."""
@property
def _is_v2_column(self):
return ... | SequenceCategoricalColumn |
python | walkccc__LeetCode | solutions/1605. Find Valid Matrix Given Row and Column Sums/1605.py | {
"start": 0,
"end": 371
} | class ____:
def restoreMatrix(self, rowSum: list[int],
colSum: list[int]) -> list[list[int]]:
m = len(rowSum)
n = len(colSum)
ans = [[0] * n for _ in range(m)]
for i in range(m):
for j in range(n):
ans[i][j] = min(rowSum[i], colSum[j])
rowSum[i] -= ans[i][j]
... | Solution |
python | modin-project__modin | modin/core/execution/dispatching/factories/factories.py | {
"start": 2871,
"end": 3270
} | class ____(typing.NamedTuple):
"""
Structure that stores information about factory.
Parameters
----------
engine : str
Name of underlying execution engine.
partition : str
Name of the partition format.
experimental : bool
Whether underlying engine is experimental-onl... | FactoryInfo |
python | django__django | tests/migrations/migrations_test_apps/with_generic_model/models.py | {
"start": 657,
"end": 787
} | class ____(Child[T1, T3, T2], models.Model):
"""A model inheriting from a custom subclass of typing.Generic."""
| CustomGenericModel |
python | lepture__mistune | src/mistune/directives/_base.py | {
"start": 340,
"end": 1655
} | class ____(ABCMeta):
name = "directive"
@staticmethod
@abstractmethod
def parse_type(m: Match[str]) -> str:
raise NotImplementedError()
@staticmethod
@abstractmethod
def parse_title(m: Match[str]) -> str:
raise NotImplementedError()
@staticmethod
@abstractmethod
... | DirectiveParser |
python | allegroai__clearml | clearml/backend_api/services/v2_9/projects.py | {
"start": 30118,
"end": 30978
} | class ____(Response):
"""
Response of projects.create endpoint.
:param id: Project id
:type id: str
"""
_service = "projects"
_action = "create"
_version = "2.9"
_schema = {
"definitions": {},
"properties": {"id": {"description": "Project id", "type": ["string", "nu... | CreateResponse |
python | spack__spack | lib/spack/spack/oci/opener.py | {
"start": 5913,
"end": 5999
} | class ____(NamedTuple):
realm: str
service: str
scope: str
| RealmServiceScope |
python | Lightning-AI__lightning | examples/pytorch/domain_templates/computer_vision_fine_tuning.py | {
"start": 2901,
"end": 3851
} | class ____(BaseFinetuning):
def __init__(self, milestones: tuple = (5, 10), train_bn: bool = False):
super().__init__()
self.milestones = milestones
self.train_bn = train_bn
def freeze_before_training(self, pl_module: LightningModule):
self.freeze(modules=pl_module.feature_extra... | MilestonesFinetuning |
python | great-expectations__great_expectations | tests/expectations/metrics/query_metrics/test_query_metrics.py | {
"start": 2734,
"end": 6011
} | class ____(QueryTable):
metric_name = "my_query.table"
value_keys = ("my_query",)
query_param_name: ClassVar[str] = "my_query"
@pytest.mark.unit
@mock.patch.object(sa, "text")
@mock.patch.object(
QueryMetricProvider, "_get_substituted_batch_subquery_from_query_and_batch_selectable"
)
@mock.patch.obje... | MyQueryTable |
python | python__mypy | mypy/typeanal.py | {
"start": 101273,
"end": 104136
} | class ____(TrivialSyntheticTypeTranslator):
"""See docstring of detect_diverging_alias() for details."""
# TODO: this doesn't really need to be a translator, but we don't have a trivial visitor.
def __init__(
self,
seen_nodes: set[TypeAlias],
lookup: Callable[[str, Context], SymbolT... | DivergingAliasDetector |
python | imageio__imageio | imageio/plugins/_tifffile.py | {
"start": 123046,
"end": 162319
} | class ____(object):
"""TIFF image file directory (IFD).
Attributes
----------
index : int
Index of page in file.
dtype : numpy.dtype or None
Data type (native byte order) of the image in IFD.
shape : tuple
Dimensions of the image in IFD.
axes : str
Axes label... | TiffPage |
python | tornadoweb__tornado | tornado/test/concurrent_test.py | {
"start": 3364,
"end": 3875
} | class ____(BaseCapClient):
@gen.coroutine
def capitalize(self, request_data):
logging.debug("capitalize")
stream = IOStream(socket.socket())
logging.debug("connecting")
yield stream.connect(("127.0.0.1", self.port))
stream.write(utf8(request_data + "\n"))
logging.... | GeneratorCapClient |
python | instagram__MonkeyType | monkeytype/typing.py | {
"start": 13925,
"end": 15132
} | class ____(TypeRewriter):
"""Rewrite Union[T1, ..., TN] as Any for large N."""
def __init__(self, max_union_len: int = 5):
super().__init__()
self.max_union_len = max_union_len
def _rewrite_to_tuple(self, union):
"""Union[Tuple[V, ..., V], Tuple[V, ..., V], ...] -> Tuple[V, ...]"""... | RewriteLargeUnion |
python | getsentry__sentry | src/sentry/middleware/integrations/parsers/vercel.py | {
"start": 297,
"end": 527
} | class ____(BaseRequestParser):
provider = "vercel"
webhook_identifier = WebhookProviderIdentifier.VERCEL
def get_response(self) -> HttpResponseBase:
return self.get_response_from_control_silo()
| VercelRequestParser |
python | run-llama__llama_index | llama-index-integrations/tools/llama-index-tools-jira/llama_index/tools/jira/base.py | {
"start": 123,
"end": 9783
} | class ____(BaseToolSpec):
"""Atlassian Jira Tool Spec."""
spec_functions = [
"jira_issues_query",
"jira_issue_query",
"jira_comments_query",
"jira_all_projects",
]
def __init__(
self,
email: Optional[str] = None,
api_token: Optional[str] = None,
... | JiraToolSpec |
python | pypa__setuptools | pkg_resources/__init__.py | {
"start": 9827,
"end": 10502
} | class ____(ResolutionError):
"""A requested distribution was not found"""
_template = (
"The '{self.req}' distribution was not found "
"and is required by {self.requirers_str}"
)
@property
def req(self) -> Requirement:
return self.args[0]
@property
def requirers(se... | DistributionNotFound |
python | kamyu104__LeetCode-Solutions | Python/design-in-memory-file-system.py | {
"start": 439,
"end": 1884
} | class ____(object):
def __init__(self):
self.__root = TrieNode()
def ls(self, path):
"""
:type path: str
:rtype: List[str]
"""
curr = self.__getNode(path)
if curr.is_file:
return [self.__split(path, '/')[-1]]
return sorted(curr.chi... | FileSystem |
python | Pylons__pyramid | src/pyramid/httpexceptions.py | {
"start": 26912,
"end": 27311
} | class ____(HTTPClientError):
"""
subclass of :class:`~HTTPClientError`
This indicates that the requested resource is no longer available
at the server and no forwarding address is known.
code: 410, title: Gone
"""
code = 410
title = 'Gone'
explanation = (
'This resource is... | HTTPGone |
python | kamyu104__LeetCode-Solutions | Python/split-array-with-minimum-difference.py | {
"start": 44,
"end": 625
} | class ____(object):
def splitArray(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
left, i = 0, 0
while i+1 < len(nums) and nums[i] < nums[i+1]:
left += nums[i]
i += 1
right, j = 0, len(nums)-1
while j-1 >= 0 and nums[j] ... | Solution |
python | astropy__astropy | astropy/time/formats.py | {
"start": 78732,
"end": 78945
} | class ____(TimeEpochDateString):
"""Julian Epoch year as string value(s) like 'J2000.0'."""
name = "jyear_str"
epoch_to_jd = "epj2jd"
jd_to_epoch = "epj"
epoch_prefix = "J"
| TimeJulianEpochString |
python | django__django | tests/queries/models.py | {
"start": 12919,
"end": 13002
} | class ____(models.Model):
f1 = models.TextField()
f2 = models.TextField()
| FK1 |
python | doocs__leetcode | solution/1500-1599/1556.Thousand Separator/Solution.py | {
"start": 0,
"end": 359
} | class ____:
def thousandSeparator(self, n: int) -> str:
cnt = 0
ans = []
while 1:
n, v = divmod(n, 10)
ans.append(str(v))
cnt += 1
if n == 0:
break
if cnt == 3:
ans.append('.')
cnt = 0... | Solution |
python | astropy__astropy | astropy/units/tests/test_structured.py | {
"start": 1228,
"end": 1512
} | class ____(StructuredTestBase):
@classmethod
def setup_class(cls):
super().setup_class()
cls.pv_unit = StructuredUnit((cls.p_unit, cls.v_unit), ("p", "v"))
cls.pv_t_unit = StructuredUnit((cls.pv_unit, cls.t_unit), ("pv", "t"))
| StructuredTestBaseWithUnits |
python | pandas-dev__pandas | pandas/io/formats/info.py | {
"start": 21958,
"end": 23390
} | class ____(_TableBuilderAbstract):
"""
Abstract builder for dataframe info table.
Parameters
----------
info : DataFrameInfo.
Instance of DataFrameInfo.
"""
def __init__(self, *, info: DataFrameInfo) -> None:
self.info: DataFrameInfo = info
def get_lines(self) -> list[... | _DataFrameTableBuilder |
python | Textualize__textual | src/textual/scrollbar.py | {
"start": 870,
"end": 986
} | class ____(ScrollMessage, verbose=True):
"""Message sent when clicking below handle."""
@rich.repr.auto
| ScrollDown |
python | getsentry__sentry | src/sentry/auth/provider.py | {
"start": 1492,
"end": 5436
} | class ____(PipelineProvider["AuthHelper"], abc.ABC):
"""
A provider indicates how authenticate should happen for a given service,
including its configuration and basic identity management.
"""
is_partner = False
requires_refresh = True
is_saml = False
# All auth providers by default re... | Provider |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.