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 | django__django | tests/auth_tests/test_views.py | {
"start": 41054,
"end": 41752
} | class ____(AuthViewsTestCase):
"""Tests for the redirect_to_login view"""
@override_settings(LOGIN_URL=reverse_lazy("login"))
def test_redirect_to_login_with_lazy(self):
login_redirect_response = redirect_to_login(next="/else/where/")
expected = "/login/?next=/else/where/"
self.asse... | RedirectToLoginTests |
python | astropy__astropy | astropy/modeling/optimizers.py | {
"start": 595,
"end": 2195
} | class ____(ABC):
"""
Base class for optimizers.
Parameters
----------
opt_method : callable
Implements optimization method
Notes
-----
The base Optimizer does not support any constraints by default; individual
optimizers should explicitly set this list to the specific const... | Optimization |
python | django__django | tests/auth_tests/test_forms.py | {
"start": 2862,
"end": 12606
} | class ____(TestDataMixin, TestCase):
form_class = BaseUserCreationForm
def test_form_fields(self):
form = self.form_class()
self.assertEqual(
list(form.fields.keys()), ["username", "password1", "password2"]
)
def test_user_already_exists(self):
data = {
... | BaseUserCreationFormTest |
python | astropy__astropy | astropy/time/tests/test_guess.py | {
"start": 112,
"end": 1075
} | class ____:
"""Test guessing the input value format"""
def test_guess1(self):
times = ["1999-01-01 00:00:00.123456789", "2010-01-01 00:00:00"]
t = Time(times, scale="utc")
assert (
repr(t) == "<Time object: scale='utc' format='iso' "
"value=['1999-01-01 00:00:00.... | TestGuess |
python | ipython__ipython | tests/test_pretty.py | {
"start": 1422,
"end": 1506
} | class ____(object):
def __repr__(self):
return "Breaking(\n)"
| BreakingRepr |
python | doocs__leetcode | solution/0800-0899/0816.Ambiguous Coordinates/Solution.py | {
"start": 0,
"end": 537
} | class ____:
def ambiguousCoordinates(self, s: str) -> List[str]:
def f(i, j):
res = []
for k in range(1, j - i + 1):
l, r = s[i : i + k], s[i + k : j]
ok = (l == '0' or not l.startswith('0')) and not r.endswith('0')
if ok:
... | Solution |
python | viewflow__viewflow | tests/components/test_base_page_components.py | {
"start": 374,
"end": 3940
} | class ____(LiveTestCase):
fixtures = ["users.json"]
def setUp(self):
self.client.login(username="admin", password="admin")
cookie = self.client.cookies["sessionid"]
self.browser.get(self.live_server_url)
self.browser.add_cookie(
{"name": "sessionid", "value": cookie.... | Test |
python | astropy__astropy | astropy/coordinates/tests/test_sky_coord_velocities.py | {
"start": 8074,
"end": 9229
} | class ____:
"""Test that going in between spherical and unit-spherical, we do not
change differential type (since both can handle the same types).
"""
def test_sc_unit_spherical_with_pm_or_rv_only(self, diff_info, diff_cls):
sc = SkyCoord(ra=[10, 20] * u.deg, dec=[-10, 10] * u.deg, **diff_info)... | TestDifferentialClassPropagation |
python | facebook__pyre-check | stubs/integration_test/fixture_source/integration_test/constructor_tito.py | {
"start": 246,
"end": 310
} | class ____:
def __init__(self, arg): ...
| ParentWithConstructor |
python | anthropics__anthropic-sdk-python | src/anthropic/types/citation_search_result_location_param.py | {
"start": 261,
"end": 588
} | class ____(TypedDict, total=False):
cited_text: Required[str]
end_block_index: Required[int]
search_result_index: Required[int]
source: Required[str]
start_block_index: Required[int]
title: Required[Optional[str]]
type: Required[Literal["search_result_location"]]
| CitationSearchResultLocationParam |
python | facebookresearch__faiss | tests/test_fast_scan_ivf.py | {
"start": 17184,
"end": 20752
} | class ____(unittest.TestCase):
""" test reconstruct and sa_encode / sa_decode
(also for a few additive quantizer variants) """
def do_test(self, by_residual=False):
d = 32
metric = faiss.METRIC_L2
ds = datasets.SyntheticDataset(d, 250, 200, 10)
index = faiss.IndexIVFPQFast... | TestReconstruct |
python | crytic__slither | slither/solc_parsing/declarations/contract.py | {
"start": 1681,
"end": 37188
} | class ____(CallerContextExpression):
def __init__(
self, slither_parser: "SlitherCompilationUnitSolc", contract: Contract, data: Dict[str, Any]
) -> None:
# assert slitherSolc.solc_version.startswith('0.4')
self._contract = contract
self._slither_parser = slither_parser
... | ContractSolc |
python | pypa__warehouse | tests/unit/manage/test_views.py | {
"start": 102475,
"end": 155162
} | class ____:
@pytest.mark.parametrize("enabled", [False, True])
def test_manage_project_settings(self, enabled, monkeypatch):
request = pretend.stub(organization_access=enabled)
project = pretend.stub(organization=None, lifecycle_status=None)
view = views.ManageProjectSettingsViews(projec... | TestManageProjectSettings |
python | getsentry__sentry | src/sentry/hybridcloud/rpc/caching/impl.py | {
"start": 2164,
"end": 2519
} | class ____:
"""
'Exposes' the underlying caching and its versioning system so that tests can fully validate the
concurrent consistency of the implementation. Not intended as a public interface.
"""
get_cache = staticmethod(_get_cache)
delete_cache = staticmethod(_delete_cache)
set_cache = ... | CacheBackend |
python | pallets__werkzeug | examples/plnt/database.py | {
"start": 1310,
"end": 1623
} | class ____:
query = session.query_property()
def __init__(self, name, url, feed_url, description=""):
self.name = name
self.url = url
self.feed_url = feed_url
self.description = description
def __repr__(self):
return f"<{type(self).__name__} {self.url!r}>"
| Blog |
python | apache__airflow | airflow-core/src/airflow/api_fastapi/core_api/datamodels/dag_run.py | {
"start": 3194,
"end": 5291
} | class ____(StrictBaseModel):
"""Trigger DAG Run Serializer for POST body."""
dag_run_id: str | None = None
data_interval_start: AwareDatetime | None = None
data_interval_end: AwareDatetime | None = None
logical_date: AwareDatetime | None
run_after: datetime | None = Field(default_factory=timezo... | TriggerDAGRunPostBody |
python | pytorch__pytorch | torch/ao/quantization/observer.py | {
"start": 63096,
"end": 63521
} | class ____(Enum):
"""Enum that indicate whether zero_point is in integer domain or floating point domain
integer domain: quantized_val = (float_val / scale) (integer) + zero_point (integer)
float domain: quantized_val = (float_val - (zero_point (float) - scale * mid_point)) / scale
none domain: quantiz... | ZeroPointDomain |
python | run-llama__llama_index | llama-index-integrations/readers/llama-index-readers-gitbook/llama_index/readers/gitbook/base.py | {
"start": 273,
"end": 3727
} | class ____(BaseReader):
"""
Simple gitbook reader.
Convert each gitbook page into Document used by LlamaIndex.
Args:
api_token (str): Gitbook API Token.
api_url (str): Gitbook API Endpoint.
"""
def __init__(self, api_token: str, api_url: str = None) -> None:
"""Initia... | SimpleGitbookReader |
python | explosion__spaCy | spacy/lang/pt/__init__.py | {
"start": 282,
"end": 539
} | class ____(BaseDefaults):
tokenizer_exceptions = TOKENIZER_EXCEPTIONS
infixes = TOKENIZER_INFIXES
prefixes = TOKENIZER_PREFIXES
lex_attr_getters = LEX_ATTRS
syntax_iterators = SYNTAX_ITERATORS
stop_words = STOP_WORDS
| PortugueseDefaults |
python | ansible__ansible | lib/ansible/utils/version.py | {
"start": 1987,
"end": 3107
} | class ____:
"""Class to easily allow comparing numbers
Largely this exists to make comparing an integer and a string on py3
so that it works like py2.
"""
def __init__(self, specifier):
self.specifier = int(specifier)
def __repr__(self):
return repr(self.specifier)
def __e... | _Numeric |
python | imageio__imageio | imageio/plugins/_bsdf.py | {
"start": 31907,
"end": 32753
} | class ____(Extension):
name = "ndarray"
def __init__(self):
if "numpy" in sys.modules:
import numpy as np
self.cls = np.ndarray
def match(self, s, v): # pragma: no cover - e.g. work for nd arrays in JS
return hasattr(v, "shape") and hasattr(v, "dtype") and hasattr... | NDArrayExtension |
python | openai__openai-python | src/openai/resources/responses/input_items.py | {
"start": 8531,
"end": 8774
} | class ____:
def __init__(self, input_items: AsyncInputItems) -> None:
self._input_items = input_items
self.list = async_to_streamed_response_wrapper(
input_items.list,
)
| AsyncInputItemsWithStreamingResponse |
python | huggingface__transformers | src/transformers/models/oneformer/image_processing_oneformer_fast.py | {
"start": 10282,
"end": 40076
} | class ____(BaseImageProcessorFast):
resample = PILImageResampling.BILINEAR
image_mean = IMAGENET_DEFAULT_MEAN
image_std = IMAGENET_DEFAULT_STD
size = {"shortest_edge": 800, "longest_edge": 1333}
crop_size = None
do_resize = True
do_rescale = True
do_normalize = True
default_to_square... | OneFormerImageProcessorFast |
python | RaRe-Technologies__gensim | gensim/corpora/textcorpus.py | {
"start": 15917,
"end": 23920
} | class ____(TextCorpus):
"""Read documents recursively from a directory.
Each file/line (depends on `lines_are_documents`) is interpreted as a plain text document.
"""
def __init__(self, input, dictionary=None, metadata=False, min_depth=0, max_depth=None,
pattern=None, exclude_pattern=... | TextDirectoryCorpus |
python | gevent__gevent | src/greentest/3.10/test_smtpd.py | {
"start": 37185,
"end": 41262
} | class ____(unittest.TestCase):
def setUp(self):
smtpd.socket = asyncore.socket = mock_socket
self.old_debugstream = smtpd.DEBUGSTREAM
self.debug = smtpd.DEBUGSTREAM = io.StringIO()
self.server = DummyServer((socket_helper.HOST, 0), ('b', 0),
enable_S... | SMTPDChannelTestWithEnableSMTPUTF8True |
python | python-openxml__python-docx | tests/oxml/unitdata/text.py | {
"start": 847,
"end": 948
} | class ____(BaseBuilder):
__tag__ = "w:rPr"
__nspfxs__ = ("w",)
__attrs__ = ()
| CT_RPrBuilder |
python | rapidsai__cudf | python/cudf/cudf/core/udf/masked_typing.py | {
"start": 10078,
"end": 10429
} | class ____(AbstractTemplate):
def generic(self, args, kws):
if len(args) == 1 and isinstance(args[0], MaskedType):
return_type = self.context.resolve_function_type(
self.key, (args[0].value_type,), kws
).return_type
return nb_signature(MaskedType(return_ty... | MaskedScalarUnaryOp |
python | h5py__h5py | setup_build.py | {
"start": 2169,
"end": 8022
} | class ____(build_ext):
"""
Custom setuptools command which encapsulates api_gen pre-building,
Cython building, and C compilation.
Also handles making the Extension modules, since we can't rely on
NumPy being present in the main body of the setup script.
"""
@classmethod
... | h5py_build_ext |
python | PyCQA__pylint | tests/functional/i/invalid/invalid_bool_returned.py | {
"start": 582,
"end": 713
} | class ____:
""" __bool__ returns an integer """
def __bool__(self): # [invalid-bool-returned]
return 1
| FirstBadBool |
python | weaviate__weaviate-python-client | weaviate/collections/grpc/query.py | {
"start": 1473,
"end": 1581
} | class ____:
force: float
concepts: List[str]
objects: List[uuid_lib.UUID]
A = TypeVar("A")
| _Move |
python | google__jax | tests/mosaic/matmul_test.py | {
"start": 1791,
"end": 6955
} | class ____(jtu.JaxTestCase):
def setUp(self):
super().setUp()
if matmul is None:
self.skipTest("Mosaic GPU not available.")
if not jtu.test_device_matches(["cuda"]):
self.skipTest("Test needs a GPU device")
self.context = mlir.make_ir_context()
mgpu_dialect.register_dialect(self.conte... | MatmulTestCase |
python | getsentry__sentry | src/sentry/shared_integrations/exceptions/__init__.py | {
"start": 2905,
"end": 3428
} | class ____(ApiError):
code = 503
@classmethod
def from_exception(cls, exception: Exception) -> ApiHostError:
maybe_request = getattr(exception, "request", None)
if maybe_request is not None:
return cls.from_request(maybe_request)
return cls("Unable to reach host")
@... | ApiHostError |
python | pytorch__pytorch | torch/distributed/pipelining/schedules.py | {
"start": 123568,
"end": 141596
} | class ____(_PipelineScheduleRuntime):
"""
The DualPipeV schedule. A more efficient schedule variant based on the
DualPipe schedule introduced by DeepSeek in https://arxiv.org/pdf/2412.19437
Based on the open sourced code from https://github.com/deepseek-ai/DualPipe
"""
def __init__(
se... | ScheduleDualPipeV |
python | huggingface__transformers | src/transformers/models/helium/configuration_helium.py | {
"start": 774,
"end": 8106
} | class ____(PreTrainedConfig):
r"""
This is the configuration class to store the configuration of a [`HeliumModel`]. It is used to instantiate an Helium
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar config... | HeliumConfig |
python | apache__airflow | providers/apache/tinkerpop/src/airflow/providers/apache/tinkerpop/hooks/gremlin.py | {
"start": 1161,
"end": 5637
} | class ____(BaseHook):
"""
Interact with Graph DB using the Gremlin Client.
This hook creates a connection to Graph DB and allows you to run Gremlin queries.`
:param gremlin_conn_id: Reference to the connection ID configured in Airflow.
"""
conn_name_attr = "gremlin__conn_id"
default_conn_... | GremlinHook |
python | plotly__plotly.py | plotly/graph_objs/layout/scene/zaxis/_title.py | {
"start": 235,
"end": 2861
} | class ____(_BaseLayoutHierarchyType):
_parent_path_str = "layout.scene.zaxis"
_path_str = "layout.scene.zaxis.title"
_valid_props = {"font", "text"}
@property
def font(self):
"""
Sets this axis' title font.
The 'font' property is an instance of Font
that may be spec... | Title |
python | tensorflow__tensorflow | tensorflow/python/compiler/tensorrt/model_tests/model_handler.py | {
"start": 21490,
"end": 25059
} | class ____(metaclass=abc.ABCMeta):
"""Manages a series of ModelHandlers for aggregated testing/benchmarking."""
def __init__(
self, name: str, model_config: ModelConfig,
default_trt_convert_params: trt.TrtConversionParams,
trt_convert_params_updater: Callable[[trt.TrtConversionParams],
... | _ModelHandlerManagerBase |
python | has2k1__plotnine | plotnine/iapi.py | {
"start": 3643,
"end": 3787
} | class ____:
"""
Information from the trained position scales in a panel
"""
x: scale_view
y: scale_view
@dataclass
| panel_view |
python | plotly__plotly.py | plotly/graph_objs/funnelarea/_hoverlabel.py | {
"start": 233,
"end": 11262
} | class ____(_BaseTraceHierarchyType):
_parent_path_str = "funnelarea"
_path_str = "funnelarea.hoverlabel"
_valid_props = {
"align",
"alignsrc",
"bgcolor",
"bgcolorsrc",
"bordercolor",
"bordercolorsrc",
"font",
"namelength",
"namelengthsr... | Hoverlabel |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/paramSpec38.py | {
"start": 184,
"end": 564
} | class ____(Generic[P, R]):
def __init__(self, callback: Callable[P, R]):
self.callback = callback
def method(self, *args: P.args, **kwargs: P.kwargs) -> R:
return self.callback(*args, **kwargs)
def func1(obj: object, **kwargs: object) -> object: ...
reveal_type(
ClassA(func1).method, ex... | ClassA |
python | apache__airflow | airflow-ctl/src/airflowctl/api/datamodels/generated.py | {
"start": 20034,
"end": 20301
} | class ____(BaseModel):
"""
Provider serializer for responses.
"""
package_name: Annotated[str, Field(title="Package Name")]
description: Annotated[str, Field(title="Description")]
version: Annotated[str, Field(title="Version")]
| ProviderResponse |
python | conda__conda | conda/cli/conda_argparse.py | {
"start": 7494,
"end": 8734
} | class ____(ArgumentParserBase):
def __init__(self, *args, add_help=True, **kwargs):
kwargs.setdefault("formatter_class", RawDescriptionHelpFormatter)
super().__init__(*args, add_help=False, **kwargs)
if add_help:
add_parser_help(self)
def _check_value(self, action, value):
... | ArgumentParser |
python | Netflix__metaflow | metaflow/runner/subprocess_manager.py | {
"start": 1915,
"end": 2011
} | class ____(Exception):
"""Exception raised when reading logs times out."""
| LogReadTimeoutError |
python | ray-project__ray | python/ray/tests/test_exceptions.py | {
"start": 254,
"end": 2098
} | class ____:
"""Tests for AuthenticationError exception."""
auth_doc_url = "https://docs.ray.io/en/latest/ray-security/auth.html"
def test_basic_creation(self):
"""Test basic AuthenticationError creation and message format."""
error = AuthenticationError("Token is missing")
error_st... | TestAuthenticationError |
python | charliermarsh__ruff | crates/ruff_linter/resources/test/fixtures/ruff/RUF066.py | {
"start": 27,
"end": 510
} | class ____: # Test normal class properties
@property
def name(self): # ERROR: No return
f"{self.first_name} {self.last_name}"
@property
def age(self): # OK: Returning something
return 100
def method(self): # OK: Not a property
x = 1
@property
def nested(self): ... | User |
python | apache__airflow | providers/google/tests/unit/google/cloud/operators/test_cloud_memorystore.py | {
"start": 11149,
"end": 12648
} | class ____:
@mock.patch("airflow.providers.google.cloud.operators.cloud_memorystore.CloudMemorystoreHook")
def test_assert_valid_hook_call(self, mock_hook):
mock_hook.return_value.update_instance.return_value.name = TEST_UPDATE_INSTANCE_NAME.format(
project_id=TEST_PROJECT_ID,
lo... | TestCloudMemorystoreUpdateInstanceOperator |
python | encode__django-rest-framework | rest_framework/fields.py | {
"start": 64651,
"end": 66288
} | class ____(Field):
default_error_messages = {
'invalid': _('Value must be valid JSON.')
}
# Workaround for isinstance calls when importing the field isn't possible
_is_jsonfield = True
def __init__(self, **kwargs):
self.binary = kwargs.pop('binary', False)
self.encoder = kw... | JSONField |
python | pytorch__pytorch | torch/testing/_internal/common_modules.py | {
"start": 8797,
"end": 210467
} | class ____:
""" Module information to be used in testing. """
def __init__(self,
module_cls, # Class object for the module under test
*,
module_inputs_func, # Function to generate module inputs
skips=(), # Indicates which tests to skip
... | ModuleInfo |
python | pyca__cryptography | src/cryptography/x509/base.py | {
"start": 4741,
"end": 8488
} | class ____:
def __init__(
self,
subject_name: Name | None = None,
extensions: list[Extension[ExtensionType]] = [],
attributes: list[tuple[ObjectIdentifier, bytes, int | None]] = [],
):
"""
Creates an empty X.509 certificate request (v1).
"""
self._... | CertificateSigningRequestBuilder |
python | tensorflow__tensorflow | tensorflow/python/profiler/pprof_profiler.py | {
"start": 1931,
"end": 3117
} | class ____(object):
"""Keeps track of strings to add to string_table in pprof proto."""
def __init__(self):
# Pprof requires first entry in string_table to be ''.
self._string_table = ['']
self._string_to_index = {'': 0}
def index_of(self, value_str):
"""Get index of value_str in the string tabl... | StringTable |
python | PrefectHQ__prefect | src/integrations/prefect-gcp/prefect_gcp/workers/cloud_run_v2.py | {
"start": 20608,
"end": 20719
} | class ____(BaseWorkerResult):
"""
The result of a Cloud Run worker V2 job.
"""
| CloudRunWorkerV2Result |
python | dagster-io__dagster | helm/dagster/schema/schema/charts/dagster/subschema/ingress.py | {
"start": 434,
"end": 564
} | class ____(BaseModel):
path: str
pathType: IngressPathType
serviceName: str
servicePort: Union[str, int]
| IngressPath |
python | google__pytype | pytype/tests/test_import1.py | {
"start": 282,
"end": 378
} | class ____:
"""Fake options."""
def __init__(self):
self.open_function = open
| FakeOptions |
python | run-llama__llama_index | llama-index-integrations/vector_stores/llama-index-vector-stores-typesense/llama_index/vector_stores/typesense/base.py | {
"start": 946,
"end": 9579
} | class ____(BasePydanticVectorStore):
"""
Typesense Vector Store.
In this vector store, embeddings and docs are stored within a
Typesense index.
During query time, the index uses Typesense to query for the top
k most similar nodes.
Args:
client (Any): Typesense client
token... | TypesenseVectorStore |
python | kamyu104__LeetCode-Solutions | Python/copy-list-with-random-pointer.py | {
"start": 150,
"end": 1106
} | class ____(object):
# @param head, a RandomListNode
# @return a RandomListNode
def copyRandomList(self, head):
# copy and combine copied list with original list
current = head
while current:
copied = Node(current.val)
copied.next = current.next
cur... | Solution |
python | wandb__wandb | wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/fsevents.py | {
"start": 1393,
"end": 5131
} | class ____(EventEmitter):
"""
Mac OS X FSEvents Emitter class.
:param event_queue:
The event queue to fill with events.
:param watch:
A watch object representing the directory to monitor.
:type watch:
:class:`watchdog.observers.api.ObservedWatch`
:param timeout:
... | FSEventsEmitter |
python | tox-dev__tox | src/tox/report.py | {
"start": 8347,
"end": 8447
} | class ____(RuntimeError):
"""Error that has been handled so no need for stack trace."""
| HandledError |
python | rq__rq | rq/cron.py | {
"start": 5461,
"end": 21740
} | class ____:
"""Simple interval-based job scheduler for RQ"""
def __init__(
self,
connection: Redis,
logging_level: Union[str, int] = logging.INFO,
name: str = '',
):
self.connection: Redis = connection
self._cron_jobs: List[CronJob] = []
self.hostname... | CronScheduler |
python | ray-project__ray | python/ray/tests/test_namespace.py | {
"start": 518,
"end": 3566
} | class ____:
def ping(self):
return "pong from other job"
actor = DetachedActor.options(name="Pinger", lifetime="detached").remote()
ray.get(actor.ping.remote())
"""
# Start a detached actor in a different namespace.
run_string_as_driver(driver_template.format(address, "different"))
@ray.r... | DetachedActor |
python | ApeWorX__ape | src/ape/api/networks.py | {
"start": 49493,
"end": 51933
} | class ____(NetworkAPI):
@property
def upstream_network(self) -> NetworkAPI:
"""
The network being forked.
"""
network_name = self.name.replace("-fork", "").replace("_fork", "")
return self.ecosystem.get_network(network_name)
@property
def upstream_provider(self) ... | ForkedNetworkAPI |
python | ray-project__ray | python/ray/serve/tests/unit/test_deployment_state.py | {
"start": 191095,
"end": 205833
} | class ____:
"""End-to-end integration tests for rank functionality through deployment state manager."""
def _set_replicas_ready(
self, ds: DeploymentState, replica_states: List[ReplicaState]
):
"""Helper to set replicas in given states to ready."""
for replica in ds._replicas.get(re... | TestDeploymentRankManagerIntegrationE2E |
python | pyinstaller__pyinstaller | bootloader/waflib/Tools/d.py | {
"start": 991,
"end": 1043
} | class ____(dprogram):
inst_to = '${LIBDIR}'
| dshlib |
python | spyder-ide__spyder | spyder/plugins/run/widgets.py | {
"start": 2070,
"end": 2232
} | class ____:
Close = 0
Save = 1
Run = 2
# ---- Base class
# -----------------------------------------------------------------------------
| RunDialogStatus |
python | run-llama__llama_index | llama-index-integrations/readers/llama-index-readers-github/tests/test_github_app_auth.py | {
"start": 15181,
"end": 16143
} | class ____:
"""Test GitHubIssuesClient with GitHub App authentication."""
def test_init_with_github_app(self):
"""Test initialization with GitHub App auth."""
app_auth = GitHubAppAuth(
app_id="123", private_key=TEST_PRIVATE_KEY, installation_id="456"
)
client = GitH... | TestIssuesClientWithAppAuth |
python | astropy__astropy | astropy/units/format/base.py | {
"start": 623,
"end": 7628
} | class ____:
"""
The abstract base class of all unit formats.
"""
registry: ClassVar[dict[str, type["Base"]]] = {}
_space: ClassVar[str] = " "
_scale_unit_separator: ClassVar[str] = " "
_times: ClassVar[str] = "*"
name: ClassVar[str] # Set by __init_subclass__ by the latest
def __n... | Base |
python | openai__openai-python | src/openai/types/beta/chatkit/chat_session_rate_limits.py | {
"start": 160,
"end": 293
} | class ____(BaseModel):
max_requests_per_1_minute: int
"""Maximum allowed requests per one-minute window."""
| ChatSessionRateLimits |
python | walkccc__LeetCode | solutions/3469. Find Minimum Cost to Remove Array Elements/3469.py | {
"start": 0,
"end": 508
} | class ____:
def minCost(self, nums: list[int]) -> int:
n = len(nums)
@functools.lru_cache(None)
def dp(last: int, i: int) -> int:
if i == n: # Single element left.
return nums[last]
if i == n - 1: # Two elements left.
return max(nums[last], nums[i])
a = max(nums[i], nu... | Solution |
python | python__mypy | mypyc/ir/ops.py | {
"start": 17915,
"end": 18707
} | class ____(RegisterOp):
"""Decrease reference count and free object if zero (dec_ref src).
The is_xdec flag says to use an XDECREF, which checks if the
pointer is NULL first.
"""
error_kind = ERR_NEVER
def __init__(self, src: Value, is_xdec: bool = False, line: int = -1) -> None:
asse... | DecRef |
python | cython__cython | Cython/Compiler/Nodes.py | {
"start": 66191,
"end": 67746
} | class ____(StatNode):
# name string
# cname string or None
# kind "struct" or "union"
# typedef_flag boolean
# visibility "public" or "private"
# api boolean
# in_pxd boolean
# attributes [CVarDefNode] or None
# entry ... | CStructOrUnionDefNode |
python | prompt-toolkit__python-prompt-toolkit | src/prompt_toolkit/buffer.py | {
"start": 4694,
"end": 71298
} | class ____:
"""
The core data structure that holds the text and cursor position of the
current input line and implements all text manipulations on top of it. It
also implements the history, undo stack and the completion state.
:param completer: :class:`~prompt_toolkit.completion.Completer` instance... | Buffer |
python | tensorflow__tensorflow | tensorflow/compiler/tests/async_comp_test.py | {
"start": 1796,
"end": 3510
} | class ____(test.TestCase):
# Asynchrobnous compilation uses the existing fallback path and existing
# compiler. This test only tests that asynchronous compilation is performed.
def testAsyncCompilationJit(self):
@function.Defun(compiled=True)
def CompiledFunction(x):
return math_ops.log(x)
wi... | AsyncCompilationTest |
python | pypa__pip | src/pip/_internal/index/package_finder.py | {
"start": 3442,
"end": 3709
} | class ____(enum.Enum):
candidate = enum.auto()
different_project = enum.auto()
yanked = enum.auto()
format_unsupported = enum.auto()
format_invalid = enum.auto()
platform_mismatch = enum.auto()
requires_python_mismatch = enum.auto()
| LinkType |
python | numpy__numpy | numpy/distutils/command/sdist.py | {
"start": 223,
"end": 733
} | class ____(old_sdist):
def add_defaults (self):
old_sdist.add_defaults(self)
dist = self.distribution
if dist.has_data_files():
for data in dist.data_files:
self.filelist.extend(get_data_files(data))
if dist.has_headers():
headers = []
... | sdist |
python | pandas-dev__pandas | pandas/tests/frame/methods/test_to_timestamp.py | {
"start": 445,
"end": 5973
} | class ____:
def test_to_timestamp(self, frame_or_series):
K = 5
index = period_range(freq="Y", start="1/1/2001", end="12/1/2009")
obj = DataFrame(
np.random.default_rng(2).standard_normal((len(index), K)),
index=index,
columns=["A", "B", "C", "D", "E"],
... | TestToTimestamp |
python | mwaskom__seaborn | tests/test_miscplot.py | {
"start": 724,
"end": 914
} | class ____:
@_network(url="https://github.com/mwaskom/seaborn-data")
def test_dogplot(self):
misc.dogplot()
ax = plt.gca()
assert len(ax.images) == 1
| TestDogPlot |
python | pytorch__pytorch | torch/_inductor/codegen/wrapper.py | {
"start": 34551,
"end": 35555
} | class ____(WrapperLine):
wrapper: PythonWrapperCodegen
node: ir.ScatterFallback
def codegen(self, code: IndentedBuffer) -> None:
node = self.node
assert ir.is_node_sequence(node.inputs)
if node.src_is_tensor:
(x, index, src) = (t.codegen_reference() for t in node.inputs)... | ScatterFallbackLine |
python | huggingface__transformers | src/transformers/models/decision_transformer/modeling_decision_transformer.py | {
"start": 27437,
"end": 27887
} | class ____(PreTrainedModel):
"""
An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
models.
"""
config: DecisionTransformerConfig
base_model_prefix = "decision_transformer"
main_input_name = "states"
supports_gradient_checkpo... | DecisionTransformerPreTrainedModel |
python | django__django | django/http/multipartparser.py | {
"start": 22148,
"end": 27423
} | class ____:
"""
A Producer that is sensitive to boundaries.
Will happily yield bytes until a boundary is found. Will yield the bytes
before the boundary, throw away the boundary bytes themselves, and push the
post-boundary bytes back on the stream.
The future calls to next() after locating the... | BoundaryIter |
python | pytorch__pytorch | tools/experimental/torchfuzz/operators/argsort.py | {
"start": 189,
"end": 2642
} | class ____(Operator):
"""Operator for torch.argsort() operation."""
def __init__(self):
"""Initialize ArgsortOperator."""
super().__init__("argsort")
@property
def torch_op_name(self) -> str | None:
"""Return the torch operation name."""
return "torch.argsort"
def ... | ArgsortOperator |
python | ray-project__ray | rllib/algorithms/tests/test_algorithm_save_load_checkpoint_learner.py | {
"start": 3207,
"end": 4788
} | class ____(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
ray.init()
@classmethod
def tearDownClass(cls) -> None:
ray.shutdown()
def test_save_and_restore(self):
for algo_name in algorithms_and_configs:
config = algorithms_and_configs[algo_name]
... | TestAlgorithmWithLearnerSaveAndRestore |
python | spack__spack | var/spack/test_repos/spack_repo/builtin_mock/packages/conflict_parent/package.py | {
"start": 217,
"end": 879
} | class ____(Package):
homepage = "https://github.com/tgamblin/callpath"
url = "http://github.com/tgamblin/callpath-1.0.tar.gz"
version("0.8", md5="0123456789abcdef0123456789abcdef")
version("0.9", md5="0123456789abcdef0123456789abcdef")
version("1.0", md5="0123456789abcdef0123456789abcdef")
dep... | ConflictParent |
python | pyinstaller__pyinstaller | bootloader/waflib/Build.py | {
"start": 24842,
"end": 25061
} | class ____(BuildContext):
'''installs the targets on the system'''
cmd = 'install'
def __init__(self, **kw):
super(InstallContext, self).__init__(**kw)
self.is_install = INSTALL
| InstallContext |
python | jazzband__django-oauth-toolkit | tests/test_mixins.py | {
"start": 3937,
"end": 6957
} | class ____(BaseTest):
def test_options_shall_pass(self):
class TestView(ProtectedResourceMixin, View):
server_class = Server
validator_class = OAuth2Validator
request = self.request_factory.options("/fake-req")
view = TestView.as_view()
response = view(reques... | TestProtectedResourceMixin |
python | sqlalchemy__sqlalchemy | test/dialect/postgresql/test_reflection.py | {
"start": 91427,
"end": 95024
} | class ____(fixtures.TestBase):
class NTL:
def __init__(self, enums, domains):
self.enums = enums
self.domains = domains
class CustomType:
def __init__(self, arg1=None, arg2=None, collation=None):
self.arg1 = arg1
self.arg2 = arg2
self.... | CustomTypeReflectionTest |
python | pytorch__pytorch | test/dynamo/mock_modules/mock_module2.py | {
"start": 72,
"end": 295
} | class ____:
def __init__(self, x, y):
self.x = x
self.y = y
def method2(self, x):
return mock_module3.method1([], x)
def method1(x, y):
torch.ones(1, 1)
x.append(y)
return x
| Class1 |
python | PrefectHQ__prefect | src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py | {
"start": 48183,
"end": 48735
} | class ____(sgqlc.types.Input):
"""
See source code for more info.
"""
__schema__ = graphql_schema
__field_names__ = ("labelable_id", "label_ids", "client_mutation_id")
labelable_id = sgqlc.types.Field(
sgqlc.types.non_null(ID), graphql_name="labelableId"
)
label_ids = sgqlc.type... | AddLabelsToLabelableInput |
python | great-expectations__great_expectations | tests/metrics/test_metric.py | {
"start": 2960,
"end": 3553
} | class ____:
@pytest.mark.unit
def test_domain_kwarg_immutability_success(self):
column_values_above = ColumnValuesAbove(
column=COLUMN,
min_value=42,
)
with pytest.raises(TypeError):
column_values_above.column = "updated_column"
@pytest.mark.unit... | TestMetricImmutability |
python | PyCQA__pylint | pylint/reporters/ureports/nodes.py | {
"start": 3167,
"end": 3894
} | class ____(BaseLayout):
"""A section.
attributes :
* BaseLayout attributes
a title may also be given to the constructor, it'll be added
as a first element
a description may also be given to the constructor, it'll be added
as a first paragraph
"""
def __init__(
self,
... | Section |
python | tensorflow__tensorflow | tensorflow/python/kernel_tests/variables/resource_variable_ops_test.py | {
"start": 3307,
"end": 4012
} | class ____(extension_type.ExtensionType):
v: resource_variable_ops.ResourceVariable
__composite_gradient__ = CompositeVariableGradient()
def _eager_safe_var_handle_op(*args, **kwargs):
# When running in eager mode the `shared_name` should be set to the
# `anonymous_name` to avoid spurious sharing issues. The... | CompositeVariable |
python | google__pytype | pytype/pytd/optimize.py | {
"start": 2719,
"end": 3071
} | class ____(visitors.Visitor):
"""Remove duplicate or redundant entries in union types.
For example, this transforms
a: Union[int, int]
b: Union[int, Any]
c: Union[int, int, float]
to
a: int
b: Any
c: Union[int, float]
"""
def VisitUnionType(self, union):
return pytd_utils.JoinTyp... | SimplifyUnions |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/metaclass9.py | {
"start": 790,
"end": 860
} | class ____(metaclass=Meta1, param2="", param1=1, param4=3): ...
| Class1_5 |
python | run-llama__llama_index | llama-index-integrations/indices/llama-index-indices-managed-bge-m3/llama_index/indices/managed/bge_m3/base.py | {
"start": 522,
"end": 8039
} | class ____(BaseIndex[IndexDict]):
"""
Store for BGE-M3 with PLAID indexing.
BGE-M3 is a multilingual embedding model with multi-functionality:
Dense retrieval, Sparse retrieval and Multi-vector retrieval.
Parameters
----------
index_path: directory containing PLAID index files.
model_n... | BGEM3Index |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/typedDictClosed1.py | {
"start": 1358,
"end": 1519
} | class ____(TypedDict, closed=True, extra_items=str):
pass
# This should generate an error because "closed" and
# "extra_items" cannot both be specified.
| BadTD3 |
python | huggingface__transformers | tests/generation/test_utils.py | {
"start": 239269,
"end": 247278
} | class ____(unittest.TestCase):
def setUp(self):
checkpoint = "EleutherAI/pythia-160m-deduped"
self.assistant_model = AutoModelForCausalLM.from_pretrained(checkpoint)
self.assistant_model.generation_config.assistant_confidence_threshold = 0.4
self.model_kwargs = {}
self.input_... | TestAssistedCandidateGeneratorUpdateStrategy |
python | sympy__sympy | sympy/physics/quantum/state.py | {
"start": 14222,
"end": 16818
} | class ____(StateBase):
"""Base class for a general time-dependent quantum state.
This class is used as a base class for any time-dependent state. The main
difference between this class and the time-independent state is that this
class takes a second argument that is the time in addition to the usual
... | TimeDepState |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/integration/test_report_based_streams.py | {
"start": 5808,
"end": 20800
} | class ____:
@staticmethod
def _read(stream_name: str, config_: ConfigBuilder, expecting_exception: bool = False) -> EntrypointOutput:
return read_output(
config_builder=config_,
stream_name=stream_name,
sync_mode=SyncMode.full_refresh,
expecting_exception=... | TestFullRefresh |
python | getsentry__sentry | src/sentry/monitors/endpoints/project_processing_errors_details.py | {
"start": 920,
"end": 2018
} | class ____(ProjectEndpoint):
permission_classes: tuple[type[BasePermission], ...] = (ProjectAlertRulePermission,)
publish_status = {
"DELETE": ApiPublishStatus.PRIVATE,
}
owner = ApiOwner.CRONS
@extend_schema(
operation_id="Delete a processing error for a Monitor",
paramete... | ProjectProcessingErrorsDetailsEndpoint |
python | apache__airflow | providers/http/src/airflow/providers/http/triggers/http.py | {
"start": 2102,
"end": 6225
} | class ____(BaseTrigger):
"""
HttpTrigger run on the trigger worker.
:param http_conn_id: http connection id that has the base
API url i.e https://www.google.com/ and optional authentication credentials. Default
headers can also be specified in the Extra field in json format.
:param auth... | HttpTrigger |
python | getsentry__sentry | src/sentry/sentry_apps/api/serializers/sentry_app.py | {
"start": 1383,
"end": 2118
} | class ____(TypedDict):
allowedOrigins: list[str]
avatars: list[SentryAppAvatarSerializerResponse]
events: set[str]
featureData: list[str]
isAlertable: bool
metadata: str
name: str
schema: str
scopes: list[str]
slug: str
status: str
uuid: str
verifyInstall: bool
#... | SentryAppSerializerResponse |
python | pytorch__pytorch | test/quantization/core/test_quantized_op.py | {
"start": 6877,
"end": 156033
} | class ____(TestCase):
"""Helper function to test quantized activation functions."""
def _test_activation_function(self, X, fn_name, test_configs):
r"""
When writing a unit test for the activation function,
instead of specifying the test routines only applicable to the activation... | TestQuantizedOps |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.