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 | encode__django-rest-framework | tests/test_model_serializer.py | {
"start": 16056,
"end": 18270
} | class ____(TestCase):
def test_hstore_field(self):
class HStoreFieldModel(models.Model):
hstore_field = postgres_fields.HStoreField()
class TestSerializer(serializers.ModelSerializer):
class Meta:
model = HStoreFieldModel
fields = ['hstore_fie... | TestPosgresFieldsMapping |
python | spack__spack | lib/spack/spack/vendor/jinja2/visitor.py | {
"start": 343,
"end": 1766
} | class ____:
"""Walks the abstract syntax tree and call visitor functions for every
node found. The visitor functions may return values which will be
forwarded by the `visit` method.
Per default the visitor functions for the nodes are ``'visit_'`` +
class name of the node. So a `TryFinally` node v... | NodeVisitor |
python | numpy__numpy | numpy/_core/tests/test_numerictypes.py | {
"start": 7831,
"end": 8023
} | class ____(ReadValuesPlain):
"""Check the creation of heterogeneous arrays (plain, single row)"""
_descr = Pdescr
multiple_rows = 0
_buffer = PbufferT[0]
| TestReadValuesPlainSingle |
python | pytorch__pytorch | torch/cuda/__init__.py | {
"start": 57216,
"end": 57430
} | class ____(_CudaLegacyStorage):
@classproperty
def dtype(self):
_warn_typed_storage_removal()
return self._dtype
@classproperty
def _dtype(self):
return torch.int8
| CharStorage |
python | instagram__MonkeyType | monkeytype/stubs.py | {
"start": 2560,
"end": 9005
} | class ____(DefaultDict[Any, Any]):
"""A mapping of module name to the set of names to be imported."""
def __init__(self) -> None:
super().__init__(set)
def merge(self, other: "ImportMap") -> None:
for module, names in other.items():
self[module].update(names)
def _get_import_... | ImportMap |
python | plotly__plotly.py | plotly/graph_objs/histogram2d/colorbar/_tickformatstop.py | {
"start": 233,
"end": 8534
} | class ____(_BaseTraceHierarchyType):
_parent_path_str = "histogram2d.colorbar"
_path_str = "histogram2d.colorbar.tickformatstop"
_valid_props = {"dtickrange", "enabled", "name", "templateitemname", "value"}
@property
def dtickrange(self):
"""
range [*min*, *max*], where "min", "... | Tickformatstop |
python | scrapy__scrapy | tests/CrawlerRunner/change_reactor.py | {
"start": 116,
"end": 754
} | class ____(Spider):
name = "no_request"
custom_settings = {
"TWISTED_REACTOR": "twisted.internet.asyncioreactor.AsyncioSelectorReactor",
}
async def start(self):
return
yield
configure_logging({"LOG_FORMAT": "%(levelname)s: %(message)s", "LOG_LEVEL": "DEBUG"})
from scrapy.u... | NoRequestsSpider |
python | pytorch__pytorch | torch/distributed/optim/zero_redundancy_optimizer.py | {
"start": 5965,
"end": 6706
} | class ____(enum.IntEnum):
r"""
Define possible statuses that :class:`ZeroRedundancyOptimizer` can be in when overlapping with :class:`DistributedDataParallel`.
Attributes:
``UNINITIALIZED``: The ZeRO instance is effectively uninitialized and
is waiting for DDP to finalize its bucketing.... | _OverlapStatus |
python | pytest-dev__pytest-cov | src/pytest_cov/engine.py | {
"start": 1345,
"end": 9621
} | class ____:
"""Base class for different plugin implementations."""
def __init__(self, options: argparse.Namespace, config: Union[None, object], nodeid: Union[None, str]):
"""Get some common config used by multiple derived classes."""
self.cov_source = options.cov_source
self.cov_report ... | CovController |
python | PrefectHQ__prefect | src/integrations/prefect-snowflake/prefect_snowflake/experimental/workers/spcs.py | {
"start": 16412,
"end": 16501
} | class ____(BaseWorkerResult):
"""Result returned by the SPCSWorker."""
| SPCSWorkerResult |
python | pandas-dev__pandas | pandas/core/arrays/categorical.py | {
"start": 94468,
"end": 102940
} | class ____(PandasDelegate, PandasObject, NoNewAttributesMixin):
"""
Accessor object for categorical properties of the Series values.
Parameters
----------
data : Series or CategoricalIndex
The object to which the categorical accessor is attached.
See Also
--------
Series.dt : A... | CategoricalAccessor |
python | tensorflow__tensorflow | tensorflow/python/distribute/mirrored_strategy_test.py | {
"start": 49285,
"end": 50206
} | class ____(object):
def __init__(self, two_variables=False):
self.variables = []
self.variables.append(variable_v1.VariableV1(1.25, name="dummy_var1"))
if two_variables:
self.variables.append(variable_v1.VariableV1(2.0, name="dummy_var2"))
def __call__(self, factor=2):
x = factor * self.vari... | MockModel |
python | google__pytype | pytype/pytd/parse/node_test.py | {
"start": 771,
"end": 879
} | class ____(Node):
"""Inner node 'Y', with two children. See testVisitor[...]() below."""
c: Any
d: Any
| Y |
python | celery__celery | celery/exceptions.py | {
"start": 7825,
"end": 7908
} | class ____(DeprecationWarning):
"""Warning of deprecation."""
| CDeprecationWarning |
python | scipy__scipy | benchmarks/benchmarks/go_benchmark_functions/go_funcs_T.py | {
"start": 8286,
"end": 9839
} | class ____(Benchmark):
r"""
Trigonometric 1 objective function.
This class defines the Trigonometric 1 [1]_ global optimization problem. This
is a multimodal minimization problem defined as follows:
.. math::
f_{\text{Trigonometric01}}(x) = \sum_{i=1}^{n} \left [n -
... | Trigonometric01 |
python | Textualize__textual | src/textual/drivers/headless_driver.py | {
"start": 149,
"end": 1888
} | class ____(Driver):
"""A do-nothing driver for testing."""
@property
def is_headless(self) -> bool:
"""Is the driver running in 'headless' mode?"""
return True
def _get_terminal_size(self) -> tuple[int, int]:
if self._size is not None:
return self._size
widt... | HeadlessDriver |
python | astropy__astropy | astropy/table/column.py | {
"start": 50645,
"end": 53895
} | class ____(ColumnInfo):
"""
Container for meta information like name, description, format.
This is required when the object is used as a mixin column within a table,
but can be used as a general way to store meta information. In this case
it just adds the ``mask_val`` attribute.
"""
# Add... | MaskedColumnInfo |
python | django__django | tests/prefetch_related/models.py | {
"start": 3088,
"end": 3498
} | class ____(models.Model):
name = models.CharField(max_length=50)
qualifications = models.ManyToManyField(Qualification)
objects = TeacherManager()
objects_custom = TeacherQuerySet.as_manager()
class Meta:
ordering = ["id"]
def __str__(self):
return "%s (%s)" % (
se... | Teacher |
python | django__django | django/db/migrations/state.py | {
"start": 3335,
"end": 24921
} | class ____:
"""
Represent the entire project's overall state. This is the item that is
passed around - do it here rather than at the app level so that cross-app
FKs/etc. resolve properly.
"""
def __init__(self, models=None, real_apps=None):
self.models = models or {}
# Apps to i... | ProjectState |
python | ray-project__ray | python/ray/serve/schema.py | {
"start": 25219,
"end": 27900
} | class ____(BaseModel):
"""Options to start the HTTP Proxy with.
NOTE: This config allows extra parameters to make it forward-compatible (ie
older versions of Serve are able to accept configs from a newer versions,
simply ignoring new parameters).
"""
host: str = Field(
defa... | HTTPOptionsSchema |
python | conda__conda | conda/models/version.py | {
"start": 1250,
"end": 17320
} | class ____(metaclass=SingleStrArgCachingType):
"""Implement an order relation between version strings.
Version strings can contain the usual alphanumeric characters
(A-Za-z0-9), separated into components by dots and underscores. Empty
segments (i.e. two consecutive dots, a leading/trailing underscore)
... | VersionOrder |
python | sympy__sympy | sympy/physics/biomechanics/tests/test_musculotendon.py | {
"start": 21367,
"end": 32906
} | class ____:
@staticmethod
def test_class():
assert issubclass(MusculotendonDeGroote2016, ForceActuator)
assert issubclass(MusculotendonDeGroote2016, _NamedMixin)
assert MusculotendonDeGroote2016.__name__ == 'MusculotendonDeGroote2016'
@staticmethod
def test_instance():
... | TestMusculotendonDeGroote2016 |
python | networkx__networkx | networkx/generators/tests/test_lattice.py | {
"start": 5325,
"end": 5950
} | class ____:
"""Unit tests for :func:`networkx.generators.lattice.hypercube_graph`"""
def test_special_cases(self):
for n, H in [
(0, nx.null_graph()),
(1, nx.path_graph(2)),
(2, nx.cycle_graph(4)),
(3, nx.cubical_graph()),
]:
G = nx.hy... | TestHypercubeGraph |
python | allegroai__clearml | clearml/backend_api/services/v2_13/models.py | {
"start": 106081,
"end": 110344
} | class ____(Response):
"""
Response of models.publish_many endpoint.
:param published: Number of models published
:type published: int
:param published_tasks:
:type published_tasks: Sequence[dict]
"""
_service = "models"
_action = "publish_many"
_version = "2.13"
_schema = {... | PublishManyResponse |
python | tensorflow__tensorflow | tensorflow/python/kernel_tests/control_flow/cond_v2_test.py | {
"start": 62470,
"end": 64061
} | class ____(test.TestCase):
def testCase(self):
def branch1(x):
logging_ops.print_v2("1")
return x
def branch2(x):
return x + 1
with ops.Graph().as_default():
x = array_ops.constant(1)
output = cond_v2.indexed_case(
array_ops.constant(0), [lambda: branch1(x), lam... | CaseTest |
python | pytorch__pytorch | torch/_export/error.py | {
"start": 24,
"end": 1064
} | class ____(Enum):
# User providing invalid inputs to either tracer, or other public facing APIs
INVALID_INPUT_TYPE = 1
# User returning values from their models that we don't support.
INVALID_OUTPUT_TYPE = 2
# Generated IR does not conform to Export IR Specification.
VIOLATION_OF_SPEC = 3
... | ExportErrorType |
python | django__django | tests/test_client_regress/tests.py | {
"start": 54053,
"end": 55744
} | class ____(SimpleTestCase):
"""
HttpRequest.body, HttpRequest.read(), and HttpRequest.read(BUFFER) have
proper LimitedStream behavior.
Refs #14753, #15785
"""
def test_body_from_empty_request(self):
"""HttpRequest.body on a test client GET request should return
the empty string... | ReadLimitedStreamTest |
python | huggingface__transformers | src/transformers/models/dinat/modeling_dinat.py | {
"start": 7045,
"end": 8598
} | class ____(nn.Module):
"""
Convolutional Downsampling Layer.
Args:
dim (`int`):
Number of input channels.
norm_layer (`nn.Module`, *optional*, defaults to `nn.LayerNorm`):
Normalization layer class.
"""
def __init__(self, dim: int, norm_layer: nn.Module = nn... | DinatDownsampler |
python | scipy__scipy | scipy/stats/tests/test_generation/reference_distributions.py | {
"start": 10226,
"end": 12343
} | class ____(ReferenceDistribution):
"""Reference implementation of the SkewNormal distribution.
Follow the example here to generate new reference distributions.
Use the reference distributions to generate reference values of
distributions functions. For now, copy-paste the output into unit
tests. Fu... | SkewNormal |
python | run-llama__llama_index | llama-index-integrations/vector_stores/llama-index-vector-stores-vearch/llama_index/vector_stores/vearch/base.py | {
"start": 673,
"end": 11451
} | class ____(BasePydanticVectorStore):
"""
Vearch vector store:
embeddings are stored within a Vearch table.
when query, the index uses Vearch to query for the top
k most similar nodes.
Args:
chroma_collection (chromadb.api.models.Collection.Collection):
ChromaDB c... | VearchVectorStore |
python | kamyu104__LeetCode-Solutions | Python/merge-operations-for-minimum-travel-time.py | {
"start": 81,
"end": 1029
} | class ____(object):
def minTravelTime(self, l, n, k, position, time):
"""
:type l: int
:type n: int
:type k: int
:type position: List[int]
:type time: List[int]
:rtype: int
"""
prefix = [0]*(n+1)
for i in xrange(n):
prefix[i... | Solution |
python | pydantic__pydantic | pydantic/experimental/pipeline.py | {
"start": 2483,
"end": 2873
} | class ____:
pass
# TODO: ultimately, make this public, see https://github.com/pydantic/pydantic/pull/9459#discussion_r1628197626
# Also, make this frozen eventually, but that doesn't work right now because of the generic base
# Which attempts to modify __orig_base__ and such.
# We could go with a manual freeze, b... | _FieldTypeMarker |
python | pytransitions__transitions | transitions/extensions/diagrams.py | {
"start": 1156,
"end": 2104
} | class ____(Transition):
"""Transition used in conjunction with (Nested)Graphs to update graphs whenever a transition is
conducted.
"""
def __init__(self, *args, **kwargs):
label = kwargs.pop("label", None)
super(TransitionGraphSupport, self).__init__(*args, **kwargs)
if labe... | TransitionGraphSupport |
python | vyperlang__vyper | vyper/ast/nodes.py | {
"start": 34400,
"end": 34520
} | class ____(Operator):
__slots__ = ()
_description = "bitwise and"
_pretty = "&"
_op = operator.and_
| BitAnd |
python | pytorch__pytorch | torch/_dynamo/variables/tensor.py | {
"start": 66002,
"end": 66623
} | class ____(TensorVariable):
"""An unspecialized python variable which prevents access to the underlying raw value.
This is needed if item is called on a FakeTensor."""
_nonvar_fields = {
"need_unwrap",
*TensorVariable._nonvar_fields,
}
def __init__(self, proxy: torch.fx.Proxy, **kw... | FakeItemVariable |
python | great-expectations__great_expectations | tests/core/test_expectation_suite.py | {
"start": 2924,
"end": 7592
} | class ____:
"""Tests related to ExpectationSuite.__init__()"""
@pytest.mark.unit
def test_expectation_suite_init_defaults(
self,
empty_data_context: AbstractDataContext,
fake_expectation_suite_name: str,
):
suite = ExpectationSuite(name=fake_expectation_suite_name)
... | TestInit |
python | pypa__pip | src/pip/_vendor/rich/errors.py | {
"start": 422,
"end": 495
} | class ____(ConsoleError):
"""Markup was badly formatted."""
| MarkupError |
python | kamyu104__LeetCode-Solutions | Python/number-of-recent-calls.py | {
"start": 105,
"end": 410
} | class ____(object):
def __init__(self):
self.__q = collections.deque()
def ping(self, t):
"""
:type t: int
:rtype: int
"""
self.__q.append(t)
while self.__q[0] < t-3000:
self.__q.popleft()
return len(self.__q)
| RecentCounter |
python | django__django | django/core/exceptions.py | {
"start": 2571,
"end": 6422
} | class ____(Exception):
"""An error while validating data."""
def __init__(self, message, code=None, params=None):
"""
The `message` argument can be a single error, a list of errors, or a
dictionary that maps field names to lists of errors. What we define as
an "error" can be eit... | ValidationError |
python | eventlet__eventlet | eventlet/zipkin/api.py | {
"start": 2174,
"end": 3993
} | class ____:
END_ANNOTATION = SERVER_SEND
def __init__(self, name, trace_id, span_id, parent_id, sampled, endpoint):
"""
:param name: RPC name (String)
:param trace_id: int
:param span_id: int
:param parent_id: int or None
:param sampled: lets the downstream serv... | TraceData |
python | charlax__professional-programming | antipatterns/sqlalchemy-examples/exists.py | {
"start": 302,
"end": 904
} | class ____(Base):
__tablename__ = "toasters"
id = Column(Integer, primary_key=True)
name = Column(String)
color = Column(String)
def toaster_exists_bad(toaster_id):
session = Session()
return bool(session.query(Toaster).filter_by(id=toaster_id).first())
def toaster_exists_good(toaster_id):
... | Toaster |
python | dagster-io__dagster | python_modules/dagster/dagster/_core/definitions/input.py | {
"start": 2158,
"end": 12512
} | class ____:
"""Defines an argument to an op's compute function.
Inputs may flow from previous op outputs, or be stubbed using config. They may optionally
be typed using the Dagster type system.
Args:
name (str): Name of the input.
dagster_type (Optional[Union[Type, DagsterType]]]): The... | InputDefinition |
python | allegroai__clearml | clearml/backend_api/services/v2_20/events.py | {
"start": 65282,
"end": 66334
} | class ____(Response):
"""
Response of events.delete_for_task endpoint.
:param deleted: Number of deleted events
:type deleted: bool
"""
_service = "events"
_action = "delete_for_task"
_version = "2.20"
_schema = {
"definitions": {},
"properties": {
"dele... | DeleteForTaskResponse |
python | kubernetes-client__python | kubernetes/client/models/v1_csi_driver_list.py | {
"start": 383,
"end": 6872
} | 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... | V1CSIDriverList |
python | huggingface__transformers | src/transformers/models/ernie/modular_ernie.py | {
"start": 28836,
"end": 33390
} | class ____(BertForMultipleChoice):
@can_return_tuple
@auto_docstring
def forward(
self,
input_ids: Optional[torch.Tensor] = None,
attention_mask: Optional[torch.Tensor] = None,
token_type_ids: Optional[torch.Tensor] = None,
task_type_ids: Optional[torch.Tensor] = None... | ErnieForMultipleChoice |
python | django__django | tests/null_queries/models.py | {
"start": 412,
"end": 610
} | class ____(models.Model):
first = models.ForeignKey(OuterA, models.CASCADE)
# second would clash with the __second lookup.
third = models.ForeignKey(OuterB, models.SET_NULL, null=True)
| Inner |
python | doocs__leetcode | lcci/16.20.T9/Solution2.py | {
"start": 0,
"end": 228
} | class ____:
def getValidT9Words(self, num: str, words: List[str]) -> List[str]:
trans = str.maketrans(ascii_lowercase, "22233344455566677778889999")
return [w for w in words if w.translate(trans) == num]
| Solution |
python | huggingface__transformers | tests/quantization/autoround/test_auto_round.py | {
"start": 1197,
"end": 9320
} | class ____(unittest.TestCase):
model_name = "OPEA/Qwen2.5-1.5B-Instruct-int4-sym-inc"
input_text = "There is a girl who likes adventure,"
EXPECTED_OUTPUTS = set()
## Different backends may produce slight variations in output
EXPECTED_OUTPUTS.add(
"There is a girl who likes adventure, and she... | AutoRoundTest |
python | getsentry__sentry | src/sentry/shared_integrations/exceptions/__init__.py | {
"start": 4327,
"end": 4378
} | class ____(ApiError):
code = 409
| ApiConflictError |
python | dagster-io__dagster | python_modules/dagster/dagster/_core/storage/db_io_manager.py | {
"start": 3061,
"end": 13405
} | class ____(IOManager):
def __init__(
self,
*,
type_handlers: Sequence[DbTypeHandler],
db_client: DbClient,
database: str,
schema: Optional[str] = None,
io_manager_name: Optional[str] = None,
default_load_type: Optional[type] = None,
):
self... | DbIOManager |
python | walkccc__LeetCode | solutions/1392. Longest Happy Prefix/1392.py | {
"start": 0,
"end": 577
} | class ____:
def longestPrefix(self, s: str) -> str:
BASE = 26
HASH = 8_417_508_174_513
n = len(s)
maxLength = 0
pow = 1
prefixHash = 0 # the hash of s[0..i]
suffixHash = 0 # the hash of s[j..n)
def val(c: str) -> int:
return ord(c) - ord('a')
j = n - 1
for i in range(... | Solution |
python | pandas-dev__pandas | asv_bench/benchmarks/join_merge.py | {
"start": 9785,
"end": 10360
} | class ____:
params = ["inner", "outer", "left", "right"]
param_names = ["how"]
def setup(self, how):
low, high, n = -1000, 1000, 10**6
self.left = DataFrame(
np.random.randint(low, high, (n, 7)), columns=list("ABCDEFG")
)
self.left["left"] = self.left.sum(axis=1)... | I8Merge |
python | scipy__scipy | scipy/stats/_distn_infrastructure.py | {
"start": 19471,
"end": 21669
} | class ____(rv_frozen):
def pdf(self, x):
return self.dist.pdf(x, *self.args, **self.kwds)
def logpdf(self, x):
return self.dist.logpdf(x, *self.args, **self.kwds)
def argsreduce(cond, *args):
"""Clean arguments to:
1. Ensure all arguments are iterable (arrays of dimension at least o... | rv_continuous_frozen |
python | huggingface__transformers | src/transformers/models/big_bird/modeling_big_bird.py | {
"start": 89780,
"end": 95732
} | class ____(BigBirdPreTrainedModel):
_tied_weights_keys = {
"cls.predictions.decoder.bias": "cls.predictions.bias",
"cls.predictions.decoder.weight": "bert.embeddings.word_embeddings.weight",
}
def __init__(self, config):
super().__init__(config)
if config.is_decoder:
... | BigBirdForMaskedLM |
python | econchick__interrogate | tests/functional/sample/full.py | {
"start": 108,
"end": 1706
} | class ____:
"""Foo class"""
def __init__(self):
"""init method of Foo class"""
self.foo = None
def __str__(self):
"""a magic method."""
pass
def _semiprivate(self):
"""a semipriate method"""
pass
def __private(self):
"""a private method"""
... | Foo |
python | pytorch__pytorch | torch/autograd/variable.py | {
"start": 142,
"end": 256
} | class ____(type):
def __instancecheck__(cls, other):
return isinstance(other, torch.Tensor)
| VariableMeta |
python | scrapy__scrapy | tests/test_pipeline_files.py | {
"start": 11396,
"end": 11745
} | class ____:
name: str
# default fields
file_urls: list = dataclasses.field(default_factory=list)
files: list = dataclasses.field(default_factory=list)
# overridden fields
custom_file_urls: list = dataclasses.field(default_factory=list)
custom_files: list = dataclasses.field(default_factory=l... | FilesPipelineTestDataClass |
python | apache__airflow | providers/google/src/airflow/providers/google/cloud/links/dataprep.py | {
"start": 1293,
"end": 1516
} | class ____(BaseGoogleLink):
"""Helper class for constructing Dataprep job group link."""
name = "Job group details page"
key = "dataprep_job_group_page"
format_str = DATAPREP_JOB_GROUP_LINK
| DataprepJobGroupLink |
python | tensorflow__tensorflow | third_party/xla/xla/python/xla_client.py | {
"start": 8242,
"end": 9747
} | class ____:
"""Python representation of a xla.DotDimensionNumbers protobuf."""
__slots__ = (
'lhs_contracting_dimensions',
'rhs_contracting_dimensions',
'lhs_batch_dimensions',
'rhs_batch_dimensions',
)
def __init__(self):
self.lhs_contracting_dimensions = []
self.rhs_contracti... | DotDimensionNumbers |
python | google__jax | tests/pallas/pallas_test.py | {
"start": 46624,
"end": 46711
} | class ____(PallasBaseTest):
INTERPRET = True
| PallasCallInputOutputAliasingInterpretTest |
python | kamyu104__LeetCode-Solutions | Python/maximum-running-time-of-n-computers.py | {
"start": 595,
"end": 1126
} | class ____(object):
def maxRunTime(self, n, batteries):
"""
:type n: int
:type batteries: List[int]
:rtype: int
"""
def check(n, batteries, x):
return sum(min(b, x) for b in batteries) >= n*x
left, right = min(batteries), sum(batteries)//n
... | Solution2 |
python | great-expectations__great_expectations | contrib/great_expectations_semantic_types_expectations/great_expectations_semantic_types_expectations/expectations/expect_column_values_to_be_valid_ismn.py | {
"start": 855,
"end": 1842
} | class ____(ColumnMapMetricProvider):
# This is the id string that will be used to reference your metric.
condition_metric_name = "column_values.to_be_valid_ismn"
# This method implements the core logic for the PandasExecutionEngine
@column_condition_partial(engine=PandasExecutionEngine)
def _pandas... | ColumnValuesToBeValidIsmn |
python | mlflow__mlflow | mlflow/genai/judges/tools/constants.py | {
"start": 290,
"end": 702
} | class ____:
"""Registry of judge tool names."""
GET_TRACE_INFO = "get_trace_info"
GET_ROOT_SPAN = "get_root_span"
GET_SPAN = "get_span"
LIST_SPANS = "list_spans"
SEARCH_TRACE_REGEX = "search_trace_regex"
GET_SPAN_PERFORMANCE_AND_TIMING_REPORT = "get_span_performance_and_timing_report"
_... | ToolNames |
python | run-llama__llama_index | llama-index-integrations/readers/llama-index-readers-stackoverflow/llama_index/readers/stackoverflow/base.py | {
"start": 2629,
"end": 6460
} | class ____(BaseReader):
def __init__(
self, api_key: str = None, team_name: str = None, cache_dir: str = None
) -> None:
self._api_key = api_key or os.environ.get("STACKOVERFLOW_PAT")
self._team_name = team_name or os.environ.get("STACKOVERFLOW_TEAM_NAME")
self._last_index_time =... | StackoverflowReader |
python | numpy__numpy | numpy/distutils/system_info.py | {
"start": 86227,
"end": 86428
} | class ____(openblas_info):
section = 'openblas'
dir_env_var = 'OPENBLAS'
_lib_names = ['openblas']
_require_symbols = ['zungqr_']
notfounderror = BlasNotFoundError
| openblas_lapack_info |
python | huggingface__transformers | src/transformers/models/wav2vec2_conformer/modular_wav2vec2_conformer.py | {
"start": 28656,
"end": 29323
} | class ____(Wav2Vec2ForCTC):
def __init__(self, config, target_lang: Optional[str] = None):
r"""
target_lang (`str`, *optional*):
Language id of adapter weights. Adapter weights are stored in the format adapter.<lang>.safetensors or
adapter.<lang>.bin. Only relevant when using... | Wav2Vec2ConformerForCTC |
python | kamyu104__LeetCode-Solutions | Python/minimum-cost-to-set-cooking-time.py | {
"start": 42,
"end": 722
} | class ____(object):
def minCostSetTime(self, startAt, moveCost, pushCost, targetSeconds):
"""
:type startAt: int
:type moveCost: int
:type pushCost: int
:type targetSeconds: int
:rtype: int
"""
def cost(m, s):
if not (0 <= m <= 99 and ... | Solution |
python | django__django | tests/sessions_tests/tests.py | {
"start": 36866,
"end": 37005
} | class ____(FileSessionTests):
def mkdtemp(self):
tmp_dir = super().mkdtemp()
return Path(tmp_dir)
| FileSessionPathLibTests |
python | ansible__ansible | lib/ansible/_internal/_ssh/_ssh_agent.py | {
"start": 1726,
"end": 2624
} | class ____(enum.IntEnum):
# Responses
SSH_AGENT_FAILURE = 5
SSH_AGENT_SUCCESS = 6
SSH_AGENT_IDENTITIES_ANSWER = 12
SSH_AGENT_SIGN_RESPONSE = 14
SSH_AGENT_EXTENSION_FAILURE = 28
SSH_AGENT_EXTENSION_RESPONSE = 29
# Constraints
SSH_AGENT_CONSTRAIN_LIFETIME = 1
SSH_AGENT_CONSTRAIN_C... | ProtocolMsgNumbers |
python | optuna__optuna | optuna/pruners/_patient.py | {
"start": 248,
"end": 4646
} | class ____(BasePruner):
"""Pruner which wraps another pruner with tolerance.
This pruner monitors intermediate values in a trial and prunes the trial if the improvement in
the intermediate values after a patience period is less than a threshold.
The pruner handles NaN values in the following manner:
... | PatientPruner |
python | getsentry__sentry | src/sentry/api/bases/organization.py | {
"start": 5630,
"end": 6016
} | class ____(OrganizationPermission):
scope_map = {
"GET": ["org:read", "org:write", "org:admin", "org:integrations", "org:ci"],
"POST": ["org:read", "org:write", "org:admin", "org:integrations"],
"PUT": ["org:read", "org:write", "org:admin", "org:integrations"],
"DELETE": ["org:admin"... | OrganizationIntegrationsLoosePermission |
python | pypa__hatch | tests/cli/status/test_status.py | {
"start": 5517,
"end": 8727
} | class ____:
def test_no_detection_no_project(self, hatch, config_file, helpers, isolation):
config_file.model.mode = "aware"
config_file.save()
result = hatch("status")
assert result.exit_code == 0, result.output
assert result.output == helpers.dedent(
f"""
... | TestModeAware |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/with6.py | {
"start": 147,
"end": 389
} | class ____(type):
def __enter__(cls) -> "ClassA":
print("Enter A")
return cls
def __exit__(
cls, exc_typ: type[Exception], exc_val: Exception, exc_tbc: TracebackType
) -> None:
print("Exit A")
| ClassA |
python | pandas-dev__pandas | pandas/tests/frame/methods/test_asfreq.py | {
"start": 319,
"end": 10283
} | class ____:
def test_asfreq2(self, frame_or_series):
ts = frame_or_series(
[0.0, 1.0, 2.0],
index=DatetimeIndex(
[
datetime(2009, 10, 30),
datetime(2009, 11, 30),
datetime(2009, 12, 31),
],
... | TestAsFreq |
python | falconry__falcon | falcon/routing/static.py | {
"start": 11502,
"end": 12162
} | class ____(StaticRoute):
"""Subclass of StaticRoute with modifications to support ASGI apps."""
async def __call__( # type: ignore[override]
self,
req: asgi.Request,
resp: asgi.Response,
ws: asgi.WebSocket | None = None,
**kw: Any,
) -> None:
if ws is not No... | StaticRouteAsync |
python | Textualize__textual | docs/examples/styles/width_comparison.py | {
"start": 127,
"end": 240
} | class ____(Static):
def compose(self):
ruler_text = "····•" * 100
yield Label(ruler_text)
| Ruler |
python | falconry__falcon | falcon/media/base.py | {
"start": 6760,
"end": 7938
} | class ____(metaclass=abc.ABCMeta):
"""Abstract Base Class for a WebSocket TEXT media handler."""
def serialize(self, media: object) -> str:
"""Serialize the media object to a Unicode string.
By default, this method raises an instance of
:class:`NotImplementedError`. Therefore, it must ... | TextBaseHandlerWS |
python | django-import-export__django-import-export | tests/core/admin.py | {
"start": 418,
"end": 478
} | class ____(ImportMixin, admin.ModelAdmin):
pass
| ChildAdmin |
python | ray-project__ray | python/ray/llm/_internal/common/utils/cloud_filesystem/azure_filesystem.py | {
"start": 514,
"end": 2858
} | class ____(BaseCloudFileSystem):
"""Azure-specific implementation of cloud filesystem operations.
**Note**: This implementation currently delegates to PyArrowFileSystem to maintain
stability. Optimized implementation using azure-storage-blob SDK and azcopy
will be added in a future PR.
"""
@st... | AzureFileSystem |
python | PyCQA__pylint | doc/data/messages/m/match-class-bind-self/good.py | {
"start": 0,
"end": 293
} | class ____:
__match_args__ = ("title", "year")
def __init__(self, title, year):
self.title = title
self.year = year
def func(item: Book):
match item:
case Book(title=str() as title):
...
case Book(year=int() as year):
...
| Book |
python | jazzband__django-oauth-toolkit | oauth2_provider/views/oidc.py | {
"start": 8814,
"end": 19764
} | class ____(OIDCLogoutOnlyMixin, FormView):
template_name = "oauth2_provider/logout_confirm.html"
form_class = ConfirmLogoutForm
# Only delete tokens for Application whose client type and authorization
# grant type are in the respective lists.
token_deletion_client_types = [
Application.CLIEN... | RPInitiatedLogoutView |
python | apache__airflow | providers/google/tests/unit/google/cloud/operators/test_dlp.py | {
"start": 20003,
"end": 20723
} | class ____:
@mock.patch("airflow.providers.google.cloud.operators.dlp.CloudDLPHook")
def test_list_info_types(self, mock_hook):
mock_hook.return_value.list_info_types.return_value = ListInfoTypesResponse()
operator = CloudDLPListInfoTypesOperator(task_id="id")
operator.execute(context=mo... | TestCloudDLPListInfoTypesOperator |
python | pyinstaller__pyinstaller | PyInstaller/building/datastruct.py | {
"start": 7648,
"end": 17435
} | class ____(Target, list):
"""
This class is a way of creating a TOC (Table of Contents) list that describes some or all of the files within a
directory.
"""
def __init__(self, root=None, prefix=None, excludes=None, typecode='DATA'):
"""
root
The root of the tree (on t... | Tree |
python | kubernetes-client__python | kubernetes/client/models/v1_ceph_fs_volume_source.py | {
"start": 383,
"end": 8734
} | 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... | V1CephFSVolumeSource |
python | Pylons__pyramid | tests/test_renderers.py | {
"start": 15950,
"end": 16989
} | class ____(unittest.TestCase):
def setUp(self):
self.config = cleanUp()
def tearDown(self):
cleanUp()
def _makeOne(self, *arg, **kw):
from pyramid.renderers import NullRendererHelper
return NullRendererHelper(*arg, **kw)
def test_instance_conforms(self):
from ... | TestNullRendererHelper |
python | PrefectHQ__prefect | tests/test_task_worker.py | {
"start": 6540,
"end": 8841
} | class ____:
async def test_task_run_via_task_worker_respects_retry_policy(
self, prefect_client, events_pipeline
):
count = 0
@task(retries=1, persist_result=True)
def task_with_retry():
nonlocal count
if count == 0:
count += 1
... | TestTaskWorkerTaskRunRetries |
python | docker__docker-py | tests/unit/errors_test.py | {
"start": 301,
"end": 3874
} | class ____(unittest.TestCase):
def test_api_error_is_caught_by_dockerexception(self):
try:
raise APIError("this should be caught by DockerException")
except DockerException:
pass
def test_status_code_200(self):
"""The status_code property is present with 200 resp... | APIErrorTest |
python | etianen__django-reversion | tests/test_app/tests/test_admin.py | {
"start": 1984,
"end": 2322
} | class ____(LoginMixin, AdminMixin, TestBase):
def testChangelistView(self):
obj = TestModelParent.objects.create()
response = self.client.get(resolve_url("admin:test_app_testmodelparent_changelist"))
self.assertContains(response, resolve_url("admin:test_app_testmodelparent_change", obj.pk))... | AdminChangelistView |
python | charliermarsh__ruff | crates/ruff_linter/resources/test/fixtures/pylint/unnecessary_dunder_call.py | {
"start": 2621,
"end": 3390
} | class ____:
def __init__(self, stuff: Any) -> None:
super().__init__() # OK
super().__class__(stuff=(1, 2, 3)) # OK
def __getattribute__(self, item):
return object.__getattribute__(self, item) # OK
def do_thing(self, item):
return object.__getattribute__(self, item) # P... | Thing |
python | langchain-ai__langchain | libs/core/langchain_core/prompts/chat.py | {
"start": 22290,
"end": 22479
} | class ____(_StringImageMessagePromptTemplate):
"""AI message prompt template. This is a message sent from the AI."""
_msg_class: type[BaseMessage] = AIMessage
| AIMessagePromptTemplate |
python | pytorch__pytorch | torch/_export/pass_infra/node_metadata.py | {
"start": 176,
"end": 771
} | class ____:
def __init__(self, data: dict[str, Any]) -> None:
self.data: dict[str, Any] = data.copy()
def __getitem__(self, key: str) -> NodeMetadataValue:
return self.data[key]
def __setitem__(self, key: str, value: NodeMetadataValue) -> NodeMetadataValue:
if key in PROTECTED_KEYS... | NodeMetadata |
python | sphinx-doc__sphinx | tests/roots/test-ext-autodoc/target/inherited_annotations.py | {
"start": 234,
"end": 310
} | class ____(HasTypeAnnotatedMember):
a = 1
"""Local"""
| NoTypeAnnotation |
python | django__django | tests/admin_views/models.py | {
"start": 23020,
"end": 23144
} | class ____(models.Model):
"""
Model whose change_view is disabled in admin
Refs #20640.
"""
| UnchangeableObject |
python | getsentry__sentry | src/sentry/seer/explorer/custom_tool_utils.py | {
"start": 657,
"end": 762
} | class ____(BaseModel):
"""Simple integer type."""
kind: Literal["integer"] = "integer"
| IntegerType |
python | HypothesisWorks__hypothesis | hypothesis-python/src/hypothesis/database.py | {
"start": 41324,
"end": 47542
} | class ____(ExampleDatabase):
"""A wrapper which defers writes on the given database to a background thread.
Calls to :meth:`~hypothesis.database.ExampleDatabase.fetch` wait for any
enqueued writes to finish before fetching from the database.
"""
def __init__(self, db: ExampleDatabase) -> None:
... | BackgroundWriteDatabase |
python | huggingface__transformers | src/transformers/models/upernet/modeling_upernet.py | {
"start": 2212,
"end": 2807
} | class ____(nn.Module):
def __init__(self, pool_scale: int, in_channels: int, channels: int) -> None:
super().__init__()
self.layers = [
nn.AdaptiveAvgPool2d(pool_scale),
UperNetConvModule(in_channels, channels, kernel_size=1),
]
for i, layer in enumerate(self.... | UperNetPyramidPoolingBlock |
python | python-openxml__python-docx | src/docx/text/pagebreak.py | {
"start": 313,
"end": 4950
} | class ____(Parented):
"""A page-break inserted by Word during page-layout for print or display purposes.
This usually does not correspond to a "hard" page-break inserted by the document
author, rather just that Word ran out of room on one page and needed to start
another. The position of these can chan... | RenderedPageBreak |
python | pytorch__pytorch | torch/nn/modules/sparse.py | {
"start": 250,
"end": 11009
} | class ____(Module):
r"""A simple lookup table that stores embeddings of a fixed dictionary and size.
This module is often used to store word embeddings and retrieve them using indices.
The input to the module is a list of indices, and the output is the corresponding
word embeddings.
Args:
... | Embedding |
python | gevent__gevent | src/greentest/3.10/test_socket.py | {
"start": 121947,
"end": 125368
} | class ____(RecvmsgIntoMixin, RecvmsgGenericTests):
# Tests for recvmsg_into() which can use any socket type.
def testRecvmsgIntoBadArgs(self):
# Check that recvmsg_into() rejects invalid arguments.
buf = bytearray(len(MSG))
self.assertRaises(TypeError, self.serv_sock.recvmsg_into)
... | RecvmsgIntoTests |
python | astropy__astropy | astropy/modeling/functional_models.py | {
"start": 64594,
"end": 65863
} | class ____(Fittable2DModel):
"""
Two dimensional Constant model.
Parameters
----------
amplitude : float
Value of the constant function
See Also
--------
Const1D
Notes
-----
Model formula:
.. math:: f(x, y) = A
"""
amplitude = Parameter(
d... | Const2D |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.