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 | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 79526,
"end": 79907
} | class ____(sgqlc.types.Enum):
"""Properties by which ref connections can be ordered.
Enumeration Choices:
* `ALPHABETICAL`: Order refs by their alphanumeric name
* `TAG_COMMIT_DATE`: Order refs by underlying commit date if the
ref prefix is refs/tags/
"""
__schema__ = github_schema
... | RefOrderField |
python | pytorch__pytorch | torch/nn/modules/pixelshuffle.py | {
"start": 134,
"end": 2060
} | class ____(Module):
r"""Rearrange elements in a tensor according to an upscaling factor.
Rearranges elements in a tensor of shape :math:`(*, C \times r^2, H, W)`
to a tensor of shape :math:`(*, C, H \times r, W \times r)`, where r is an upscale factor.
This is useful for implementing efficient sub-pix... | PixelShuffle |
python | charliermarsh__ruff | crates/ruff_python_parser/resources/valid/statement/class.py | {
"start": 741,
"end": 827
} | class ____[*Ts = Unpack[tuple[int, str]]](): ...
# TypeVarTuple with starred default
| Test |
python | kamyu104__LeetCode-Solutions | Python/reshape-the-matrix.py | {
"start": 37,
"end": 592
} | class ____(object):
def matrixReshape(self, nums, r, c):
"""
:type nums: List[List[int]]
:type r: int
:type c: int
:rtype: List[List[int]]
"""
if not nums or \
r*c != len(nums) * len(nums[0]):
return nums
result = [[0 for _ in x... | Solution |
python | pytorch__pytorch | torch/testing/_internal/common_utils.py | {
"start": 118700,
"end": 118747
} | class ____(UnittestPair):
CLS = type
| TypePair |
python | matplotlib__matplotlib | galleries/examples/event_handling/resample.py | {
"start": 672,
"end": 2861
} | class ____:
def __init__(self, xdata, y1data, y2data):
self.origY1Data = y1data
self.origY2Data = y2data
self.origXData = xdata
self.max_points = 50
self.delta = xdata[-1] - xdata[0]
def plot(self, ax):
x, y1, y2 = self._downsample(self.origXData.min(), self.orig... | DataDisplayDownsampler |
python | streamlit__streamlit | lib/streamlit/runtime/caching/cache_resource_api.py | {
"start": 2393,
"end": 4840
} | class ____(CacheStatsProvider):
"""Manages all ResourceCache instances."""
def __init__(self) -> None:
self._caches_lock = threading.Lock()
self._function_caches: dict[str, ResourceCache[Any]] = {}
def get_cache(
self,
key: str,
display_name: str,
max_entrie... | ResourceCaches |
python | dagster-io__dagster | .buildkite/buildkite-shared/buildkite_shared/step_builders/group_step_builder.py | {
"start": 507,
"end": 684
} | class ____(TypedDict, total=False):
group: str
label: str
steps: list[GroupLeafStepConfiguration]
key: Optional[str]
skip: Optional[str]
| GroupStepConfiguration |
python | pytorch__pytorch | torch/_inductor/codegen/simd.py | {
"start": 12211,
"end": 12298
} | class ____:
buffer_name: str
reduction_type: str
value: Any
| PartialAccumulate |
python | facebook__pyre-check | client/frontend_configuration.py | {
"start": 890,
"end": 966
} | class ____:
name: str
metadata: Optional[str] = None
| SavedStateProject |
python | dagster-io__dagster | python_modules/dagster/dagster/_core/definitions/metadata/metadata_value.py | {
"start": 18648,
"end": 19125
} | class ____(MetadataValue[str]):
"""Container class for text metadata entry data.
Args:
text (Optional[str]): The text data.
"""
text: PublicAttr[Optional[str]] = "" # type: ignore
@public
@property
def value(self) -> str:
"""Optional[str]: The wrapped text data."""
... | TextMetadataValue |
python | pytorch__pytorch | torch/_dynamo/variables/builder.py | {
"start": 161358,
"end": 169092
} | class ____:
"""
Like builder, but stateless and does not require a source. Useful for simple type->VT objects, or objects
that are being created/evaporated during inlining (ex: consider a locally made list of tensors we then iterate over
.), such a list should not show up as an artifact from inputs, nor... | SourcelessBuilder |
python | pytorch__pytorch | test/onnx/test_models_quantized_onnxruntime.py | {
"start": 1600,
"end": 3429
} | class ____(onnx_test_common._TestONNXRuntime):
def run_test(self, model, inputs, *args, **kwargs):
model = _TopPredictor(model)
return super().run_test(model, inputs, *args, **kwargs)
def test_mobilenet_v3(self):
model = torchvision.models.quantization.mobilenet_v3_large(
pr... | TestQuantizedModelsONNXRuntime |
python | dagster-io__dagster | python_modules/libraries/dagster-airbyte/dagster_airbyte/types.py | {
"start": 149,
"end": 662
} | class ____:
def __init__(
self,
raw_table_name: str,
schema: TableSchema,
normalization_tables: Optional[Mapping[str, "AirbyteTableMetadata"]] = None,
):
"""Contains metadata about an Airbyte table, including its destination raw table name,
schema and any created ... | AirbyteTableMetadata |
python | huggingface__transformers | src/transformers/models/janus/processing_janus.py | {
"start": 1264,
"end": 1339
} | class ____(TextKwargs, total=False):
generation_mode: str
| JanusTextKwargs |
python | airbytehq__airbyte | airbyte-ci/connectors/erd/tests/test_relationships.py | {
"start": 396,
"end": 3898
} | class ____(TestCase):
def setUp(self) -> None:
self._merger = RelationshipsMerger()
def test_given_no_confirmed_then_return_estimation(self) -> None:
estimated: Relationships = {
"streams": [
RelationshipBuilder(_A_STREAM_NAME)
.with_relationship(_A_C... | RelationshipsMergerTest |
python | realpython__materials | python-protocol/birds_v2.py | {
"start": 119,
"end": 208
} | class ____(QuackingThing):
def quack(self):
return "The duck is quacking!"
| Duck |
python | getsentry__sentry | src/sentry/models/organizationslugreservation.py | {
"start": 866,
"end": 3549
} | class ____(ReplicatedControlModel):
__relocation_scope__ = RelocationScope.Excluded
category = OutboxCategory.ORGANIZATION_SLUG_RESERVATION_UPDATE
replication_version = 1
slug = models.SlugField(unique=True, null=False)
organization_id = HybridCloudForeignKey("sentry.organization", null=False, on_d... | OrganizationSlugReservation |
python | django-import-export__django-import-export | tests/core/tests/admin_integration/test_export.py | {
"start": 38853,
"end": 44175
} | class ____(AdminTestMixin, TestCase):
"""
Test case for issue #2094: Export fields should use get_export_fields()
instead of get_import_fields() when showing fields in export form
"""
def setUp(self):
super().setUp()
from core.models import Book
from import_export.fields im... | GetExportFieldsTest |
python | ipython__ipython | IPython/terminal/embed.py | {
"start": 922,
"end": 4167
} | class ____(Magics):
@line_magic
@magic_arguments.magic_arguments()
@magic_arguments.argument('-i', '--instance', action='store_true',
help='Kill instance instead of call location')
@magic_arguments.argument('-x', '--exit', action='store_true',
... | EmbeddedMagics |
python | bokeh__bokeh | src/bokeh/command/subcommands/settings.py | {
"start": 3809,
"end": 6860
} | class ____(Subcommand):
''' Subcommand to print information about Bokeh settings.
'''
name = "settings"
help = "Print information about Bokeh settings and their current values"
args = (
(('-v', '--verbose'), Argument(
action="store_true",
help="Show detailed help... | Settings |
python | pytorch__pytorch | torch/_inductor/codegen/cpp.py | {
"start": 23144,
"end": 35817
} | class ____(OpOverrides):
"""Map element-wise ops to C++"""
@staticmethod
def add(a, b):
return f"{decltype_promoted(a, b)}({a} + {b})"
@staticmethod
def sub(a, b):
return f"{decltype_promoted(a, b)}({a} - {b})"
@staticmethod
def mul(a, b):
return f"{decltype_promot... | CppOverrides |
python | PrefectHQ__prefect | tests/server/models/test_flow_run_input.py | {
"start": 4669,
"end": 5358
} | class ____:
async def test_deletes_flow_run_input(self, session: AsyncSession, flow_run):
await models.flow_run_input.create_flow_run_input(
session=session,
flow_run_input=schemas.core.FlowRunInput(
flow_run_id=flow_run.id, key="my-key", value="my-value"
... | TestDeleteFlowRunInput |
python | davidhalter__jedi | test/completion/descriptors.py | {
"start": 2140,
"end": 2771
} | class ____(object):
a = ''
def __init__(self, a):
self.a = a
def f(x):
return x
f = staticmethod(f)
#?
f.__func
@staticmethod
def g(x):
return x
def s(cls, x):
return x
s = classmethod(s)
@classmethod
def t(cls, x):
return x
... | E |
python | pytorch__pytorch | scripts/release_notes/classifier.py | {
"start": 1369,
"end": 15055
} | class ____(nn.Module):
def __init__(
self,
encoder_base: torchtext.models.XLMR_BASE_ENCODER,
author_map: Dict[str, int],
file_map: [str, int],
config: CategoryConfig,
):
super().__init__()
self.encoder = encoder_base.get_model().requires_grad_(False)
... | CommitClassifier |
python | matplotlib__matplotlib | lib/mpl_toolkits/axisartist/grid_finder.py | {
"start": 11976,
"end": 12732
} | class ____:
def __init__(self, format_dict, formatter=None):
"""
format_dict : dictionary for format strings to be used.
formatter : fall-back formatter
"""
super().__init__()
self._format_dict = format_dict
self._fallback_formatter = formatter
def __call... | DictFormatter |
python | mlflow__mlflow | mlflow/langchain/output_parsers.py | {
"start": 3799,
"end": 5270
} | class ____(BaseTransformOutputParser[str]):
"""
OutputParser that wraps the string output into a dictionary representation of a
:py:class:`ChatAgentResponse <mlflow.types.agent.ChatAgentResponse>` or a
:py:class:`ChatAgentChunk <mlflow.types.agent.ChatAgentChunk>` for easy interoperability.
"""
... | ChatAgentOutputParser |
python | django__django | tests/admin_custom_urls/models.py | {
"start": 1988,
"end": 2446
} | class ____(admin.ModelAdmin):
def response_add(self, request, obj, post_url_continue=None):
return super().response_add(
request,
obj,
post_url_continue=reverse(
"admin:admin_custom_urls_car_history", args=[obj.pk]
),
)
site = admin.A... | CarAdmin |
python | great-expectations__great_expectations | great_expectations/expectations/metadata_types.py | {
"start": 853,
"end": 2128
} | class ____(str, Enum):
"""Severity levels for Expectation failures."""
CRITICAL = "critical"
WARNING = "warning"
INFO = "info"
@override
def __lt__(self, other):
"""Implement semantic ordering: INFO < WARNING < CRITICAL"""
if not isinstance(other, FailureSeverity):
... | FailureSeverity |
python | facelessuser__pymdown-extensions | tests/test_extensions/test_keys.py | {
"start": 49,
"end": 685
} | class ____(util.MdCase):
"""Tests for Keys."""
extension = [
'pymdownx.keys'
]
def test_avoid_base64(self):
"""Test complex case where `**text*text***` may be detected on accident."""
self.check_markdown(
" ++ctrl+a++ ++ctrl... | TestKeys |
python | pydantic__pydantic | pydantic/_internal/_decorators_v1.py | {
"start": 965,
"end": 1164
} | class ____(Protocol):
"""A validator with `kwargs` argument, supported for V1 validators and V2 validators."""
def __call__(self, __value: Any, **kwargs: Any) -> Any: ...
| V1ValidatorWithKwargs |
python | numba__numba | numba/core/typing/templates.py | {
"start": 17197,
"end": 33732
} | class ____(AbstractTemplate):
"""
A base class of templates for overload functions.
"""
def _validate_sigs(self, typing_func, impl_func):
# check that the impl func and the typing func have the same signature!
typing_sig = utils.pysignature(typing_func)
impl_sig = utils.pysignat... | _OverloadFunctionTemplate |
python | encode__django-rest-framework | rest_framework/renderers.py | {
"start": 1381,
"end": 1809
} | class ____:
"""
All renderers should extend this class, setting the `media_type`
and `format` attributes, and override the `.render()` method.
"""
media_type = None
format = None
charset = 'utf-8'
render_style = 'text'
def render(self, data, accepted_media_type=None, renderer_contex... | BaseRenderer |
python | PrefectHQ__prefect | src/prefect/_experimental/sla/objects.py | {
"start": 2491,
"end": 2834
} | class ____(PrefectBaseModel):
"""A response object for the apply_slas_for_deployment method. Contains the names of the created, updated, and deleted SLAs."""
created: list[str]
updated: list[str]
deleted: list[str]
# Concrete SLA types
SlaTypes: TypeAlias = Union[TimeToCompletionSla, LatenessSla, Fre... | SlaMergeResponse |
python | scipy__scipy | benchmarks/benchmarks/go_benchmark_functions/go_funcs_univariate.py | {
"start": 7730,
"end": 8578
} | class ____(Benchmark):
"""
Univariate Problem10 objective function.
This class defines the Univariate Problem10 global optimization problem. This
is a multimodal minimization problem defined as follows:
.. math::
f_{\\text{Problem10}}(x) = -x\\sin(x)
Bound constraints: :math:`x \\in ... | Problem10 |
python | arrow-py__arrow | arrow/locales.py | {
"start": 66198,
"end": 67634
} | class ____(Locale):
names = ["ml"]
past = "{0} മുമ്പ്"
future = "{0} ശേഷം"
timeframes = {
"now": "ഇപ്പോൾ",
"second": "ഒരു നിമിഷം",
"seconds": "{0} സെക്കന്റ്",
"minute": "ഒരു മിനിറ്റ്",
"minutes": "{0} മിനിറ്റ്",
"hour": "ഒരു മണിക്കൂർ",
"hours": ... | MalayalamLocale |
python | MorvanZhou__Reinforcement-learning-with-tensorflow | contents/10_A3C/A3C_continuous_action.py | {
"start": 4602,
"end": 8158
} | class ____(object):
def __init__(self, name, globalAC):
self.env = gym.make(GAME).unwrapped
self.name = name
self.AC = ACNet(name, globalAC)
def work(self):
global GLOBAL_RUNNING_R, GLOBAL_EP
total_step = 1
buffer_s, buffer_a, buffer_r = [], [], []
while ... | Worker |
python | walkccc__LeetCode | solutions/3501. Maximize Active Section with Trade II/3501.py | {
"start": 47,
"end": 89
} | class ____:
start: int
length: int
| Group |
python | apache__airflow | providers/google/src/airflow/providers/google/cloud/triggers/dataplex.py | {
"start": 4851,
"end": 8561
} | class ____(BaseTrigger):
"""
DataplexDataProfileJobTrigger runs on the trigger worker and waits for the job to be `SUCCEEDED` state.
:param job_id: Optional. The ID of a Dataplex job.
:param data_scan_id: Required. DataScan identifier.
:param project_id: Google Cloud Project where the job is runnin... | DataplexDataProfileJobTrigger |
python | PyCQA__pylint | tests/functional/r/regression_02/regression_4660.py | {
"start": 416,
"end": 584
} | class ____:
def my_method(self, option: Literal["mandatory"]) -> Callable[..., Any]:
return my_print
c = MyClass().my_method("mandatory")
c(1, "foo")
| MyClass |
python | pandas-dev__pandas | pandas/tests/indexes/period/test_period_range.py | {
"start": 2457,
"end": 7118
} | class ____:
@pytest.mark.parametrize(
"freq_offset, freq_period",
[
("D", "D"),
("W", "W"),
("QE", "Q"),
("YE", "Y"),
],
)
def test_construction_from_string(self, freq_offset, freq_period):
# non-empty
expected = date_ra... | TestPeriodRange |
python | run-llama__llama_index | llama-index-integrations/tools/llama-index-tools-scrapegraph/examples/scrapegraph-smartscraper-lama-index.py | {
"start": 661,
"end": 3474
} | class ____(BaseModel):
"""Schema for representing a list of company founders."""
founders: List[FounderSchema] = Field(description="List of founders")
def main():
"""Demonstrate SmartScraper functionality with structured data extraction."""
# Initialize the tool spec (will use SGAI_API_KEY from envir... | ListFoundersSchema |
python | cherrypy__cherrypy | cherrypy/test/test_http.py | {
"start": 1882,
"end": 10760
} | class ____(helper.CPWebCase):
def make_connection(self):
if self.scheme == 'https':
return HTTPSConnection('%s:%s' % (self.interface(), self.PORT))
else:
return HTTPConnection('%s:%s' % (self.interface(), self.PORT))
@staticmethod
def setup_server():
class Ro... | HTTPTests |
python | tensorflow__tensorflow | tensorflow/python/data/experimental/kernel_tests/service/distributed_save_load_ft_test.py | {
"start": 1275,
"end": 9357
} | class ____(
data_service_test_base.TestBase, parameterized.TestCase
):
"""Fault tolerance tests for distributed save/load."""
@combinations.generate(
combinations.times(
test_base.eager_only_combinations(),
combinations.combine(
num_elements=[200],
num_work... | DistributedSaveLoadFtTest |
python | pypa__setuptools | setuptools/_scripts.py | {
"start": 468,
"end": 547
} | class ____(TypedDict, total=False):
comments: bool
posix: bool
| _SplitArgs |
python | getsentry__sentry | tests/sentry/utils/test_circuit_breaker.py | {
"start": 273,
"end": 1712
} | class ____(TestCase):
def setUp(self) -> None:
self.key = "test"
self.error_limit = 5
self.passthrough_data = CircuitBreakerPassthrough(limit=2, window=1)
cache.set(ERROR_COUNT_CACHE_KEY(self.key), self.error_limit)
def test_not_activated(self) -> None:
assert not circui... | TestCircuitBreaker |
python | marshmallow-code__marshmallow | src/marshmallow/validate.py | {
"start": 356,
"end": 1049
} | class ____(ABC):
"""Abstract base class for validators.
.. note::
This class does not provide any validation behavior. It is only used to
add a useful `__repr__` implementation for validators.
"""
error: str | None = None
def __repr__(self) -> str:
args = self._repr_args()... | Validator |
python | pypa__pipenv | pipenv/patched/pip/_internal/operations/install/wheel.py | {
"start": 15035,
"end": 27733
} | class ____(ScriptMaker):
def make(
self, specification: str, options: Optional[Dict[str, Any]] = None
) -> List[str]:
_raise_for_invalid_entrypoint(specification)
return super().make(specification, options)
def _install_wheel( # noqa: C901, PLR0915 function is too long
name: str,
... | PipScriptMaker |
python | pytorch__pytorch | torch/nn/modules/normalization.py | {
"start": 11769,
"end": 15292
} | class ____(Module):
r"""Applies Root Mean Square Layer Normalization over a mini-batch of inputs.
This layer implements the operation as described in
the paper `Root Mean Square Layer Normalization <https://arxiv.org/pdf/1910.07467.pdf>`__
.. math::
y_i = \frac{x_i}{\mathrm{RMS}(x)} * \gamma_i... | RMSNorm |
python | run-llama__llama_index | llama-index-integrations/embeddings/llama-index-embeddings-cohere/llama_index/embeddings/cohere/base.py | {
"start": 532,
"end": 931
} | class ____(str, Enum):
ENGLISH_V3 = "embed-english-v3.0"
ENGLISH_LIGHT_V3 = "embed-english-light-v3.0"
MULTILINGUAL_V3 = "embed-multilingual-v3.0"
MULTILINGUAL_LIGHT_V3 = "embed-multilingual-light-v3.0"
ENGLISH_V2 = "embed-english-v2.0"
ENGLISH_LIGHT_V2 = "embed-english-light-v2.0"
MULTILIN... | CohereAIModelName |
python | jmcnamara__XlsxWriter | xlsxwriter/test/worksheet/test_write_worksheet.py | {
"start": 301,
"end": 924
} | class ____(unittest.TestCase):
"""
Test the Worksheet _write_worksheet() method.
"""
def setUp(self):
self.fh = StringIO()
self.worksheet = Worksheet()
self.worksheet._set_filehandle(self.fh)
def test_write_worksheet(self):
"""Test the _write_worksheet() method"""
... | TestWriteWorksheet |
python | ray-project__ray | ci/ray_ci/docker_container.py | {
"start": 1341,
"end": 6836
} | class ____(LinuxContainer):
"""
Container for building and publishing ray docker images
"""
def __init__(
self,
python_version: str,
platform: str,
image_type: str,
architecture: str = DEFAULT_ARCHITECTURE,
canonical_tag: str = None,
upload: bool ... | DockerContainer |
python | bokeh__bokeh | src/bokeh/util/hex.py | {
"start": 1693,
"end": 9279
} | class ____:
q: npt.NDArray[np.integer]
r: npt.NDArray[np.integer]
counts: npt.NDArray[np.integer]
def __getitem__(self, key: Literal["q", "r", "counts"]) -> npt.NDArray[np.integer]:
if key not in ("q", "r", "counts"):
raise KeyError(f"Invalid key {key!r}, must be one of 'q', 'r', or... | HexBinResult |
python | getsentry__sentry | tests/sentry/uptime/test_grouptype.py | {
"start": 4496,
"end": 5088
} | class ____(UptimeTestCase):
def test_build_event_data(self) -> None:
result = self.create_uptime_result()
detector = self.create_uptime_detector()
assert build_event_data(result, detector) == {
"environment": "development",
"platform": "other",
"project_i... | BuildEventDataTest |
python | altair-viz__altair | altair/vegalite/v6/schema/core.py | {
"start": 1297791,
"end": 1299175
} | class ____(VegaLiteSchema):
"""
StringValueDefWithCondition schema wrapper.
Parameters
----------
condition : dict, :class:`ConditionalMarkPropFieldOrDatumDef`, :class:`ConditionalValueDefstringnullExprRef`, :class:`ConditionalParameterMarkPropFieldOrDatumDef`, :class:`ConditionalPredicateMarkPropF... | StringValueDefWithCondition |
python | rapidsai__cudf | python/dask_cudf/dask_cudf/_expr/groupby.py | {
"start": 15333,
"end": 16401
} | class ____(DXGroupBy):
def __init__(self, *args, observed=None, **kwargs):
observed = observed if observed is not None else True
super().__init__(*args, observed=observed, **kwargs)
def __getitem__(self, key):
if is_scalar(key):
return SeriesGroupBy(
self.obj... | GroupBy |
python | airbytehq__airbyte | airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/build_image/steps/python_connectors.py | {
"start": 539,
"end": 5500
} | class ____(BuildConnectorImagesBase):
"""
A step to build a Python connector image.
A spec command is run on the container to validate it was built successfully.
"""
context: ConnectorContext
PATH_TO_INTEGRATION_CODE = "/airbyte/integration_code"
async def _build_connector(self, platform: ... | BuildConnectorImages |
python | apache__airflow | providers/google/src/airflow/providers/google/cloud/operators/vertex_ai/batch_prediction_job.py | {
"start": 24961,
"end": 28770
} | class ____(GoogleCloudBaseOperator):
"""
Lists BatchPredictionJobs in a Location.
:param project_id: Required. The ID of the Google Cloud project that the service belongs to.
:param region: Required. The ID of the Google Cloud region that the service belongs to.
:param filter: The standard list fil... | ListBatchPredictionJobsOperator |
python | redis__redis-py | redis/multidb/circuit.py | {
"start": 133,
"end": 222
} | class ____(Enum):
CLOSED = "closed"
OPEN = "open"
HALF_OPEN = "half-open"
| State |
python | django-haystack__django-haystack | test_haystack/whoosh_tests/test_whoosh_backend.py | {
"start": 1490,
"end": 1840
} | class ____(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True)
name = indexes.CharField(model_attr="author")
pub_date = indexes.DateTimeField(model_attr="pub_date")
def get_model(self):
return AnotherMockModel
def prepare_text(self, obj):
return obj.aut... | WhooshAnotherMockSearchIndex |
python | doocs__leetcode | lcof/面试题10- I. 斐波那契数列/Solution.py | {
"start": 0,
"end": 157
} | class ____:
def fib(self, n: int) -> int:
a, b = 0, 1
for _ in range(n):
a, b = b, (a + b) % 1000000007
return a
| Solution |
python | huggingface__transformers | src/transformers/models/markuplm/configuration_markuplm.py | {
"start": 788,
"end": 7235
} | class ____(PreTrainedConfig):
r"""
This is the configuration class to store the configuration of a [`MarkupLMModel`]. It is used to instantiate a
MarkupLM model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a similar con... | MarkupLMConfig |
python | chroma-core__chroma | chromadb/server/__init__.py | {
"start": 76,
"end": 172
} | class ____(ABC):
@abstractmethod
def __init__(self, settings: Settings):
pass
| Server |
python | pypa__warehouse | warehouse/organizations/models.py | {
"start": 24435,
"end": 24646
} | class ____(enum.StrEnum):
Submitted = "submitted"
Declined = "declined"
Deferred = "deferred"
MoreInformationNeeded = "moreinformationneeded"
Approved = "approved"
| OrganizationApplicationStatus |
python | gabrielfalcao__HTTPretty | httpretty/core.py | {
"start": 11632,
"end": 11895
} | class ____(object):
"""Represents an empty :py:class:`~httpretty.core.HTTPrettyRequest`
where all its properties are somehow empty or ``None``
"""
method = None
url = None
body = ''
headers = EmptyRequestHeaders()
| HTTPrettyRequestEmpty |
python | pypa__pip | src/pip/_vendor/cachecontrol/heuristics.py | {
"start": 667,
"end": 1850
} | class ____:
def warning(self, response: HTTPResponse) -> str | None:
"""
Return a valid 1xx warning header value describing the cache
adjustments.
The response is provided too allow warnings like 113
http://tools.ietf.org/html/rfc7234#section-5.5.4 where we need
to e... | BaseHeuristic |
python | ray-project__ray | release/ray_release/configs/global_config.py | {
"start": 60,
"end": 4217
} | class ____(TypedDict):
byod_ray_ecr: str
byod_ray_cr_repo: str
byod_ray_ml_cr_repo: str
byod_ray_llm_cr_repo: str
byod_ecr: str
byod_ecr_region: str
byod_aws_cr: str
byod_gcp_cr: str
byod_azure_cr: str
state_machine_pr_aws_bucket: str
state_machine_branch_aws_bucket: str
... | GlobalConfig |
python | lepture__authlib | authlib/oauth2/rfc7523/auth.py | {
"start": 2167,
"end": 3445
} | class ____(ClientSecretJWT):
"""Authentication method for OAuth 2.0 Client. This authentication
method is called ``private_key_jwt``, which is using ``client_id``
and ``private_key`` constructed with JWT to identify a client.
Here is an example of use ``private_key_jwt`` with Requests Session::
... | PrivateKeyJWT |
python | streamlit__streamlit | lib/tests/streamlit/elements/camera_input_test.py | {
"start": 1216,
"end": 4032
} | class ____(DeltaGeneratorTestCase):
def test_just_label(self):
"""Test that it can be called with no other values."""
st.camera_input("the label")
c = self.get_delta_from_queue().new_element.camera_input
assert c.label == "the label"
assert (
c.label_visibility.v... | CameraInputTest |
python | scrapy__scrapy | tests/test_signals.py | {
"start": 303,
"end": 625
} | class ____(Spider):
name = "itemspider"
async def start(self):
for index in range(10):
yield Request(
self.mockserver.url(f"/status?n=200&id={index}"), meta={"index": index}
)
def parse(self, response):
return {"index": response.meta["index"]}
| ItemSpider |
python | cython__cython | Tools/dataclass_test_data/test_dataclasses.py | {
"start": 112786,
"end": 119217
} | class ____(unittest.TestCase):
def test_simple(self):
C = make_dataclass('C',
[('x', int),
('y', int, field(default=5))],
namespace={'add_one': lambda self: self.x + 1})
c = C(10)
self.assertEqual((c.x, c.y), (... | TestMakeDataclass |
python | sqlalchemy__sqlalchemy | test/engine/test_logging.py | {
"start": 33994,
"end": 37048
} | class ____(fixtures.TestBase):
def setup_test(self):
self.buf = logging.handlers.BufferingHandler(100)
for log in [
logging.getLogger("sqlalchemy.engine"),
]:
log.addHandler(self.buf)
def teardown_test(self):
for log in [
logging.getLogger("sq... | LoggingTokenTest |
python | hynek__structlog | tests/test_output.py | {
"start": 8669,
"end": 9327
} | class ____:
def test_does_not_cache(self):
"""
Due to doctest weirdness, we must not reuse BytesLoggers.
"""
f = BytesLoggerFactory()
assert f() is not f()
def test_passes_file(self):
"""
If a file is passed to the factory, it get passed on to the logger... | TestBytesLoggerFactory |
python | huggingface__transformers | src/transformers/models/audioflamingo3/modular_audioflamingo3.py | {
"start": 1473,
"end": 1675
} | class ____(Qwen2AudioPreTrainedModel):
pass
@auto_docstring(
custom_intro="""
The audio model from AudioFlamingo3 without any head or projection on top.
"""
)
| AudioFlamingo3PreTrainedModel |
python | getsentry__sentry | src/sentry/workflow_engine/models/action.py | {
"start": 1121,
"end": 1413
} | class ____(BaseManager["Action"]):
def get_queryset(self) -> BaseQuerySet[Action]:
return (
super()
.get_queryset()
.exclude(status__in=(ObjectStatus.PENDING_DELETION, ObjectStatus.DELETION_IN_PROGRESS))
)
@region_silo_model
| ActionManager |
python | RaRe-Technologies__gensim | gensim/models/word2vec.py | {
"start": 8790,
"end": 94392
} | class ____(utils.SaveLoad):
def __init__(
self, sentences=None, corpus_file=None, vector_size=100, alpha=0.025, window=5, min_count=5,
max_vocab_size=None, sample=1e-3, seed=1, workers=3, min_alpha=0.0001,
sg=0, hs=0, negative=5, ns_exponent=0.75, cbow_mean=1, hashfxn=hash, epoch... | Word2Vec |
python | tensorflow__tensorflow | tensorflow/python/distribute/multi_worker_test_base.py | {
"start": 25619,
"end": 29727
} | class ____(test.TestCase):
"""Testing infra for independent workers using multiple processes."""
def _run_task_in_process(self, cmd_args, cluster_spec, task_type, task_id):
env = os.environ.copy()
env['TF_CONFIG'] = json.dumps({
'cluster': cluster_spec,
'task': {
'type': task_ty... | MultiWorkerMultiProcessTest |
python | walkccc__LeetCode | solutions/1746. Maximum Subarray Sum After One Operation/1746.py | {
"start": 0,
"end": 295
} | class ____:
def maxSumAfterOperation(self, nums: list[int]) -> int:
ans = -math.inf
regular = 0
squared = 0
for num in nums:
squared = max(num**2, regular + num**2, squared + num)
regular = max(num, regular + num)
ans = max(ans, squared)
return ans
| Solution |
python | wandb__wandb | wandb/automations/_generated/get_automations_by_entity.py | {
"start": 478,
"end": 648
} | class ____(GQLResult):
page_info: PageInfoFields = Field(alias="pageInfo")
edges: List[GetAutomationsByEntityScopeProjectsEdges]
| GetAutomationsByEntityScopeProjects |
python | wandb__wandb | wandb/filesync/upload_job.py | {
"start": 349,
"end": 5530
} | class ____:
def __init__(
self,
stats: "stats.Stats",
api: "internal_api.Api",
file_stream: "file_stream.FileStreamApi",
silent: bool,
save_name: LogicalPath,
path: "dir_watcher.PathStr",
artifact_id: Optional[str],
md5: Optional[str],
... | UploadJob |
python | huggingface__transformers | src/transformers/models/edgetam_video/modeling_edgetam_video.py | {
"start": 13972,
"end": 19847
} | class ____(nn.Module):
"""Self-attention with rotary position encoding."""
def __init__(self, config: EdgeTamVideoConfig):
super().__init__()
self.config = config
self.hidden_size = config.memory_attention_hidden_size
self.internal_dim = self.hidden_size // config.memory_attenti... | EdgeTamVideoRoPESelfAttention |
python | huggingface__transformers | tests/extended/test_trainer_ext.py | {
"start": 1477,
"end": 12888
} | class ____(TestCasePlus):
def run_seq2seq_quick(
self,
distributed=False,
extra_args_str=None,
predict_with_generate=True,
do_train=True,
do_eval=True,
do_predict=True,
n_gpus_to_use=None,
):
output_dir = self.run_trainer(
eval_... | TestTrainerExt |
python | cython__cython | Cython/Compiler/Nodes.py | {
"start": 23859,
"end": 36691
} | class ____(CDeclaratorNode):
# base CDeclaratorNode
# args [CArgDeclNode]
# templates [TemplatePlaceholderType]
# has_varargs boolean
# exception_value ConstNode or NameNode NameNode when the name of a c++ exception... | CFuncDeclaratorNode |
python | charliermarsh__ruff | crates/ruff_linter/resources/test/fixtures/ruff/RUF012.py | {
"start": 47,
"end": 488
} | class ____:
__slots__ = {
"mutable_default": "A mutable default value",
}
mutable_default: list[int] = []
immutable_annotation: Sequence[int] = []
without_annotation = []
class_variable: ClassVar[list[int]] = []
final_variable: Final[list[int]] = []
class_variable_without_subscr... | A |
python | Lightning-AI__lightning | examples/pytorch/servable_module/production.py | {
"start": 2697,
"end": 2832
} | class ____:
def serialize(self, tensor: torch.Tensor) -> int:
return torch.nn.functional.softmax(tensor).argmax().item()
| Top1 |
python | getsentry__sentry | tests/sentry/utils/sdk_crashes/test_sdk_crash_detection.py | {
"start": 2493,
"end": 5374
} | class ____(BaseSDKCrashDetectionMixin, SnubaTestCase):
def test_performance_event_not_detected(self, mock_sdk_crash_reporter: MagicMock) -> None:
fingerprint = "some_group"
fingerprint = f"{PerformanceNPlusOneGroupType.type_id}-{fingerprint}"
event = store_transaction(
test_case=... | PerformanceEventTestMixin |
python | redis__redis-py | redis/asyncio/connection.py | {
"start": 36884,
"end": 38936
} | class ____(TypedDict, total=False):
username: str
password: str
connection_class: Type[AbstractConnection]
host: str
port: int
db: int
path: str
def parse_url(url: str) -> ConnectKwargs:
parsed: ParseResult = urlparse(url)
kwargs: ConnectKwargs = {}
for name, value_list in par... | ConnectKwargs |
python | PyCQA__pylint | pylint/pyreverse/diadefslib.py | {
"start": 9396,
"end": 10295
} | class ____(DiaDefGenerator):
"""Generate a class diagram definition including all classes related to a
given class.
"""
def class_diagram(self, project: Project, klass: nodes.ClassDef) -> ClassDiagram:
"""Return a class diagram definition for the class and related classes."""
self.class... | ClassDiadefGenerator |
python | numba__numba | numba/cuda/cudadrv/nvrtc.py | {
"start": 1485,
"end": 9693
} | class ____:
"""
Provides a Pythonic interface to the NVRTC APIs, abstracting away the C API
calls.
The sole instance of this class is a process-wide singleton, similar to the
NVVM interface. Initialization is protected by a lock and uses the standard
(for Numba) open_cudalib function to load th... | NVRTC |
python | Netflix__metaflow | test/unit/inheritance/test_inheritance.py | {
"start": 6302,
"end": 8705
} | class ____:
"""Test comprehensive diamond inheritance pattern"""
def test_flow_completes(self, comprehensive_diamond_run):
"""Test that diamond inheritance flow completes"""
assert comprehensive_diamond_run.successful
assert comprehensive_diamond_run.finished
def test_parameters_fr... | TestComprehensiveDiamond |
python | joke2k__faker | tests/providers/test_job.py | {
"start": 4407,
"end": 4555
} | class ____:
"""Test Ro_RO job provider"""
def test_job(self, faker, num_samples):
assert faker.job() in RoRoJobProvider.jobs
| TestRoRo |
python | ray-project__ray | python/ray/autoscaler/_private/fake_multi_node/command_runner.py | {
"start": 193,
"end": 3222
} | class ____(CommandRunnerInterface):
"""Command runner for the fke docker multinode cluster.
This command runner uses ``docker exec`` and ``docker cp`` to
run commands and copy files, respectively.
The regular ``DockerCommandRunner`` is made for use in SSH settings
where Docker runs on a remote hos... | FakeDockerCommandRunner |
python | dask__dask | dask/dataframe/dask_expr/_expr.py | {
"start": 91372,
"end": 91450
} | class ____(BinOpSeries):
operation = M.ne
_operator_repr = "!="
| NESeries |
python | pytorch__pytorch | test/dynamo/test_error_messages.py | {
"start": 69121,
"end": 78789
} | class ____(
LoggingTestCase, torch._dynamo.test_case.TestCaseWithNestedGraphBreaks
):
@make_logging_test(graph_breaks=True)
def test_skipped_frame_with_verbose_traceback_nested(self, records):
global f1, f2, f3
class GenericCtxMgr:
def __enter__(self):
return sel... | NestedGraphBreakLoggingTests |
python | django__django | tests/model_forms/tests.py | {
"start": 121236,
"end": 121345
} | class ____(forms.ModelForm):
class Meta:
model = StumpJoke
fields = "__all__"
| StumpJokeForm |
python | PrefectHQ__prefect | src/prefect/server/schemas/filters.py | {
"start": 1558,
"end": 2354
} | class ____(PrefectBaseModel):
"""Base model for Prefect filters"""
model_config: ClassVar[ConfigDict] = ConfigDict(extra="forbid")
@db_injector
def as_sql_filter(self, db: "PrefectDBInterface") -> sa.ColumnElement[bool]:
"""Generate SQL filter from provided filter parameters. If no filters par... | PrefectFilterBaseModel |
python | pytorch__pytorch | benchmarks/operator_benchmark/pt/bmm_test.py | {
"start": 2348,
"end": 4244
} | class ____(op_bench.TorchBenchmarkBase):
def init(self, B, M, N, K, device, dtype, op_func):
self.inputs = {
"input_": torch.rand(
(B, M, K), device=device, dtype=dtype, requires_grad=self.auto_set()
),
"batch1": torch.rand(
(B, M, N), devi... | BatchedTernaryOpBenchmark |
python | getsentry__sentry | tests/sentry/utils/test_services.py | {
"start": 346,
"end": 477
} | class ____(Service, ABC):
@abstractmethod
def apply(self, x: int, y: int) -> int:
raise NotImplementedError
| Operation |
python | django__django | tests/model_forms/models.py | {
"start": 3070,
"end": 3255
} | class ____(models.Model):
publication = models.OneToOneField(
Publication, models.SET_NULL, null=True, blank=True
)
full_name = models.CharField(max_length=255)
| Author |
python | tornadoweb__tornado | tornado/test/web_test.py | {
"start": 122372,
"end": 123702
} | class ____(WebTestCase):
"""Test evaluation of Accept-Language header"""
def get_handlers(self):
locale.load_gettext_translations(
os.path.join(os.path.dirname(__file__), "gettext_translations"),
"tornado_test",
)
class AcceptLanguageHandler(RequestHandler):
... | AcceptLanguageTest |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.