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 | langchain-ai__langchain | libs/langchain_v1/tests/unit_tests/agents/test_response_format_integration.py | {
"start": 1651,
"end": 4856
} | class ____(BaseModel):
"""Weather response."""
temperature: float = Field(description="The temperature in fahrenheit")
condition: str = Field(description="Weather condition")
def get_weather(city: str) -> str: # noqa: ARG001
"""Get the weather for a city."""
return f"The weather in {city} is sun... | WeatherBaseModel |
python | getsentry__sentry | src/sentry/integrations/messaging/spec.py | {
"start": 1420,
"end": 1786
} | class ____:
"""An integration's set of view classes for linking and unlinking identities."""
link_personal_identity: type[View]
unlink_personal_identity: type[View]
# Optional until supported on all messaging integrations
link_team_identity: type[View] | None = None
unlink_team_identity: type[... | MessagingIdentityLinkViewSet |
python | apache__airflow | providers/redis/tests/unit/redis/queues/test_redis.py | {
"start": 2411,
"end": 2898
} | class ____:
@pytest.mark.usefixtures("cleanup_providers_manager")
def test_provider_integrations_with_scheme_param(self):
from airflow.providers.common.messaging.triggers.msg_queue import MessageQueueTrigger
from airflow.providers.redis.triggers.redis_await_message import AwaitMessageTrigger
... | TestMessageQueueTrigger |
python | bokeh__bokeh | src/bokeh/models/sources.py | {
"start": 3347,
"end": 4591
} | class ____(DataSource):
''' A base class for data source types, which can be mapped onto
a columnar format.
'''
# explicit __init__ to support Init signatures
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)
default_values = Dict(String, AnyRef,... | ColumnarDataSource |
python | py-pdf__pypdf | pypdf/generic/_base.py | {
"start": 26930,
"end": 31862
} | class ____(str, PdfObject): # noqa: SLOT000
delimiter_pattern = re.compile(rb"\s+|[\(\)<>\[\]{}/%]")
prefix = b"/"
renumber_table: ClassVar[dict[str, bytes]] = {
**{chr(i): f"#{i:02X}".encode() for i in b"#()<>[]{}/%"},
**{chr(i): f"#{i:02X}".encode() for i in range(33)},
}
def clo... | NameObject |
python | mlflow__mlflow | mlflow/tracking/request_header/abstract_request_header_provider.py | {
"start": 115,
"end": 1061
} | class ____:
"""
Abstract base class for specifying custom request headers to add to outgoing requests
(e.g. request headers specifying the environment from which mlflow is running).
When a request is sent, MLflow will iterate through all registered RequestHeaderProviders.
For each provider where ``... | RequestHeaderProvider |
python | weaviate__weaviate-python-client | weaviate/rbac/models.py | {
"start": 971,
"end": 1042
} | class ____(TypedDict):
collection: str
tenant: str
| PermissionData |
python | gevent__gevent | src/gevent/tests/test__threading_2.py | {
"start": 1534,
"end": 1773
} | class ____(object):
# A trivial mutable counter.
def __init__(self):
self.value = 0
def inc(self):
self.value += 1
def dec(self):
self.value -= 1
def get(self):
return self.value
| Counter |
python | altair-viz__altair | altair/vegalite/v6/schema/core.py | {
"start": 481470,
"end": 483736
} | class ____(VegaLiteSchema):
"""
ImputeParams schema wrapper.
Parameters
----------
frame : Sequence[float, None]
A frame specification as a two-element array used to control the window over which
the specified method is applied. The array entries should either be a number
in... | ImputeParams |
python | realpython__materials | python-guitar-synthesizer/source_code_final/src/tablature/models.py | {
"start": 1423,
"end": 1927
} | class ____(BaseModel):
url: Optional[HttpUrl] = None
weight: Optional[NonNegativeFloat] = 1.0
instrument: Instrument
tablature: Tablature
@model_validator(mode="after")
def check_frets(self) -> Self:
num_strings = len(self.instrument.tuning)
for measure in self.tablature.measure... | Track |
python | plotly__plotly.py | plotly/graph_objs/streamtube/_starts.py | {
"start": 233,
"end": 5446
} | class ____(_BaseTraceHierarchyType):
_parent_path_str = "streamtube"
_path_str = "streamtube.starts"
_valid_props = {"x", "xsrc", "y", "ysrc", "z", "zsrc"}
@property
def x(self):
"""
Sets the x components of the starting position of the
streamtubes
The 'x' property ... | Starts |
python | kamyu104__LeetCode-Solutions | Python/minimum-cost-to-make-array-equal.py | {
"start": 1627,
"end": 2486
} | class ____(object):
def minCost(self, nums, cost):
"""
:type nums: List[int]
:type cost: List[int]
:rtype: int
"""
idxs = range(len(nums))
idxs.sort(key=lambda x: nums[x])
prefix = [0]*(len(cost)+1)
left = 0
for i in xrange(len(cost)):
... | Solution3 |
python | py-pdf__pypdf | pypdf/generic/_base.py | {
"start": 17993,
"end": 19621
} | class ____(int, PdfObject):
NumberPattern = re.compile(b"[^+-.0-9]")
def __new__(cls, value: Any) -> "NumberObject":
try:
return int.__new__(cls, int(value))
except ValueError:
logger_warning(f"NumberObject({value}) invalid; use 0 instead", __name__)
return i... | NumberObject |
python | encode__httpx | httpx/_transports/default.py | {
"start": 9161,
"end": 13984
} | class ____(AsyncBaseTransport):
def __init__(
self,
verify: ssl.SSLContext | str | bool = True,
cert: CertTypes | None = None,
trust_env: bool = True,
http1: bool = True,
http2: bool = False,
limits: Limits = DEFAULT_LIMITS,
proxy: ProxyTypes | None = ... | AsyncHTTPTransport |
python | tensorflow__tensorflow | tensorflow/python/ops/init_ops_v2.py | {
"start": 5633,
"end": 7359
} | class ____(Initializer):
"""Initializer that generates tensors initialized to 1.
Initializers allow you to pre-specify an initialization strategy, encoded in
the Initializer object, without knowing the shape and dtype of the variable
being initialized.
Examples:
>>> def make_variables(k, initializer):
... | Ones |
python | mlflow__mlflow | mlflow/server/graphql/autogenerated_graphql_schema.py | {
"start": 5859,
"end": 6250
} | class ____(graphene.ObjectType):
run_id = graphene.String()
run_uuid = graphene.String()
run_name = graphene.String()
experiment_id = graphene.String()
user_id = graphene.String()
status = graphene.Field(MlflowRunStatus)
start_time = LongString()
end_time = LongString()
artifact_uri ... | MlflowRunInfo |
python | GoogleCloudPlatform__python-docs-samples | logging/redaction/log_redaction.py | {
"start": 1048,
"end": 1229
} | class ____(DoFn):
"""Convert PubSub message payload to UTF-8 and return as JSON"""
def process(self, element):
yield json.loads(element.decode("utf-8"))
| PayloadAsJson |
python | kamyu104__LeetCode-Solutions | Python/count-nice-pairs-in-an-array.py | {
"start": 72,
"end": 611
} | class ____(object):
def countNicePairs(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
MOD = 10**9 + 7
def rev(x):
result = 0
while x:
x, r = divmod(x, 10)
result = result*10+r
return result
... | Solution |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/namedTuple6.py | {
"start": 172,
"end": 662
} | class ____(NamedTuple):
val1: str
val2: int
nt1 = NT1("x", 0)
# This should generate an error.
nt1.val1 = ""
# This should generate an error.
nt1[0] = ""
# This should generate an error.
del nt1.val1
# This should generate an error.
del nt1[0]
NT2 = NamedTuple("NT2", [("val1", str), ("val2", int)])
nt2 ... | NT1 |
python | pypa__setuptools | setuptools/_vendor/importlib_metadata/__init__.py | {
"start": 25464,
"end": 26717
} | class ____:
"""
A prepared search query for metadata on a possibly-named package.
Pre-calculates the normalization to prevent repeated operations.
>>> none = Prepared(None)
>>> none.normalized
>>> none.legacy_normalized
>>> bool(none)
False
>>> sample = Prepared('Sample__Pkg-name.f... | Prepared |
python | huggingface__transformers | src/transformers/models/falcon_h1/modular_falcon_h1.py | {
"start": 54956,
"end": 61067
} | class ____(LlamaForCausalLM):
def forward(
self,
input_ids: Optional[torch.LongTensor] = None,
attention_mask: Optional[torch.Tensor] = None,
position_ids: Optional[torch.LongTensor] = None,
past_key_values: Optional[FalconHybridMambaAttentionDynamicCache] = None,
inp... | FalconH1ForCausalLM |
python | cython__cython | Cython/Compiler/Nodes.py | {
"start": 359147,
"end": 368025
} | class ____(Node):
# Part of try ... except statement.
#
# pattern [ExprNode]
# target ExprNode or None
# body StatNode
# excinfo_target TupleNode(3*ResultRefNode) or None optional target for exception info (not owned here!)
# match_flag string ... | ExceptClauseNode |
python | pallets__werkzeug | src/werkzeug/_internal.py | {
"start": 1364,
"end": 2870
} | class ____(logging.StreamHandler): # type: ignore[type-arg]
"""On Windows, wrap stream with Colorama for ANSI style support."""
def __init__(self) -> None:
try:
import colorama
except ImportError:
stream = None
else:
stream = colorama.AnsiToWin32(sys... | _ColorStreamHandler |
python | scrapy__scrapy | tests/test_spider.py | {
"start": 7694,
"end": 8318
} | class ____(TestSpider):
spider_class = CSVFeedSpider
def test_parse_rows(self):
body = get_testdata("feeds", "feed-sample6.csv")
response = Response("http://example.org/dummy.csv", body=body)
class _CrawlSpider(self.spider_class):
name = "test"
delimiter = ","
... | TestCSVFeedSpider |
python | apache__airflow | providers/apache/kafka/src/airflow/providers/apache/kafka/operators/produce.py | {
"start": 1533,
"end": 5233
} | class ____(BaseOperator):
"""
An operator that produces messages to a Kafka topic.
Registers a producer to a kafka topic and publishes messages to the log.
:param kafka_config_id: The connection object to use, defaults to "kafka_default"
:param topic: The topic the producer should produce to, defa... | ProduceToTopicOperator |
python | tensorflow__tensorflow | tensorflow/python/data/ops/readers.py | {
"start": 5104,
"end": 6673
} | class ____(dataset_ops.DatasetSource):
"""A `Dataset` comprising records from one or more text files."""
def __init__(self,
filenames,
compression_type=None,
buffer_size=None,
name=None):
"""Creates a `TextLineDataset`.
Args:
filenames: A `... | _TextLineDataset |
python | plotly__plotly.py | plotly/graph_objs/layout/_title.py | {
"start": 235,
"end": 15391
} | class ____(_BaseLayoutHierarchyType):
_parent_path_str = "layout"
_path_str = "layout.title"
_valid_props = {
"automargin",
"font",
"pad",
"subtitle",
"text",
"x",
"xanchor",
"xref",
"y",
"yanchor",
"yref",
}
@p... | Title |
python | python-pillow__Pillow | src/PIL/ImageShow.py | {
"start": 9568,
"end": 10106
} | class ____(Viewer):
"""The viewer for IPython frontends."""
def show_image(self, image: Image.Image, **options: Any) -> int:
ipython_display(image)
return 1
try:
from IPython.display import display as ipython_display
except ImportError:
pass
else:
register(IPythonViewer)
if __na... | IPythonViewer |
python | getsentry__sentry | src/sentry/integrations/pagerduty/integration.py | {
"start": 2713,
"end": 2930
} | class ____(TypedDict):
name: str
type: str
label: str
help: str
addButtonText: str
columnLabels: dict[str, str]
columnKeys: list[str]
confirmDeleteMessage: str
| PagerDutyOrganizationConfig |
python | google__jax | jax/_src/pallas/fuser/fusible_dtype.py | {
"start": 2527,
"end": 2614
} | class ____(dtypes.extended):
"""Scalar dtype for fusible dtypes."""
| FusibleElementDType |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/operator1.py | {
"start": 1788,
"end": 1909
} | class ____:
def __add__(self, other: object) -> NoReturn: ...
f = F() + ""
reveal_type(f, expected_text="NoReturn")
| F |
python | ray-project__ray | release/llm_tests/benchmark/configs.py | {
"start": 253,
"end": 378
} | class ____(str, Enum):
CONSTANT = "constant"
UNIFORM = "uniform"
EXPONENTIAL = "exponential"
| TokensDistributionType |
python | openai__openai-python | src/openai/types/responses/response_input_item.py | {
"start": 3779,
"end": 4528
} | class ____(BaseModel):
call_id: str
"""The unique ID of the function tool call generated by the model."""
output: Union[str, ResponseFunctionCallOutputItemList]
"""Text, image, or file output of the function tool call."""
type: Literal["function_call_output"]
"""The type of the function tool c... | FunctionCallOutput |
python | huggingface__transformers | examples/pytorch/translation/run_translation.py | {
"start": 4255,
"end": 29547
} | class ____:
"""
Arguments pertaining to what data we are going to input our model for training and eval.
"""
source_lang: str = field(default=None, metadata={"help": "Source language id for translation."})
target_lang: str = field(default=None, metadata={"help": "Target language id for translation.... | DataTrainingArguments |
python | huggingface__transformers | src/transformers/models/qwen3_omni_moe/modeling_qwen3_omni_moe.py | {
"start": 105474,
"end": 105752
} | class ____(CausalLMOutputWithPast):
r"""
generation_steps (`int`, *optional*)
Current generation step of code predictor model.
"""
generation_steps: Optional[int] = None
@use_kernel_forward_from_hub("RMSNorm")
| Qwen3OmniMoeTalkerCodePredictorOutputWithPast |
python | weaviate__weaviate-python-client | weaviate/collections/batch/base.py | {
"start": 56099,
"end": 56824
} | class ____:
def __init__(self, connection: ConnectionSync):
self._connection = connection
def get_nodes_status(
self,
) -> List[Node]:
try:
response = executor.result(self._connection.get(path="/nodes"))
except ConnectError as conn_err:
raise ConnectE... | _ClusterBatch |
python | realpython__materials | python-class/mro.py | {
"start": 125,
"end": 189
} | class ____(A):
def method(self):
print("C.method()")
| C |
python | getsentry__sentry | src/sentry/notifications/types.py | {
"start": 7712,
"end": 8068
} | class ____(StrEnum):
ALL_MEMBERS = "AllMembers"
ACTIVE_MEMBERS = "ActiveMembers"
NO_ONE = "NoOne"
FALLTHROUGH_CHOICES = [
(FallthroughChoiceType.ACTIVE_MEMBERS.value, "Recently Active Members"),
(FallthroughChoiceType.ALL_MEMBERS.value, "All Project Members"),
(FallthroughChoiceType.NO_ONE.val... | FallthroughChoiceType |
python | pypa__warehouse | warehouse/captcha/recaptcha.py | {
"start": 327,
"end": 385
} | class ____(RecaptchaError):
pass
| MissingInputSecretError |
python | walkccc__LeetCode | solutions/1937. Maximum Number of Points with Cost/1937.py | {
"start": 0,
"end": 686
} | class ____:
def maxPoints(self, points: list[list[int]]) -> int:
n = len(points[0])
# dp[j] := the maximum number of points you can have if points[i][j] is the
# most recent cell you picked
dp = [0] * n
for row in points:
leftToRight = [0] * n
runningMax = 0
for j in range(n):
... | Solution |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/classes3.py | {
"start": 1167,
"end": 1397
} | class ____:
def method1(self) -> str:
# This should generate an error.
return self.__name__
_T = TypeVar("_T")
def func1(cls: type[_T]) -> _T:
x1 = cls.__dict__
x2 = cls.__mro__
return cls()
| NonMeta |
python | kamyu104__LeetCode-Solutions | Python/longest-balanced-subarray-i.py | {
"start": 3018,
"end": 3562
} | class ____(object):
def longestBalanced(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
result = 0
for left in xrange(len(nums)):
curr = 0
lookup = set()
for right in xrange(left, len(nums)):
if nums[right] no... | Solution2 |
python | crytic__slither | slither/detectors/statements/unprotected_upgradeable.py | {
"start": 2521,
"end": 5404
} | class ____(AbstractDetector):
ARGUMENT = "unprotected-upgrade"
HELP = "Unprotected upgradeable contract"
IMPACT = DetectorClassification.HIGH
CONFIDENCE = DetectorClassification.HIGH
WIKI = "https://github.com/crytic/slither/wiki/Detector-Documentation#unprotected-upgradeable-contract"
WIKI_T... | UnprotectedUpgradeable |
python | coleifer__peewee | tests/libs/mock.py | {
"start": 34319,
"end": 51663
} | class ____(object):
attribute_name = None
_active_patches = set()
def __init__(
self, getter, attribute, new, spec, create,
spec_set, autospec, new_callable, kwargs
):
if new_callable is not None:
if new is not DEFAULT:
raise ValueError(
... | _patch |
python | pandas-dev__pandas | asv_bench/benchmarks/algorithms.py | {
"start": 3295,
"end": 3864
} | class ____:
params = [
[True, False],
["first", "last", False],
["Int64", "Float64"],
]
param_names = ["unique", "keep", "dtype"]
def setup(self, unique, keep, dtype):
N = 10**5
data = pd.Series(np.arange(N), dtype=dtype)
data[list(range(1, N, 100))] = pd... | DuplicatedMaskedArray |
python | ray-project__ray | rllib/examples/envs/classes/multi_agent/footsies/fixed_rlmodules.py | {
"start": 1037,
"end": 1357
} | class ____(FixedRLModule):
def _fixed_forward(self, batch, **kwargs):
obs_batch_size = len(tree.flatten(batch[sample_batch.SampleBatch.OBS])[0])
actions = batch_func([constants.EnvActions.NONE for _ in range(obs_batch_size)])
return {sample_batch.SampleBatch.ACTIONS: actions}
| NoopFixedRLModule |
python | altair-viz__altair | altair/vegalite/v6/schema/core.py | {
"start": 221901,
"end": 222192
} | class ____(VegaLiteSchema):
"""ConditionalAxisPropertyFontWeightnull schema wrapper."""
_schema = {"$ref": "#/definitions/ConditionalAxisProperty<(FontWeight|null)>"}
def __init__(self, *args, **kwds):
super().__init__(*args, **kwds)
| ConditionalAxisPropertyFontWeightnull |
python | huggingface__transformers | src/transformers/models/llava_onevision/modeling_llava_onevision.py | {
"start": 5234,
"end": 6258
} | class ____(PreTrainedModel):
config: LlavaOnevisionConfig
base_model_prefix = "model"
input_modalities = ("image", "video", "text")
supports_gradient_checkpointing = True
_no_split_modules = ["LlamaDecoderLayer"]
_skip_keys_device_placement = "past_key_values"
_supports_flash_attn = True
... | LlavaOnevisionPreTrainedModel |
python | django__django | tests/model_fields/test_charfield.py | {
"start": 157,
"end": 1398
} | class ____(TestCase):
def test_max_length_passed_to_formfield(self):
"""
CharField passes its max_length attribute to form fields created using
the formfield() method.
"""
cf1 = models.CharField()
cf2 = models.CharField(max_length=1234)
self.assertIsNone(cf1.f... | TestCharField |
python | coleifer__peewee | tests/pwiz_integration.py | {
"start": 1522,
"end": 1590
} | class ____(object):
def __init__(self, *_, **__): pass
| UnknownField |
python | xlwings__xlwings | xlwings/constants.py | {
"start": 115477,
"end": 115587
} | class ____:
xlAscending = 1 # from enum XlSortOrder
xlDescending = 2 # from enum XlSortOrder
| SortOrder |
python | dagster-io__dagster | python_modules/dagster/dagster/_core/events/__init__.py | {
"start": 67697,
"end": 68950
} | class ____(
NamedTuple(
"_ObjectStoreOperationResultData",
[
("op", ObjectStoreOperationType),
("value_name", Optional[str]),
("metadata", Mapping[str, MetadataValue]),
("address", Optional[str]),
("version", Optional[str]),
("m... | ObjectStoreOperationResultData |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 1586097,
"end": 1586256
} | class ____(sgqlc.types.Union):
"""The object which triggered a `ClosedEvent`."""
__schema__ = github_schema
__types__ = (Commit, PullRequest)
| Closer |
python | great-expectations__great_expectations | contrib/great_expectations_zipcode_expectations/great_expectations_zipcode_expectations/expectations/expect_column_values_to_be_valid_kentucky_zip.py | {
"start": 747,
"end": 1751
} | class ____(ColumnMapMetricProvider):
# This is the id string that will be used to reference your metric.
condition_metric_name = "column_values.valid_kentucky_zip"
# This method implements the core logic for the PandasExecutionEngine
@column_condition_partial(engine=PandasExecutionEngine)
def _pand... | ColumnValuesToBeValidKentuckyZip |
python | openai__openai-python | src/openai/types/beta/assistant_stream_event.py | {
"start": 4287,
"end": 4448
} | class ____(BaseModel):
data: RunStep
"""Represents a step in execution of a run."""
event: Literal["thread.run.step.completed"]
| ThreadRunStepCompleted |
python | run-llama__llama_index | llama-index-integrations/node_parser/llama-index-node-parser-relational-dashscope/llama_index/node_parser/dashscope/base.py | {
"start": 326,
"end": 4641
} | class ____(BaseElementNodeParser):
"""
DashScope Json format element node parser.
Splits a json format document from DashScope Parse into Text Nodes and Index Nodes
corresponding to embedded objects (e.g. tables).
"""
try_count_limit: int = Field(
default=10, description="Maximum numbe... | DashScopeJsonNodeParser |
python | sqlalchemy__sqlalchemy | test/ext/test_compiler.py | {
"start": 1277,
"end": 15201
} | class ____(fixtures.TestBase, AssertsCompiledSQL):
__dialect__ = "default"
def test_column(self):
class MyThingy(ColumnClause):
inherit_cache = False
def __init__(self, arg=None):
super().__init__(arg or "MYTHINGY!")
@compiles(MyThingy)
def visi... | UserDefinedTest |
python | scipy__scipy | scipy/spatial/tests/test_distance.py | {
"start": 82528,
"end": 84726
} | class ____:
def test_pdist_chebyshev_random(self):
eps = 1e-8
X = eo['pdist-double-inp']
Y_right = eo['pdist-chebyshev']
Y_test1 = pdist(X, 'chebyshev')
assert_allclose(Y_test1, Y_right, rtol=eps)
def test_pdist_chebyshev_random_float32(self):
eps = 1e-7
... | TestChebyshev |
python | sphinx-doc__sphinx | sphinx/ext/doctest.py | {
"start": 6255,
"end": 6673
} | class ____(TestDirective):
option_spec: ClassVar[OptionSpec] = {
'hide': directives.flag,
'no-trim-doctest-flags': directives.flag,
'options': directives.unchanged,
'pyversion': directives.unchanged_required,
'skipif': directives.unchanged_required,
'trim-doctest-flag... | TestoutputDirective |
python | marshmallow-code__marshmallow | tests/test_registry.py | {
"start": 5871,
"end": 7328
} | class ____(Schema):
_id = fields.Integer()
def test_multiple_classes_with_same_name_raises_error():
# Import a class with the same name
from .foo_serializer import FooSerializer as FooSerializer1 # noqa: PLC0415, F401
class MySchema(Schema):
foo = fields.Nested("FooSerializer")
# Using ... | FooSerializer |
python | facebookresearch__faiss | tests/test_rabitq.py | {
"start": 67354,
"end": 70686
} | class ____(unittest.TestCase):
"""Test index factory support for multi-bit RaBitQ."""
def test_factory_default_nb_bits(self):
"""Test that 'RaBitQ' creates 1-bit index by default."""
index = faiss.index_factory(128, "RaBitQ")
self.assertIsInstance(index, faiss.IndexRaBitQ)
self.... | TestMultiBitRaBitQIndexFactory |
python | getsentry__sentry | tests/sentry/grouping/enhancements/test_hints.py | {
"start": 260,
"end": 29655
} | class ____:
hint: str | None
contributes: bool | None = None
in_app_hint = "marked in-app by (...)"
client_in_app_hint = "marked in-app by the client"
out_of_app_hint = "marked out of app by (...)"
client_out_of_app_hint = "marked out of app by the client"
ignored_hint = "ignored by (...)"
ignored_because_hin... | DummyRustFrame |
python | huggingface__transformers | src/transformers/models/blenderbot/tokenization_blenderbot.py | {
"start": 1125,
"end": 7382
} | class ____(TokenizersBackend):
"""
Construct a "fast" Blenderbot tokenizer (backed by HuggingFace's *tokenizers* library), derived from the GPT-2
tokenizer, using byte-level Byte-Pair-Encoding.
This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word... | BlenderbotTokenizer |
python | charliermarsh__ruff | crates/ruff_linter/resources/test/fixtures/flake8_bugbear/B014.py | {
"start": 326,
"end": 1644
} | class ____(Exception):
pass
try:
pass
except (MyError, MyError):
# Detect duplicate non-builtin errors
pass
try:
pass
except (MyError, Exception) as e:
# Don't assume that we're all subclasses of Exception
pass
try:
pass
except (MyError, BaseException) as e:
# But we *can* assu... | MyError |
python | run-llama__llama_index | llama-index-integrations/storage/index_store/llama-index-storage-index-store-azurecosmosnosql/llama_index/storage/index_store/azurecosmosnosql/base.py | {
"start": 275,
"end": 3255
} | class ____(BaseKVStore):
"""Creates an Azure Cosmos DB NoSql Index Store."""
def __init__(
self,
azure_cosmos_nosql_kvstore: AzureCosmosNoSqlKVStore,
namespace: Optional[str] = None,
collection_suffix: Optional[str] = None,
) -> None:
"""Initializes the Azure Cosmos ... | AzureCosmosNoSqlIndexStore |
python | jazzband__django-oauth-toolkit | oauth2_provider/forms.py | {
"start": 734,
"end": 1450
} | class ____(forms.Form):
allow = forms.BooleanField(required=False)
id_token_hint = forms.CharField(required=False, widget=forms.HiddenInput())
logout_hint = forms.CharField(required=False, widget=forms.HiddenInput())
client_id = forms.CharField(required=False, widget=forms.HiddenInput())
post_logout... | ConfirmLogoutForm |
python | pypa__setuptools | setuptools/tests/test_windows_wrappers.py | {
"start": 1894,
"end": 6658
} | class ____(WrapperTester):
script_name = 'foo-script.py'
wrapper_name = 'foo.exe'
wrapper_source = win_launcher_exe('cli')
script_tmpl = textwrap.dedent(
"""
#!%(python_exe)s
import sys
input = repr(sys.stdin.read())
print(sys.argv[0][-14:])
print(sys.arg... | TestCLI |
python | scipy__scipy | scipy/stats/_multivariate.py | {
"start": 222368,
"end": 229156
} | class ____(multi_rv_generic):
r"""A Dirichlet multinomial random variable.
The Dirichlet multinomial distribution is a compound probability
distribution: it is the multinomial distribution with number of trials
`n` and class probabilities ``p`` randomly sampled from a Dirichlet
distribution with co... | dirichlet_multinomial_gen |
python | huggingface__transformers | src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py | {
"start": 22739,
"end": 27860
} | class ____(nn.Module):
def __init__(self, config):
super().__init__()
self.config = config
self.dropout = nn.Dropout(config.speech_encoder_dropout)
self.layers = nn.ModuleList(
[SeamlessM4Tv2ConformerEncoderLayer(config) for _ in range(config.speech_encoder_layers)]
... | SeamlessM4Tv2ConformerEncoder |
python | mlflow__mlflow | mlflow/store/artifact/cloud_artifact_repo.py | {
"start": 2883,
"end": 3105
} | class ____(NamedTuple):
# Local filesystem path of the source file to upload
src_file_path: str
# Base artifact URI-relative path specifying the upload destination
artifact_file_path: str
| StagedArtifactUpload |
python | PyCQA__pylint | pylint/message/message_definition_store.py | {
"start": 647,
"end": 5083
} | class ____:
"""The messages store knows information about every possible message definition but
has no particular state during analysis.
"""
def __init__(
self, py_version: tuple[int, ...] | sys._version_info = sys.version_info
) -> None:
self.message_id_store: MessageIdStore = Mess... | MessageDefinitionStore |
python | anthropics__anthropic-sdk-python | src/anthropic/types/messages/message_batch_succeeded_result.py | {
"start": 234,
"end": 333
} | class ____(BaseModel):
message: Message
type: Literal["succeeded"]
| MessageBatchSucceededResult |
python | chardet__chardet | chardet/chardistribution.py | {
"start": 7633,
"end": 8546
} | class ____(CharDistributionAnalysis):
def __init__(self) -> None:
super().__init__()
self._char_to_freq_order = BIG5_CHAR_TO_FREQ_ORDER
self._table_size = BIG5_TABLE_SIZE
self.typical_distribution_ratio = BIG5_TYPICAL_DISTRIBUTION_RATIO
def get_order(self, byte_str: Union[bytes,... | Big5DistributionAnalysis |
python | getsentry__sentry | src/sentry/replays/usecases/delete.py | {
"start": 3520,
"end": 3625
} | class ____(TypedDict):
retention_days: int
replay_id: str
max_segment_id: int | None
| MatchedRow |
python | apache__airflow | providers/teradata/src/airflow/providers/teradata/utils/tpt_util.py | {
"start": 984,
"end": 18891
} | class ____:
"""Configuration constants for TPT operations."""
DEFAULT_TIMEOUT = 5
FILE_PERMISSIONS_READ_ONLY = 0o400
TEMP_DIR_WINDOWS = "C:\\Windows\\Temp"
TEMP_DIR_UNIX = "/tmp"
def execute_remote_command(ssh_client: SSHClient, command: str) -> tuple[int, str, str]:
"""
Execute a command... | TPTConfig |
python | google__jax | jax/_src/custom_derivatives.py | {
"start": 54515,
"end": 81205
} | class ____:
def __init__(self, jaxpr, in_tree, out_tree, consts):
self.jaxpr = jaxpr
self.in_tree = in_tree
self.out_tree = out_tree
self.consts = consts
def __iter__(self):
return iter((self.jaxpr, self.in_tree, self.out_tree, self.consts))
def tree_flatten(self):
return self.consts, (sel... | Residuals |
python | doocs__leetcode | solution/0700-0799/0792.Number of Matching Subsequences/Solution.py | {
"start": 0,
"end": 421
} | class ____:
def numMatchingSubseq(self, s: str, words: List[str]) -> int:
d = defaultdict(deque)
for w in words:
d[w[0]].append(w)
ans = 0
for c in s:
for _ in range(len(d[c])):
t = d[c].popleft()
if len(t) == 1:
... | Solution |
python | scrapy__scrapy | tests/test_core_downloader.py | {
"start": 1176,
"end": 1372
} | class ____:
def test_repr(self):
slot = Slot(concurrency=8, delay=0.1, randomize_delay=True)
assert repr(slot) == "Slot(concurrency=8, delay=0.10, randomize_delay=True)"
| TestSlot |
python | run-llama__llama_index | llama-index-core/llama_index/core/query_engine/custom.py | {
"start": 531,
"end": 2974
} | class ____(BaseModel, BaseQueryEngine):
"""
Custom query engine.
Subclasses can define additional attributes as Pydantic fields.
Subclasses must implement the `custom_query` method, which takes a query string
and returns either a Response object or a string as output.
They can optionally imple... | CustomQueryEngine |
python | davidhalter__jedi | test/examples/inheritance/pkg/__init__.py | {
"start": 26,
"end": 74
} | class ____(Bar):
def foo(self):
pass
| Foo |
python | pandas-dev__pandas | scripts/tests/test_validate_docstrings.py | {
"start": 10791,
"end": 15830
} | class ____:
def test_exit_status_for_main(self, monkeypatch) -> None:
monkeypatch.setattr(
validate_docstrings,
"pandas_validate",
lambda func_name: {
"docstring": "docstring1",
"errors": [
("ER01", "err desc"),
... | TestMainFunction |
python | has2k1__plotnine | plotnine/mapping/_atomic.py | {
"start": 2552,
"end": 4029
} | class ____(ae_value[ShapeType]):
"""
A single shape value
"""
def __post_init__(self):
from matplotlib.path import Path
from ..scales.scale_shape import FILLED_SHAPES, UNFILLED_SHAPES
value = self.value
with suppress(TypeError):
if value in (FILLED_SHAPES ... | shape |
python | HypothesisWorks__hypothesis | hypothesis-python/tests/codemods/test_codemods.py | {
"start": 4745,
"end": 5399
} | class ____(CodemodTest):
TRANSFORM = codemods.HypothesisFixHealthCheckAll
def test_noop_other_attributes(self):
# Test that calls to other attributes of HealthCheck are not modified
before = "result = HealthCheck.data_too_large"
self.assertCodemod(before=before, after=before)
def t... | TestHealthCheckAll |
python | dagster-io__dagster | python_modules/dagster-graphql/dagster_graphql/schema/env_vars.py | {
"start": 1358,
"end": 1535
} | class ____(graphene.ObjectType):
results = non_null_list(GrapheneEnvVarWithConsumers)
class Meta:
name = "EnvVarWithConsumersList"
| GrapheneEnvVarWithConsumersList |
python | scrapy__scrapy | tests/test_exporters.py | {
"start": 21943,
"end": 22084
} | class ____(TestJsonItemExporter):
item_class = MyDataClass
custom_field_item_class = CustomFieldDataclass
| TestJsonItemExporterDataclass |
python | pallets__flask | src/flask/debughelpers.py | {
"start": 1591,
"end": 6070
} | class ____(AssertionError):
"""This exception is raised in debug mode if a routing redirect
would cause the browser to drop the method or body. This happens
when method is not GET, HEAD or OPTIONS and the status code is not
307 or 308.
"""
def __init__(self, request: Request) -> None:
e... | FormDataRoutingRedirect |
python | python__mypy | mypyc/test/test_optimizations.py | {
"start": 2064,
"end": 2256
} | class ____(OptimizationSuite):
files = ["opt-flag-elimination.test"]
def do_optimizations(self, fn: FuncIR) -> None:
do_flag_elimination(fn, CompilerOptions())
| TestFlagElimination |
python | dask__distributed | distributed/worker_state_machine.py | {
"start": 20386,
"end": 21398
} | class ____(GatherDepDoneEvent):
"""class:`GatherDep` instruction terminated:
generic error raised (not a network failure); e.g. data failed to deserialize.
"""
exception: Serialize
traceback: Serialize | None
exception_text: str
traceback_text: str
__slots__ = tuple(__annotations__)
... | GatherDepFailureEvent |
python | kamyu104__LeetCode-Solutions | Python/find-subtree-sizes-after-changes.py | {
"start": 1124,
"end": 1831
} | class ____(object):
def findSubtreeSizes(self, parent, s):
"""
:type parent: List[int]
:type s: str
:rtype: List[int]
"""
def dfs(u):
lookup[ord(s[u])-ord('a')].append(u)
for v in adj[u]:
dfs(v)
result[lookup[ord... | Solution2 |
python | openai__openai-python | src/openai/types/vector_store_search_response.py | {
"start": 408,
"end": 1156
} | class ____(BaseModel):
attributes: Optional[Dict[str, Union[str, float, bool]]] = None
"""Set of 16 key-value pairs that can be attached to an object.
This can be useful for storing additional information about the object in a
structured format, and querying for objects via API or the dashboard. Keys a... | VectorStoreSearchResponse |
python | spyder-ide__spyder | external-deps/qtconsole/qtconsole/qtconsoleapp.py | {
"start": 16752,
"end": 17253
} | class ____(JupyterQtConsoleApp):
def __init__(self, *a, **kw):
warn("IPythonQtConsoleApp is deprecated; use JupyterQtConsoleApp",
DeprecationWarning)
super().__init__(*a, **kw)
# -----------------------------------------------------------------------------
# Main entry point
# -------... | IPythonQtConsoleApp |
python | astropy__astropy | astropy/utils/exceptions.py | {
"start": 1166,
"end": 1493
} | class ____(AstropyWarning):
"""
A warning class indicating a change in astropy that is incompatible
with previous versions.
The suggested procedure is to issue this warning for the version in
which the change occurs, and remove it for all following versions.
"""
| AstropyBackwardsIncompatibleChangeWarning |
python | paramiko__paramiko | paramiko/transport.py | {
"start": 127124,
"end": 128149
} | class ____:
def __init__(self):
# (id -> Channel)
self._map = weakref.WeakValueDictionary()
self._lock = threading.Lock()
def put(self, chanid, chan):
self._lock.acquire()
try:
self._map[chanid] = chan
finally:
self._lock.release()
de... | ChannelMap |
python | getsentry__sentry | src/sentry/web/frontend/sudo.py | {
"start": 375,
"end": 1607
} | class ____(BaseSudoView):
template_name = "sentry/account/sudo.html"
def handle_sudo(self, request: HttpRequest, context: dict[str, Any]) -> bool:
if super().handle_sudo(request, context):
return True
if not request.user.is_authenticated:
return False
try:
... | SudoView |
python | huggingface__transformers | src/transformers/models/unispeech_sat/modeling_unispeech_sat.py | {
"start": 60086,
"end": 64393
} | class ____(UniSpeechSatPreTrainedModel):
def __init__(self, config):
super().__init__(config)
if hasattr(config, "add_adapter") and config.add_adapter:
raise ValueError(
"Audio frame classification does not support the use of UniSpeechSat adapters (config.add_adapter=Tru... | UniSpeechSatForAudioFrameClassification |
python | networkx__networkx | networkx/algorithms/tests/test_planarity.py | {
"start": 174,
"end": 12066
} | class ____:
"""Nose Unit tests for the :mod:`networkx.algorithms.planarity` module.
Tests three things:
1. Check that the result is correct
(returns planar if and only if the graph is actually planar)
2. In case a counter example is returned: Check if it is correct
3. In case an embedding i... | TestLRPlanarity |
python | apache__airflow | providers/amazon/tests/unit/amazon/aws/triggers/test_ssm.py | {
"start": 2030,
"end": 4863
} | class ____:
def test_serialization(self):
trigger = SsmRunCommandTrigger(command_id=COMMAND_ID)
classpath, kwargs = trigger.serialize()
assert classpath == BASE_TRIGGER_CLASSPATH + "SsmRunCommandTrigger"
assert kwargs.get("command_id") == COMMAND_ID
def test_serialization_with_... | TestSsmRunCommandTrigger |
python | kamyu104__LeetCode-Solutions | Python/find-closest-node-to-given-two-nodes.py | {
"start": 49,
"end": 752
} | class ____(object):
def closestMeetingNode(self, edges, node1, node2):
"""
:type edges: List[int]
:type node1: int
:type node2: int
:rtype: int
"""
def dfs(node):
lookup = {}
i = 0
while node != -1:
if node i... | Solution |
python | has2k1__plotnine | plotnine/exceptions.py | {
"start": 570,
"end": 888
} | class ____(Exception):
"""
Exception for ggplot errors
"""
def __init__(self, *args: str):
args = tuple(dedent(arg) for arg in args)
self.message = " ".join(args)
def __str__(self) -> str:
"""
Error Message
"""
return repr(self.message)
| PlotnineError |
python | astropy__astropy | astropy/table/connect.py | {
"start": 224,
"end": 2760
} | class ____(registry.UnifiedReadWrite):
"""Read and parse a data table and return as a Table.
This function provides the Table interface to the astropy unified I/O
layer. This allows easily reading a file in many supported data formats
using syntax such as::
>>> from astropy.table import Table
... | TableRead |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.