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/check_framework/test_security.py
{ "start": 2547, "end": 4779 }
class ____(SimpleTestCase): @override_settings( SESSION_COOKIE_HTTPONLY=False, INSTALLED_APPS=["django.contrib.sessions"], MIDDLEWARE=[], ) def test_session_cookie_httponly_with_installed_app(self): """ Warn if SESSION_COOKIE_HTTPONLY is off and "django.contrib.sessio...
CheckSessionCookieHttpOnlyTest
python
ray-project__ray
python/ray/data/_internal/execution/backpressure_policy/backpressure_policy.py
{ "start": 391, "end": 2190 }
class ____(ABC): """Interface for back pressure policies.""" def __init__( self, data_context: DataContext, topology: "Topology", resource_manager: "ResourceManager", ): """Initialize the backpressure policy. Args: data_context: The data context....
BackpressurePolicy
python
pydantic__pydantic
pydantic/types.py
{ "start": 52004, "end": 54105 }
class ____(_SecretBase[SecretType]): _inner_schema: ClassVar[CoreSchema] _error_kind: ClassVar[str] @classmethod def __get_pydantic_core_schema__(cls, source: type[Any], handler: GetCoreSchemaHandler) -> core_schema.CoreSchema: def get_json_schema(_core_schema: core_schema.CoreSchema, handler: ...
_SecretField
python
pypa__pip
src/pip/_vendor/distlib/util.py
{ "start": 55297, "end": 55800 }
class ____(CSVBase): def __init__(self, fn, **kwargs): self.stream = _csv_open(fn, 'w') self.writer = csv.writer(self.stream, **self.defaults) def writerow(self, row): if sys.version_info[0] < 3: r = [] for item in row: if isinstance(item, text_t...
CSVWriter
python
pandas-dev__pandas
pandas/tests/test_errors.py
{ "start": 2090, "end": 4016 }
class ____: @classmethod def classmethod(cls): raise AbstractMethodError(cls, methodtype="classmethod") @property def property(self): raise AbstractMethodError(self, methodtype="property") def method(self): raise AbstractMethodError(self) def test_AbstractMethodError_clas...
Foo
python
getsentry__sentry
src/sentry/analytics/events/sentry_app_created.py
{ "start": 75, "end": 283 }
class ____(analytics.Event): user_id: int organization_id: int sentry_app: str created_alert_rule_ui_component: bool | None = None analytics.register(SentryAppCreatedEvent)
SentryAppCreatedEvent
python
pytorch__pytorch
torch/distributions/constraints.py
{ "start": 10599, "end": 10892 }
class ____(Constraint): """ Constrain to one-hot vectors. """ is_discrete = True event_dim = 1 def check(self, value): is_boolean = (value == 0) | (value == 1) is_normalized = value.sum(-1).eq(1) return is_boolean.all(-1) & is_normalized
_OneHot
python
ansible__ansible
test/lib/ansible_test/_util/controller/sanity/pylint/plugins/unwanted.py
{ "start": 407, "end": 1935 }
class ____: """Defines an unwanted import.""" def __init__( self, alternative, # type: str modules_only=False, # type: bool names=None, # type: t.Optional[t.Tuple[str, ...]] ignore_paths=None, # type: t.Optional[t.Tuple[str, ...]] ansib...
UnwantedEntry
python
facebook__pyre-check
client/commands/server_state.py
{ "start": 1467, "end": 1596 }
class ____: code: str is_dirty: bool = False pyre_code_updated: bool = False @dataclasses.dataclass
OpenedDocumentState
python
jazzband__django-oauth-toolkit
tests/test_oauth2_validators.py
{ "start": 17433, "end": 22298 }
class ____(TransactionTestCase): """These test cases check that the recommended error codes are returned when token authentication fails. RFC-6750: https://rfc-editor.org/rfc/rfc6750.html > If the protected resource request does not include authentication > credentials or does not contain an acces...
TestOAuth2ValidatorProvidesErrorData
python
mlflow__mlflow
mlflow/store/tracking/dbmodels/initial_models.py
{ "start": 1202, "end": 2529 }
class ____(Base): """ DB model for :py:class:`mlflow.entities.Experiment`. These are recorded in ``experiment`` table. """ __tablename__ = "experiments" experiment_id = Column(Integer, autoincrement=True) """ Experiment ID: `Integer`. *Primary Key* for ``experiment`` table. """ nam...
SqlExperiment
python
ray-project__ray
release/llm_tests/benchmark/configs.py
{ "start": 378, "end": 4700 }
class ____(BaseModel): provider: Optional[str] = Field( None, description="Which flavor of API to use. If not specified, we'll try to guess based on the URL and /v1/models output", ) model: Optional[str] = Field( None, description="The model to use for generating text. If no...
LoadTestConfig
python
openai__openai-python
src/openai/types/responses/response_code_interpreter_call_code_delta_event.py
{ "start": 218, "end": 840 }
class ____(BaseModel): delta: str """The partial code snippet being streamed by the code interpreter.""" item_id: str """The unique identifier of the code interpreter tool call item.""" output_index: int """ The index of the output item in the response for which the code is being strea...
ResponseCodeInterpreterCallCodeDeltaEvent
python
PyCQA__pylint
doc/data/messages/i/invalid-hash-returned/bad.py
{ "start": 0, "end": 120 }
class ____: """__hash__ returns dict""" def __hash__(self): # [invalid-hash-returned] return {}
CustomHash
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/solverHigherOrder13.py
{ "start": 167, "end": 482 }
class ____(Generic[*S, D]): ... def func1[*S1, D1, *S2, D2, Dim1]( c: Callable[[N[*S1, D1], N[*S2, D2]], Any], ) -> Callable[[N[Dim1, *S1, D1], N[Dim1, *S2, D2]], Any]: ... def func2[X, Y, Z](x: N[X, Y, Z], y: N[X, Y, Z]): func1(func3)(x, y) def func3[Dim1, T](x: N[Dim1, T], y: N[Dim1, T]) -> N[T]: ...
N
python
encode__starlette
starlette/routing.py
{ "start": 13792, "end": 18650 }
class ____(BaseRoute): def __init__( self, path: str, app: ASGIApp | None = None, routes: Sequence[BaseRoute] | None = None, name: str | None = None, *, middleware: Sequence[Middleware] | None = None, ) -> None: assert path == "" or path.startswith...
Mount
python
sqlalchemy__sqlalchemy
test/engine/test_pool.py
{ "start": 3034, "end": 10310 }
class ____(PoolTestBase): @testing.fails_on( "+pyodbc", "pyodbc cursor doesn't implement tuple __eq__" ) @testing.fails_on("+pg8000", "returns [1], not (1,)") def test_cursor_iterable(self): conn = testing.db.raw_connection() cursor = conn.cursor() cursor.execute(str(sele...
PoolTest
python
doocs__leetcode
solution/2700-2799/2737.Find the Closest Marked Node/Solution.py
{ "start": 0, "end": 676 }
class ____: def minimumDistance( self, n: int, edges: List[List[int]], s: int, marked: List[int] ) -> int: g = [[inf] * n for _ in range(n)] for u, v, w in edges: g[u][v] = min(g[u][v], w) dist = [inf] * n vis = [False] * n dist[s] = 0 for _ in...
Solution
python
ZoranPandovski__al-go-rithms
data_structures/Graphs/bellmanford-optimized/python/bellmanFordOptimized.py
{ "start": 13, "end": 242 }
class ____: #Custom class to keep together information stored on edges (the neighbour and the cost to get there) def __init__(self, neighbour = None, cost = None): self.neighbour = neighbour self.cost = cost
Node
python
qdrant__qdrant-client
qdrant_client/http/models/models.py
{ "start": 19510, "end": 19650 }
class ____(BaseModel): consensus_thread_status: Literal[ "stopped", ] = Field(..., description="")
ConsensusThreadStatusOneOf1
python
langchain-ai__langchain
libs/standard-tests/tests/unit_tests/test_in_memory_vectorstore.py
{ "start": 450, "end": 614 }
class ____(InMemoryVectorStore): """InMemoryVectorStore that does not implement get_by_ids.""" get_by_ids = VectorStore.get_by_ids
WithoutGetByIdsVectorStore
python
HypothesisWorks__hypothesis
hypothesis-python/tests/cover/test_health_checks.py
{ "start": 4008, "end": 4624 }
class ____: @given(st.none()) def test(self, _): pass def test_differing_executors_fails_health_check(): sample_test_runner().test() msg = re.escape(str(HealthCheck.differing_executors)) with pytest.raises(FailedHealthCheck, match=msg): sample_test_runner().test() def test_it_is_...
sample_test_runner
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 68224, "end": 68764 }
class ____(sgqlc.types.Enum): """The possible events to perform on a pull request review. Enumeration Choices: * `APPROVE`: Submit feedback and approve merging these changes. * `COMMENT`: Submit general feedback without explicit approval. * `DISMISS`: Dismiss review so it now longer effects mergin...
PullRequestReviewEvent
python
pypa__packaging
tests/test_tags.py
{ "start": 36345, "end": 43920 }
class ____: def test_iterator_returned(self) -> None: result_iterator = tags.cpython_tags( (3, 8), ["cp38d", "cp38"], ["plat1", "plat2"] ) assert isinstance(result_iterator, collections.abc.Iterator) def test_all_args(self) -> None: result_iterator = tags.cpython_tag...
TestCPythonTags
python
cython__cython
tests/run/ass2global.py
{ "start": 205, "end": 603 }
class ____(object): """ >>> global_in_class 9 >>> Test.global_in_class Traceback (most recent call last): AttributeError: type object 'Test' has no attribute 'global_in_class' >>> Test().global_in_class Traceback (most recent call last): AttributeError: 'Test' object has no attribute...
Test
python
tensorflow__tensorflow
tensorflow/python/eager/polymorphic_function/concrete_function.py
{ "start": 14697, "end": 37004 }
class ____(object): """Caches forward and backward functions compatible with eager gradients. In contrast to the delayed-rewrite approach in `_DelayedRewriteGradientFunctions` which only works with delayed execution, the forward function generated by this class has a fixed set of outputs which may be preserv...
_TapeGradientFunctions
python
celery__celery
t/integration/test_mem_leak_in_exception_handling.py
{ "start": 347, "end": 8807 }
class ____: """Test class for memory leak scenarios with unhandled exceptions.""" def __init__(self): self.app = Celery('test_memory_leak') self.app.conf.update( broker_url='memory://', result_backend='cache+memory://', task_always_eager=True, tas...
MemoryLeakUnhandledExceptionsTest
python
huggingface__transformers
src/transformers/models/aria/modeling_aria.py
{ "start": 28365, "end": 31510 }
class ____(AriaTextPreTrainedModel): def __init__(self, config: AriaTextConfig): super().__init__(config) self.padding_idx = config.pad_token_id self.vocab_size = config.vocab_size self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx) self...
AriaTextModel
python
getsentry__sentry
src/sentry/dynamic_sampling/tasks/boost_low_volume_transactions.py
{ "start": 2227, "end": 2472 }
class ____(ProjectIdentity, total=True): """ Information about the project transactions """ transaction_counts: list[tuple[str, float]] total_num_transactions: float | None total_num_classes: int | None
ProjectTransactions
python
encode__django-rest-framework
tests/test_fields.py
{ "start": 50866, "end": 51459 }
class ____(FieldValues, TestCase): """ Valid and invalid values for `DateTimeField` with naive datetimes. """ valid_inputs = { datetime.datetime(2001, 1, 1, 13, 00, tzinfo=utc): datetime.datetime(2001, 1, 1, 13, 00), '2001-01-01 13:00': datetime.datetime(2001, 1, 1, 13, 00), } in...
TestNaiveDateTimeField
python
getsentry__sentry
tests/sentry/models/test_file.py
{ "start": 526, "end": 2502 }
class ____(TestCase): def test_from_file(self) -> None: fileobj = ContentFile(b"foo bar") my_file1 = FileBlob.from_file(fileobj) assert my_file1.path fileobj.seek(0) my_file2 = FileBlob.from_file(fileobj) # deep check assert my_file1.id == my_file2.id ...
FileBlobTest
python
mitmproxy__pdoc
test/testdata/type_stubs/_utils.py
{ "start": 0, "end": 100 }
class ____: """Docstring from imported py file - ideally this should be overridden."""
ImportedClass
python
more-itertools__more-itertools
tests/test_recipes.py
{ "start": 7080, "end": 7290 }
class ____(TestCase): """Tests for ``dotproduct()``'""" def test_happy_path(self): """simple dotproduct example""" self.assertEqual(400, mi.dotproduct([10, 10], [20, 20]))
DotproductTests
python
python-excel__xlrd
xlrd/xldate.py
{ "start": 1165, "end": 1226 }
class ____(XLDateError): "``xldate < 0.00``"
XLDateNegative
python
geekcomputers__Python
venv/Lib/site-packages/pip/_vendor/pygments/formatters/pangomarkup.py
{ "start": 527, "end": 2218 }
class ____(Formatter): """ Format tokens as Pango Markup code. It can then be rendered to an SVG. .. versionadded:: 2.9 """ name = 'Pango Markup' aliases = ['pango', 'pangomarkup'] filenames = [] def __init__(self, **options): Formatter.__init__(self, **options) self....
PangoMarkupFormatter
python
python-openxml__python-docx
src/docx/oxml/simpletypes.py
{ "start": 10466, "end": 10736 }
class ____(XsdLong): @classmethod def convert_from_xml(cls, str_value: str) -> Length: return Emu(int(str_value)) @classmethod def validate(cls, value: Any) -> None: cls.validate_int_in_range(value, 0, 27273042316900)
ST_PositiveCoordinate
python
google__jax
jax/_src/pallas/mosaic_gpu/core.py
{ "start": 48257, "end": 48891 }
class ____(effects.Effect): pass effects.control_flow_allowed_effects.add_type(_WGMMAPipelineEffect) _wgmma_pipeline_effect = _WGMMAPipelineEffect() # We define the layout_cast primitive here, because it needs to be available in # the lowering code (to provide layout hints to the rules). layout_cast_p = jax_core....
_WGMMAPipelineEffect
python
huggingface__transformers
src/transformers/models/sam3/modeling_sam3.py
{ "start": 1776, "end": 2594 }
class ____(ModelOutput): r""" fpn_hidden_states (`tuple[torch.FloatTensor]`): Tuple of multi-level FPN feature maps. fpn_position_encoding (`tuple[torch.FloatTensor]`): Tuple of position encodings for each FPN level. hidden_states (`tuple[torch.FloatTensor]`, *optional*): Tuple o...
Sam3VisionEncoderOutput
python
ray-project__ray
python/ray/_private/accelerators/nvidia_gpu.py
{ "start": 513, "end": 4087 }
class ____(AcceleratorManager): """NVIDIA GPU accelerators.""" @staticmethod def get_resource_name() -> str: return "GPU" @staticmethod def get_visible_accelerator_ids_env_var() -> str: return CUDA_VISIBLE_DEVICES_ENV_VAR @staticmethod def get_current_process_visible_accel...
NvidiaGPUAcceleratorManager
python
ethereum__web3.py
web3/_utils/events.py
{ "start": 12104, "end": 12775 }
class ____(BaseEventFilterBuilder): def deploy(self, w3: "Web3") -> "LogFilter": if not isinstance(w3, web3.Web3): raise Web3ValueError(f"Invalid web3 argument: got: {w3!r}") for arg in self.args.values(): arg._immutable = True self._immutable = True log_fil...
EventFilterBuilder
python
getsentry__sentry
src/sentry/models/groupmeta.py
{ "start": 433, "end": 2801 }
class ____(BaseManager["GroupMeta"]): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.__local_cache = threading.local() def __getstate__(self): d = self.__dict__.copy() d.pop("_GroupMetaManager__local_cache", None) return d def __setstate...
GroupMetaManager
python
sqlalchemy__sqlalchemy
examples/versioned_rows/versioned_rows_w_versionid.py
{ "start": 967, "end": 2717 }
class ____: # we have a composite primary key consisting of "id" # and "version_id" id = Column(Integer, primary_key=True) version_id = Column(Integer, primary_key=True, default=1) # optional - add a persisted is_current_version column is_current_version = Column(Boolean, default=True) # o...
Versioned
python
kamyu104__LeetCode-Solutions
Python/integer-break.py
{ "start": 1706, "end": 2115 }
class ____(object): def integerBreak(self, n): """ :type n: int :rtype: int """ if n < 4: return n - 1 # integerBreak(n) = max(integerBreak(n - 2) * 2, integerBreak(n - 3) * 3) res = [0, 1, 2, 3] for i in xrange(4, n + 1): res[...
Solution2
python
gevent__gevent
src/greentest/3.14/test_urllib2.py
{ "start": 11656, "end": 11804 }
class ____: def read(self, count=None): pass def readline(self, count=None): pass def close(self): pass
MockFile
python
gevent__gevent
src/greentest/3.10/test_socket.py
{ "start": 171238, "end": 171401 }
class ____(SendmsgStreamTests, SendrecvmsgUnixStreamTestBase): pass @requireAttrs(socket.socket, "recvmsg") @requireAttrs(socket, "AF_UNIX")
SendmsgUnixStreamTest
python
pypa__setuptools
setuptools/_vendor/typeguard/_transformer.py
{ "start": 15816, "end": 44937 }
class ____(NodeTransformer): def __init__( self, target_path: Sequence[str] | None = None, target_lineno: int | None = None ) -> None: self._target_path = tuple(target_path) if target_path else None self._memo = self._module_memo = TransformMemo(None, None, ()) self.names_used_in...
TypeguardTransformer
python
python__mypy
mypy/semanal_shared.py
{ "start": 3855, "end": 9621 }
class ____(SemanticAnalyzerCoreInterface): """A limited abstract interface to some generic semantic analyzer pass 2 functionality. We use this interface for various reasons: * Looser coupling * Cleaner import graph * Less need to pass around callback functions """ tvar_scope: TypeVarLikeS...
SemanticAnalyzerInterface
python
pytorch__pytorch
test/torch_np/numpy_tests/core/test_numeric.py
{ "start": 79787, "end": 86548 }
class ____(TestCase): """Test ones_like, zeros_like, empty_like and full_like""" def setUp(self): super().setUp() self.data = [ # Array scalars (np.array(3.0), None), (np.array(3), "f8"), # 1D arrays (np.arange(6, dtype="f4"), None), ...
TestLikeFuncs
python
docker__docker-py
tests/unit/api_container_test.py
{ "start": 466, "end": 4354 }
class ____(BaseAPIClientTest): def test_start_container(self): self.client.start(fake_api.FAKE_CONTAINER_ID) args = fake_request.call_args assert args[0][1] == (url_prefix + 'containers/' + fake_api.FAKE_CONTAINER_ID + '/start') assert 'data' not in arg...
StartContainerTest
python
pytorch__pytorch
torch/_dynamo/utils.py
{ "start": 140019, "end": 140676 }
class ____: """Convert obj from torch.Tensor to tnp.ndarray and call method. Then convert result back to torch.Tensor.""" def __init__(self, method: str) -> None: self.method = method self.__name__ = "wrapped_" + self.method def __repr__(self) -> str: return f"<Wrapped method <orig...
numpy_method_wrapper
python
langchain-ai__langchain
libs/langchain/langchain_classic/chains/base.py
{ "start": 1115, "end": 31346 }
class ____(RunnableSerializable[dict[str, Any], dict[str, Any]], ABC): """Abstract base class for creating structured sequences of calls to components. Chains should be used to encode a sequence of calls to components like models, document retrievers, other chains, etc., and provide a simple interface ...
Chain
python
allegroai__clearml
clearml/backend_interface/task/repo/scriptinfo.py
{ "start": 832, "end": 12902 }
class ____(object): _detailed_import_report = deferred_config("development.detailed_import_report", False) _max_requirements_size = 512 * 1024 _packages_remove_version = ("setuptools",) _ignore_packages = set() @classmethod def _get_logger(cls) -> logging.Logger: return get_logger("Repo...
ScriptRequirements
python
getsentry__sentry
src/sentry/integrations/api/serializers/models/external_actor.py
{ "start": 711, "end": 2196 }
class ____(Serializer): def get_attrs( self, item_list: Sequence[ExternalActor], user: User | RpcUser | AnonymousUser, **kwargs: Any, ) -> MutableMapping[ExternalActor, MutableMapping[str, Any]]: # create a mapping of external actor to a set of attributes. # Those...
ExternalActorSerializer
python
etianen__django-reversion
tests/test_app/models.py
{ "start": 1414, "end": 1536 }
class ____(models.Model): name = models.CharField( max_length=191, default="v1", )
TestModelRelated
python
plotly__plotly.py
_plotly_utils/basevalidators.py
{ "start": 76832, "end": 77446 }
class ____(CompoundValidator): """ This is a special validator to allow compound title properties (e.g. layout.title, layout.xaxis.title, etc.) to be set as strings or numbers. These strings are mapped to the 'text' property of the compound validator. """ def __init__(self, *args, **kwargs...
TitleValidator
python
chroma-core__chroma
chromadb/test/conftest.py
{ "start": 27688, "end": 27770 }
class ____(AsyncClientCreator): pass @async_class_to_sync
AsyncClientCreatorSync
python
PyCQA__pylint
tests/functional/m/member/member_checks.py
{ "start": 1995, "end": 2062 }
class ____: """No no-member should be emitted for mixins."""
Mixin
python
keras-team__keras
keras/src/optimizers/adamw_test.py
{ "start": 170, "end": 3540 }
class ____(testing.TestCase): def test_config(self): optimizer = AdamW( learning_rate=0.5, weight_decay=0.008, beta_1=0.5, beta_2=0.67, epsilon=1e-5, amsgrad=True, ) self.run_class_serialization_test(optimizer) def ...
AdamWTest
python
pypa__pipenv
pipenv/patched/pip/_vendor/rich/_win32_console.py
{ "start": 10432, "end": 22800 }
class ____: """This class allows interaction with the legacy Windows Console API. It should only be used in the context of environments where virtual terminal processing is not available. However, if it is used in a Windows environment, the entire API should work. Args: file (IO[str]): The file...
LegacyWindowsTerm
python
getsentry__sentry
tests/sentry/workflow_engine/processors/test_data_condition_group.py
{ "start": 5051, "end": 7371 }
class ____(TestEvaluationConditionCase): def test_evaluate_data_conditions__passes_all(self) -> None: expected_result = ProcessedDataConditionGroup( logic_result=TriggerResult.TRUE, condition_results=[ ProcessedDataCondition( logic_result=TriggerRe...
TestEvaluateConditionGroupTypeAny
python
pola-rs__polars
py-polars/src/polars/_cpu_check.py
{ "start": 4491, "end": 4648 }
class ____(ctypes.Structure): _fields_: ClassVar[list[tuple[str, type]]] = [ (r, c_uint32) for r in ("eax", "ebx", "ecx", "edx") ]
CPUID_struct
python
getsentry__sentry
src/sentry/notifications/additional_attachment_manager.py
{ "start": 730, "end": 2198 }
class ____: def __init__(self) -> None: self.attachment_generators: MutableMapping[ExternalProviders, GetAttachment] = {} # need to update types for additional providers def get_additional_attachment( self, integration: Integration | RpcIntegration, organization: Organizatio...
AdditionalAttachmentManager
python
wandb__wandb
wandb/filesync/dir_watcher.py
{ "start": 2963, "end": 6011 }
class ____(FileEventHandler): """Event handler that uploads respecting throttling. Uploads files every RATE_LIMIT_SECONDS, which changes as the size increases to deal with throttling. """ RATE_LIMIT_SECONDS = 15 unit_dict = dict(util.POW_10_BYTES) # Wait to upload until size has increased ...
PolicyLive
python
spack__spack
lib/spack/spack/installer.py
{ "start": 109128, "end": 109255 }
class ____(spack.error.InstallError): """Raised by install() when a package is only for external use."""
ExternalPackageError
python
numba__numba
numba/np/ufunc/ufuncbuilder.py
{ "start": 1661, "end": 1995 }
class ____(TargetDescriptor): options = UFuncTargetOptions def __init__(self): super().__init__('ufunc') @property def typing_context(self): return cpu_target.typing_context @property def target_context(self): return cpu_target.target_context ufunc_target = UFuncTarg...
UFuncTarget
python
pyca__cryptography
tests/hazmat/primitives/test_camellia.py
{ "start": 1275, "end": 1766 }
class ____: test_cbc = generate_encrypt_test( load_nist_vectors, os.path.join("ciphers", "Camellia"), ["camellia-cbc.txt"], lambda key, **kwargs: Camellia(binascii.unhexlify(key)), lambda iv, **kwargs: modes.CBC(binascii.unhexlify(iv)), ) @pytest.mark.supported( onl...
TestCamelliaModeCBC
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_image13.py
{ "start": 315, "end": 970 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("image13.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file with image(s).""" workbook = Workbook(...
TestCompareXLSXFiles
python
altair-viz__altair
altair/vegalite/v6/schema/core.py
{ "start": 750317, "end": 751286 }
class ____(DataSource): """ NamedData schema wrapper. Parameters ---------- name : str Provide a placeholder name and bind data at runtime. New data may change the layout but Vega does not always resize the chart. To update the layout when the data updates, set `autosize ...
NamedData
python
great-expectations__great_expectations
great_expectations/expectations/metrics/column_aggregate_metrics/column_values_between_count.py
{ "start": 638, "end": 9439 }
class ____(MetricProvider): """This metric is an aggregate helper for rare cases.""" metric_name = "column_values.between.count" value_keys = ( "min_value", "max_value", "strict_min", "strict_max", ) @metric_value(engine=PandasExecutionEngine) def _pandas( # no...
ColumnValuesBetweenCount
python
sympy__sympy
sympy/parsing/sympy_parser.py
{ "start": 38120, "end": 43313 }
class ____(ast.NodeTransformer): operators = { ast.Add: 'Add', ast.Mult: 'Mul', ast.Pow: 'Pow', ast.Sub: 'Add', ast.Div: 'Mul', ast.BitOr: 'Or', ast.BitAnd: 'And', ast.BitXor: 'Xor', } functions = ( 'Abs', 'im', 're', 'sign', 'arg', 'co...
EvaluateFalseTransformer
python
pdm-project__pdm
src/pdm/cli/commands/venv/list.py
{ "start": 216, "end": 820 }
class ____(BaseCommand): """List all virtualenvs associated with this project""" arguments = (verbose_option,) def handle(self, project: Project, options: argparse.Namespace) -> None: project.core.ui.echo("Virtualenvs created with this project:\n") for ident, venv in iter_venvs(project): ...
ListCommand
python
pytorch__pytorch
tools/test/heuristics/test_utils.py
{ "start": 341, "end": 1574 }
class ____(unittest.TestCase): def assertDictAlmostEqual( self, first: dict[TestRun, Any], second: dict[TestRun, Any] ) -> None: self.assertEqual(first.keys(), second.keys()) for key in first: self.assertAlmostEqual(first[key], second[key]) def test_normalize_ratings(sel...
TestHeuristicsUtils
python
automl__auto-sklearn
autosklearn/pipeline/components/data_preprocessing/rescaling/minmax.py
{ "start": 425, "end": 1703 }
class ____(Rescaling, AutoSklearnPreprocessingAlgorithm): def __init__( self, random_state: Optional[Union[int, np.random.RandomState]] = None ): from sklearn.preprocessing import MinMaxScaler self.preprocessor = MinMaxScaler(copy=False) @staticmethod def get_properties( ...
MinMaxScalerComponent
python
google__pytype
pytype/tests/test_disables.py
{ "start": 72, "end": 5761 }
class ____(test_base.BaseTest): """Test error disabling.""" def test_invalid_directive(self): errors = self.CheckWithErrors(""" x = 1 # pytype: this is not a valid pytype directive. # invalid-directive """) # Invalid directives are just a warning, so has_error() should still # return False....
DisableTest
python
django__django
tests/generic_views/views.py
{ "start": 4469, "end": 4745 }
class ____(generic.UpdateView): model = Author form_class = AuthorForm template_name = "generic_views/form.html" context_object_name = "thingy" def get_success_url(self): return reverse("author_detail", args=[self.object.id])
SpecializedAuthorUpdate
python
Netflix__metaflow
metaflow/plugins/env_escape/communication/channel.py
{ "start": 45, "end": 1650 }
class ____(object): """ Channel is a higher level abstraction over a low-level bytestream. You can send and receive JSON serializable object directly with this interface For now this class does not do much, but we could imagine some sort compression or other transformation being added here """...
Channel
python
apache__airflow
airflow-core/src/airflow/api_fastapi/core_api/datamodels/common.py
{ "start": 1400, "end": 1578 }
class ____(enum.Enum): """Bulk Action to be taken if the entity already exists or not.""" FAIL = "fail" SKIP = "skip" OVERWRITE = "overwrite"
BulkActionOnExistence
python
encode__django-rest-framework
rest_framework/renderers.py
{ "start": 1809, "end": 4092 }
class ____(BaseRenderer): """ Renderer which serializes to JSON. """ media_type = 'application/json' format = 'json' encoder_class = encoders.JSONEncoder ensure_ascii = not api_settings.UNICODE_JSON compact = api_settings.COMPACT_JSON strict = api_settings.STRICT_JSON # We don't...
JSONRenderer
python
langchain-ai__langchain
libs/cli/langchain_cli/integration_template/tests/integration_tests/test_tools.py
{ "start": 148, "end": 925 }
class ____(ToolsIntegrationTests): @property def tool_constructor(self) -> Type[__ModuleName__Tool]: return __ModuleName__Tool @property def tool_constructor_params(self) -> dict: # if your tool constructor instead required initialization arguments like # `def __init__(self, som...
TestParrotMultiplyToolIntegration
python
jmcnamara__XlsxWriter
xlsxwriter/test/worksheet/test_write_tab_color.py
{ "start": 301, "end": 838 }
class ____(unittest.TestCase): """ Test the Worksheet _write_tab_color() method. """ def setUp(self): self.fh = StringIO() self.worksheet = Worksheet() self.worksheet._set_filehandle(self.fh) def test_write_tab_color(self): """Test the _write_tab_color() method""" ...
TestWriteTabColor
python
getsentry__sentry
src/sentry/api/serializers/models/organization_member/response.py
{ "start": 1622, "end": 2140 }
class ____(TypedDict): externalUsers: NotRequired[list[ExternalActorResponse]] role: NotRequired[str] # Deprecated: use orgRole roleName: NotRequired[str] # Deprecated id: str email: str name: str # User may be optional b/c invites don't have users yet user: NotRequired[UserSerializerR...
OrganizationMemberResponse
python
ipython__ipython
tests/test_decorators.py
{ "start": 2657, "end": 3663 }
class ____(object): """FooClass Example: >>> 1+1 2 """ @skip_doctest def __init__(self, x): """Make a FooClass. Example: >>> f = FooClass(3) junk """ print("Making a FooClass.") self.x = x @skip_doctest def bar(self, y): ...
FooClass
python
sqlalchemy__sqlalchemy
test/orm/dml/test_bulk.py
{ "start": 34467, "end": 36300 }
class ____(BulkTest, fixtures.DeclarativeMappedTest): __sparse_driver_backend__ = True @classmethod def setup_classes(cls): Base = cls.DeclarativeBasic class User(Base): __tablename__ = "users" id = Column(Integer, Identity(), primary_key=True) name = Co...
BulkIssue6793Test
python
huggingface__transformers
src/transformers/models/dots1/modeling_dots1.py
{ "start": 9361, "end": 13024 }
class ____(nn.Module): """Multi-headed attention from 'Attention Is All You Need' paper""" def __init__(self, config: Dots1Config, layer_idx: int): super().__init__() self.layer_type = config.layer_types[layer_idx] if hasattr(config, "layer_types") else None self.config = config ...
Dots1Attention
python
getsentry__sentry
src/sentry/snuba/entity_subscription.py
{ "start": 20662, "end": 25557 }
class ____(BaseCrashRateMetricsEntitySubscription): metric_key: SessionMRI = SessionMRI.RAW_USER def get_snql_aggregations(self) -> list[str]: return [ "uniq() as count", "uniqIf(session.status, crashed) as crashed", ] EntitySubscription = Union[ EventsEntitySubscr...
MetricsSetsEntitySubscription
python
python-openxml__python-docx
src/docx/shared.py
{ "start": 2443, "end": 2670 }
class ____(Length): """Convenience constructor for length in millimeters, e.g. ``width = Mm(240.5)``.""" def __new__(cls, mm: float): emu = int(mm * Length._EMUS_PER_MM) return Length.__new__(cls, emu)
Mm
python
doocs__leetcode
solution/0500-0599/0575.Distribute Candies/Solution.py
{ "start": 0, "end": 139 }
class ____: def distributeCandies(self, candyType: List[int]) -> int: return min(len(candyType) >> 1, len(set(candyType)))
Solution
python
apache__airflow
providers/amazon/src/airflow/providers/amazon/aws/operators/glue_crawler.py
{ "start": 1449, "end": 5310 }
class ____(AwsBaseOperator[GlueCrawlerHook]): """ Creates, updates and triggers an AWS Glue Crawler. AWS Glue Crawler is a serverless service that manages a catalog of metadata tables that contain the inferred schema, format and data types of data stores within the AWS cloud. .. seealso:: ...
GlueCrawlerOperator
python
pytorch__pytorch
torch/testing/_internal/common_nn.py
{ "start": 165292, "end": 172865 }
class ____(InputVariableMixin, TestBase): # type: ignore[misc] # TODO: check that criterions don't ignore grad_output _required_arg_names = TestBase._required_arg_names.union({'target'}) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.should_test_cuda = kwargs....
CriterionTest
python
GoogleCloudPlatform__python-docs-samples
appengine/standard/ndb/async/shopping_cart_test.py
{ "start": 3419, "end": 4235 }
class ____(ndb.Model): value = ndb.IntegerProperty() def test_update_counter_async(testbed): counter_key = Counter(value=1).put() update_counter = shopping_cart.define_update_counter_async() future = update_counter(counter_key) assert counter_key.get().value == 1 assert future.get_result() == ...
Counter
python
doocs__leetcode
solution/0300-0399/0375.Guess Number Higher or Lower II/Solution.py
{ "start": 0, "end": 372 }
class ____: def getMoneyAmount(self, n: int) -> int: f = [[0] * (n + 1) for _ in range(n + 1)] for i in range(n - 1, 0, -1): for j in range(i + 1, n + 1): f[i][j] = j + f[i][j - 1] for k in range(i, j): f[i][j] = min(f[i][j], max(f[i][k...
Solution
python
django__django
django/db/backends/ddl_references.py
{ "start": 5815, "end": 7355 }
class ____(Reference): """ Statement template and formatting parameters container. Allows keeping a reference to a statement without interpolating identifiers that might have to be adjusted if they're referencing a table or column that is removed """ def __init__(self, template, **parts): ...
Statement
python
ray-project__ray
python/ray/client_builder.py
{ "start": 11138, "end": 14589 }
class ____(ClientBuilder): def connect(self) -> ClientContext: """ Begin a connection to the address passed in via ray.client(...) """ if self._deprecation_warn_enabled: self._client_deprecation_warn() # Fill runtime env/namespace from environment if not already s...
_LocalClientBuilder
python
django__django
tests/admin_inlines/models.py
{ "start": 10050, "end": 10259 }
class ____(models.Model): id = models.UUIDField(default=uuid.uuid4, primary_key=True) title = models.CharField(max_length=128) parent = models.ForeignKey(UUIDParent, on_delete=models.CASCADE)
UUIDChild
python
astropy__astropy
astropy/io/fits/diff.py
{ "start": 45994, "end": 60021 }
class ____(_BaseDiff): """ Diff two table data arrays. It doesn't matter whether the data originally came from a binary or ASCII table--the data should be passed in as a recarray. `TableDataDiff` objects have the following diff attributes: - ``diff_column_count``: If the tables being compared ...
TableDataDiff
python
getsentry__sentry
tests/sentry/sentry_apps/api/endpoints/test_sentry_apps_stats.py
{ "start": 292, "end": 3063 }
class ____(APITestCase): endpoint = "sentry-api-0-sentry-apps-stats" method = "get" def setUp(self) -> None: self.superuser = self.create_user(is_superuser=True) self.org_two = self.create_organization() self.app_one = self.create_sentry_app( name="Test", organization=s...
SentryAppsStatsTest
python
huggingface__transformers
src/transformers/models/electra/configuration_electra.py
{ "start": 867, "end": 7711 }
class ____(PreTrainedConfig): r""" This is the configuration class to store the configuration of a [`ElectraModel`]. It is used to instantiate a ELECTRA model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar confi...
ElectraConfig
python
ray-project__ray
python/ray/data/random_access_dataset.py
{ "start": 9766, "end": 10209 }
class ____: def __init__(self, arrow_col): self.arrow_col = arrow_col def __getitem__(self, i): return self.arrow_col[i].as_py() def __len__(self): return len(self.arrow_col) def _get_bounds(block, key): if len(block) == 0: return None b = (block[key][0], block[ke...
_ArrowListWrapper
python
scikit-learn__scikit-learn
sklearn/linear_model/_glm/glm.py
{ "start": 21880, "end": 26093 }
class ____(_GeneralizedLinearRegressor): """Generalized Linear Model with a Gamma distribution. This regressor uses the 'log' link function. Read more in the :ref:`User Guide <Generalized_linear_models>`. .. versionadded:: 0.23 Parameters ---------- alpha : float, default=1 Const...
GammaRegressor
python
pypa__warehouse
warehouse/subscriptions/interfaces.py
{ "start": 4436, "end": 4494 }
class ____(IGenericBillingService): pass
IBillingService