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
sqlalchemy__sqlalchemy
lib/sqlalchemy/ext/hybrid.py
{ "start": 43181, "end": 43273 }
class ____(Protocol[_T_co]): def __call__(s, self: Any, /) -> _T_co: ...
_HybridGetterType
python
rapidsai__cudf
python/cudf/cudf/core/dataframe.py
{ "start": 14750, "end": 17354 }
class ____(_DataFrameIndexer): """ For selection by index. """ def __getitem__(self, arg): ( row_key, ( col_is_scalar, ca, ), ) = indexing_utils.destructure_dataframe_iloc_indexer(arg, self._frame) row_spec = in...
_DataFrameIlocIndexer
python
ApeWorX__ape
src/ape/managers/chain.py
{ "start": 23760, "end": 35737 }
class ____(BaseManager): """ A class for managing the state of the active blockchain. Also, handy for querying data about the chain and managing local caches. Access the chain manager singleton from the root ``ape`` namespace. Usage example:: from ape import chain """ _snapshots: ...
ChainManager
python
apache__airflow
task-sdk/tests/task_sdk/api/test_client.py
{ "start": 53846, "end": 54722 }
class ____: def test_get_start_date(self): """Test that the client can get the start date of a task reschedule""" ti_id = uuid6.uuid7() def handle_request(request: httpx.Request) -> httpx.Response: if request.url.path == f"/task-reschedules/{ti_id}/start_date": a...
TestTaskRescheduleOperations
python
vyperlang__vyper
vyper/exceptions.py
{ "start": 8074, "end": 8162 }
class ____(VyperException): """Reference to a type that does not exist."""
UnknownType
python
facebook__pyre-check
client/language_server/protocol.py
{ "start": 8141, "end": 8280 }
class ____(json_mixins.CamlCaseAndExcludeJsonMixin): start: LspPosition end: LspPosition @dataclasses.dataclass(frozen=True)
LspRange
python
PyCQA__pylint
tests/functional/u/unbalanced/unbalanced_tuple_unpacking.py
{ "start": 2944, "end": 4716 }
class ____(NamedTuple): first: float second: float third: float = 1.0 def my_sum(self): """Unpack 3 variables""" first, second, third = self return first + second + third def sum_unpack_3_into_4(self): """Attempt to unpack 3 variables into 4""" first, second...
MyClass
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/with1.py
{ "start": 1915, "end": 2077 }
class ____(Generic[_T1]): async def __aenter__(self) -> Self: return self async def __aexit__(self, *args: Any) -> None: return None
Class5
python
numba__numba
numba/core/utils.py
{ "start": 11832, "end": 13066 }
class ____(dict): def __setitem__(self, key, value): if key in self: raise AssertionError("key already in dictionary: %r" % (key,)) super(UniqueDict, self).__setitem__(key, value) def runonce(fn): @functools.wraps(fn) def inner(): if not inner._ran: res = fn...
UniqueDict
python
huggingface__transformers
tests/utils/test_doc_samples.py
{ "start": 874, "end": 4326 }
class ____(unittest.TestCase): def analyze_directory( self, directory: Path, identifier: str | None = None, ignore_files: list[str] | None = None, n_identifier: str | list[str] | None = None, only_modules: bool = True, ): """ Runs through the speci...
TestCodeExamples
python
getsentry__sentry
src/sentry/seer/models.py
{ "start": 1663, "end": 1861 }
class ____(BaseModel): handoff_point: AutofixHandoffPoint target: Literal["cursor_background_agent"] integration_id: int auto_create_pr: bool = False
SeerAutomationHandoffConfiguration
python
getsentry__sentry
src/sentry/sentry_apps/api/endpoints/sentry_app_avatar.py
{ "start": 621, "end": 1403 }
class ____(AvatarMixin[SentryAppAvatar], SentryAppBaseEndpoint): owner = ApiOwner.INTEGRATIONS publish_status = { "GET": ApiPublishStatus.PRIVATE, "PUT": ApiPublishStatus.PRIVATE, } object_type = "sentry_app" model = SentryAppAvatar serializer_cls = SentryAppAvatarParser def...
SentryAppAvatarEndpoint
python
doocs__leetcode
solution/1100-1199/1101.The Earliest Moment When Everyone Become Friends/Solution2.py
{ "start": 624, "end": 896 }
class ____: def earliestAcq(self, logs: List[List[int]], n: int) -> int: uf = UnionFind(n) for t, x, y in sorted(logs): if uf.union(x, y): n -= 1 if n == 1: return t return -1
Solution
python
qdrant__qdrant-client
qdrant_client/http/models/models.py
{ "start": 144912, "end": 145241 }
class ____(BaseModel, extra="forbid"): type: "UuidIndexType" = Field(..., description="") is_tenant: Optional[bool] = Field(default=None, description="If true - used for tenant optimization.") on_disk: Optional[bool] = Field(default=None, description="If true, store the index on disk. Default: false.")
UuidIndexParams
python
allegroai__clearml
clearml/backend_api/services/v2_23/tasks.py
{ "start": 399201, "end": 437859 }
class ____(Response): """ Response of tasks.get_by_id endpoint. :param task: Task info :type task: Task """ _service = "tasks" _action = "get_by_id" _version = "2.23" _schema = { "definitions": { "artifact": { "properties": { ...
GetByIdResponse
python
run-llama__llama_index
llama-index-integrations/readers/llama-index-readers-dashscope/llama_index/readers/dashscope/domain/lease_domains.py
{ "start": 4581, "end": 5003 }
class ____(DictToObject): def __init__(self, file_id: str, parser: str): self.file_id = file_id self.parser = parser @classmethod def from_dict(cls, data: dict): default_values = {"file_id": "", "parser": ""} file_id = data.get("file_id", default_values["file_id"]) ...
AddFileResult
python
pytorch__pytorch
torch/__init__.py
{ "start": 73683, "end": 73913 }
class ____(_LegacyStorage): @classproperty def dtype(self): _warn_typed_storage_removal(stacklevel=3) return self._dtype @classproperty def _dtype(self): return torch.quint4x2
QUInt4x2Storage
python
keras-team__keras
keras/src/utils/image_utils_test.py
{ "start": 217, "end": 1342 }
class ____(testing.TestCase, parameterized.TestCase): @parameterized.named_parameters( ("rgb_explicit_format", (50, 50, 3), "rgb.jpg", "jpg", True), ("rgba_explicit_format", (50, 50, 4), "rgba.jpg", "jpg", True), ("rgb_inferred_format", (50, 50, 3), "rgb_inferred.jpg", None, False), ...
SaveImgTest
python
openai__openai-python
src/openai/resources/models.py
{ "start": 5084, "end": 9586 }
class ____(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncModelsWithRawResponse: """ This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.git...
AsyncModels
python
HypothesisWorks__hypothesis
hypothesis-python/tests/nocover/test_drypython_returns.py
{ "start": 2812, "end": 4763 }
class ____(_FirstBase[int, str], _SecondBase[float, bool]): pass _generic_test_types = ( TwoGenericBases1, TwoGenericBases2, OneGenericOneConrete1, OneGenericOneConrete2, MixedGenerics1, MixedGenerics2, AllConcrete, ) @pytest.mark.parametrize("type_", _generic_test_types) def test_se...
AllConcrete
python
ray-project__ray
python/ray/serve/tests/test_config_files/pizza.py
{ "start": 1020, "end": 1400 }
class ____: def __init__(self, factor: int): self.factor = factor def reconfigure(self, config: Dict): self.factor = config.get("factor", -1) def multiply(self, input_factor: int) -> int: return input_factor * self.factor @serve.deployment( user_config={ "increment": ...
Multiplier
python
getsentry__sentry
src/sentry/explore/models.py
{ "start": 724, "end": 1199 }
class ____(TypesClass): SPANS = 0 OURLOGS = 1 METRICS = 2 # This is a temporary dataset to be used for the discover -> explore migration. # It will track which queries are generated from discover queries. SEGMENT_SPANS = 101 TYPES = [ (SPANS, "spans"), (OURLOGS, "logs"), ...
ExploreSavedQueryDataset
python
aio-libs__aiohttp
aiohttp/_websocket/models.py
{ "start": 3170, "end": 3251 }
class ____(Exception): """WebSocket protocol handshake error."""
WSHandshakeError
python
getsentry__sentry
src/sentry/snuba/rpc_dataset_common.py
{ "start": 2941, "end": 3625 }
class ____: """Container for rpc requests""" rpc_request: TraceItemTableRequest columns: list[AnyResolved] def check_timeseries_has_data(timeseries: SnubaData, y_axes: list[str]): for row in timeseries: for axis in y_axes: if row[axis] and row[axis] != 0: return Tr...
TableRequest
python
pytorch__pytorch
torch/testing/_internal/distributed/_tensor/common_dtensor.py
{ "start": 2525, "end": 3004 }
class ____(nn.Module): def __init__(self, device, bias: bool = True): super().__init__() torch.manual_seed(5) self.net1 = nn.Linear(10, 16, bias=bias, device=device) self.relu = nn.ReLU() self.net2 = nn.Linear(16, 10, bias=bias, device=device) def forward(self, x): ...
MLPModule
python
pandas-dev__pandas
asv_bench/benchmarks/libs.py
{ "start": 1540, "end": 2219 }
class ____: param_names = ["dtype"] data_dict = { "np-object": np.array([1] * 100000, dtype="O"), "py-object": [1] * 100000, "np-null": np.array([1] * 50000 + [np.nan] * 50000), "py-null": [1] * 50000 + [None] * 50000, "np-int": np.array([1] * 100000, dtype=int), ...
InferDtype
python
Textualize__textual
src/textual/_duration.py
{ "start": 186, "end": 1211 }
class ____(DurationError): """ Indicates a malformed duration string that could not be parsed. """ def _duration_as_seconds(duration: str) -> float: """ Args: duration: A string of the form `"2s"` or `"300ms"`, representing 2 seconds and 300 milliseconds respectively. If no uni...
DurationParseError
python
kamyu104__LeetCode-Solutions
Python/longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit.py
{ "start": 934, "end": 1812 }
class ____(object): def longestSubarray(self, nums, limit): """ :type nums: List[int] :type limit: int :rtype: int """ max_dq, min_dq = collections.deque(), collections.deque() result, left = 0, 0 for right, num in enumerate(nums): while ma...
Solution2
python
ray-project__ray
python/ray/data/_internal/actor_autoscaler/autoscaling_actor_pool.py
{ "start": 267, "end": 1036 }
class ____: delta: int force: bool = field(default=False) reason: Optional[str] = field(default=None) @classmethod def no_op(cls, *, reason: Optional[str] = None) -> "ActorPoolScalingRequest": return ActorPoolScalingRequest(delta=0, reason=reason) @classmethod def upscale(cls, *, ...
ActorPoolScalingRequest
python
kubernetes-client__python
kubernetes/client/api/apps_v1_api.py
{ "start": 543, "end": 794629 }
class ____(object): """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ def __init__(self, api_client=None): if api_client is None: api_client = ApiClient() self.api_client = api_client ...
AppsV1Api
python
huggingface__transformers
src/transformers/models/rembert/modeling_rembert.py
{ "start": 12593, "end": 15728 }
class ____(GradientCheckpointingLayer): def __init__(self, config, layer_idx=None): super().__init__() self.chunk_size_feed_forward = config.chunk_size_feed_forward self.seq_len_dim = 1 self.attention = RemBertAttention(config, layer_idx) self.is_decoder = config.is_decoder ...
RemBertLayer
python
kamyu104__LeetCode-Solutions
Python/unique-paths-ii.py
{ "start": 37, "end": 676 }
class ____(object): # @param obstacleGrid, a list of lists of integers # @return an integer def uniquePathsWithObstacles(self, obstacleGrid): """ :type obstacleGrid: List[List[int]] :rtype: int """ m, n = len(obstacleGrid), len(obstacleGrid[0]) ways = [0]*n ...
Solution
python
numba__numba
numba/cuda/tests/cudapy/test_sm_creation.py
{ "start": 1380, "end": 7231 }
class ____(CUDATestCase): def getarg(self): return np.array(100, dtype=np.float32, ndmin=1) def getarg2(self): return self.getarg().reshape(1,1) def test_global_constants(self): udt = cuda.jit((float32[:],))(udt_global_constants) udt[1, 1](self.getarg()) def test_globa...
TestSharedMemoryCreation
python
PyCQA__pylint
tests/functional/ext/docparams/return/missing_return_doc_required_Numpy.py
{ "start": 1762, "end": 2198 }
class ____: """test_non_property_annotation_return_type_numpy Example of a class function trying to use `type` as return documentation in a numpy style docstring """ def foo_method(self) -> int: # [missing-return-doc] """int: docstring ... Raises ------ RuntimeErro...
Foo
python
kamyu104__LeetCode-Solutions
Python/zuma-game.py
{ "start": 3503, "end": 6580 }
class ____(object): def findMinStep(self, board, hand): """ :type board: str :type hand: str :rtype: int """ def shrink(s): # Time: O(n), Space: O(n) stack = [] start = 0 for i in xrange(len(s)+1): if i == len(s) or...
Solution_GREEDY_ACCEPT_BUT_NOT_PROVED
python
huggingface__transformers
src/transformers/generation/logits_process.py
{ "start": 43117, "end": 50683 }
class ____(LogitsProcessor): r""" [`LogitsProcessor`] that performs eta-sampling, a technique to filter out tokens with probabilities below a dynamic cutoff value, `eta`, which is calculated based on a combination of the hyperparameter `epsilon` and the entropy of the token probabilities, i.e. `eta := m...
EtaLogitsWarper
python
boto__boto3
tests/unit/s3/test_transfer.py
{ "start": 3369, "end": 9032 }
class ____(unittest.TestCase): def assert_value_of_actual_and_alias( self, config, actual, alias, ref_value ): # Ensure that the name set in the underlying TransferConfig (i.e. # the actual) is the correct value. assert getattr(config, actual) == ref_value # Ensure that b...
TestTransferConfig
python
python-excel__xlwt
xlwt/BIFFRecords.py
{ "start": 12184, "end": 12308 }
class ____(BiffRecord): _REC_ID = 0x01AF def __init__(self): self._rec_data = pack('<H', 0x00)
Prot4RevRecord
python
pypa__pipenv
pipenv/vendor/tomlkit/exceptions.py
{ "start": 1033, "end": 1278 }
class ____(ParseError): """ A numeric field was improperly specified. """ def __init__(self, line: int, col: int) -> None: message = "Invalid number" super().__init__(line, col, message=message)
InvalidNumberError
python
pypa__pip
src/pip/_internal/exceptions.py
{ "start": 13743, "end": 14417 }
class ____(InstallationError): """Multiple HashError instances rolled into one for reporting""" def __init__(self) -> None: self.errors: list[HashError] = [] def append(self, error: HashError) -> None: self.errors.append(error) def __str__(self) -> str: lines = [] self...
HashErrors
python
huggingface__transformers
src/transformers/models/mask2former/modeling_mask2former.py
{ "start": 25584, "end": 42764 }
class ____(nn.Module): def __init__(self, config: Mask2FormerConfig, weight_dict: dict[str, float]): """ The Mask2Former Loss. The loss is computed very similar to DETR. The process happens in two steps: 1) we compute hungarian assignment between ground truth masks and the outputs of the mod...
Mask2FormerLoss
python
walkccc__LeetCode
solutions/522. Longest Uncommon Subsequence II/522.py
{ "start": 0, "end": 689 }
class ____: def findLUSlength(self, strs: list[str]) -> int: def isSubsequence(a: str, b: str) -> bool: i = 0 j = 0 while i < len(a) and j < len(b): if a[i] == b[j]: i += 1 j += 1 return i == len(a) seen = set() duplicates = set() for s in strs: ...
Solution
python
MorvanZhou__Reinforcement-learning-with-tensorflow
contents/11_Dyna_Q/RL_brain.py
{ "start": 256, "end": 1996 }
class ____: def __init__(self, actions, learning_rate=0.01, reward_decay=0.9, e_greedy=0.9): self.actions = actions # a list self.lr = learning_rate self.gamma = reward_decay self.epsilon = e_greedy ## argmax type error self.q_table = pd.DataFrame(columns=self.actio...
QLearningTable
python
pydantic__pydantic
pydantic-core/python/pydantic_core/core_schema.py
{ "start": 90459, "end": 93188 }
class ____(TypedDict, total=False): type: Required[Literal['union']] choices: Required[list[Union[CoreSchema, tuple[CoreSchema, str]]]] # default true, whether to automatically collapse unions with one element to the inner validator auto_collapse: bool custom_error_type: str custom_error_message...
UnionSchema
python
psf__requests
tests/test_utils.py
{ "start": 11643, "end": 30115 }
class ____: @pytest.mark.parametrize( "encoding", ( "utf-32", "utf-8-sig", "utf-16", "utf-8", "utf-16-be", "utf-16-le", "utf-32-be", "utf-32-le", ), ) def test_encoded(self, encoding): ...
TestGuessJSONUTF
python
django__django
tests/migration_test_data_persistence/tests.py
{ "start": 130, "end": 514 }
class ____(TransactionTestCase): """ Data loaded in migrations is available if TransactionTestCase.serialized_rollback = True. """ available_apps = ["migration_test_data_persistence"] serialized_rollback = True def test_persistence(self): self.assertEqual( Book.objects....
MigrationDataPersistenceTestCase
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/genericType28.py
{ "start": 2680, "end": 2727 }
class ____(Co_TA[Co_TA[T_co]]): ...
CoToCo_WithTA
python
apache__airflow
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_assets.py
{ "start": 52518, "end": 55503 }
class ____(TestAssets): DAG_ASSET1_ID = "test_dag_1" DAG_ASSET2_ID_A = "test_dag_2a" DAG_ASSET2_ID_B = "test_dag_2b" DAG_ASSET_NO = "test_dag_no" @pytest.fixture(autouse=True) def create_dags(self, setup, dag_maker, session): # Depend on 'setup' so it runs first. Otherwise it deletes wh...
TestPostAssetMaterialize
python
pypa__warehouse
tests/unit/metrics/test_services.py
{ "start": 1530, "end": 5763 }
class ____: def test_verify_service(self): assert verifyClass(IMetricsService, DataDogMetrics) def test_create_service_defaults(self, monkeypatch): datadog_obj = pretend.stub() datadog_cls = pretend.call_recorder(lambda **kw: datadog_obj) monkeypatch.setattr(services, "DogStats...
TestDataDogMetrics
python
PyCQA__pylint
tests/functional/t/try_except_raise.py
{ "start": 480, "end": 544 }
class ____(Exception): """AAAException""" pass
AAAException
python
django__django
tests/utils_tests/test_datastructures.py
{ "start": 341, "end": 1687 }
class ____(SimpleTestCase): def test_init_with_iterable(self): s = OrderedSet([1, 2, 3]) self.assertEqual(list(s.dict.keys()), [1, 2, 3]) def test_remove(self): s = OrderedSet() self.assertEqual(len(s), 0) s.add(1) s.add(2) s.remove(2) self.assert...
OrderedSetTests
python
mlflow__mlflow
mlflow/store/artifact/databricks_models_artifact_repo.py
{ "start": 1349, "end": 10035 }
class ____(ArtifactRepository): """ Performs storage operations on artifacts controlled by a Databricks-hosted model registry. Signed access URIs for the appropriate cloud storage locations are fetched from the MLflow service and used to download model artifacts. The artifact_uri is expected to be...
DatabricksModelsArtifactRepository
python
cython__cython
Cython/Compiler/Nodes.py
{ "start": 291907, "end": 293400 }
class ____(AssignmentNode): # A combined packing/unpacking assignment: # # a, b, c = d, e, f # # This has been rearranged by the parser into # # a = d ; b = e ; c = f # # but we must evaluate all the right hand sides # before assigning to any of the left hand sides. ...
ParallelAssignmentNode
python
readthedocs__readthedocs.org
readthedocs/projects/migrations/0070_make_md5_field_nullable.py
{ "start": 149, "end": 526 }
class ____(migrations.Migration): safe = Safe.after_deploy() dependencies = [ ("projects", "0069_migrate_protected_projects"), ] operations = [ migrations.AlterField( model_name="importedfile", name="md5", field=models.CharField(max_length=255, null=T...
Migration
python
scrapy__scrapy
scrapy/exporters.py
{ "start": 901, "end": 3825 }
class ____(ABC): def __init__(self, *, dont_fail: bool = False, **kwargs: Any): self._kwargs: dict[str, Any] = kwargs self._configure(kwargs, dont_fail=dont_fail) def _configure(self, options: dict[str, Any], dont_fail: bool = False) -> None: """Configure the exporter by popping options...
BaseItemExporter
python
google__jax
jax/experimental/mosaic/gpu/layout_inference.py
{ "start": 61009, "end": 73738 }
class ____: type: ir.Type layout: cs.Constant def assign_layouts(solution: dict[ValueSite, cs.Constant]) -> None: """Assigns the layouts in `solution` to the MLIR ops they belong to. This function requires that, for each MLIR op that appears in `solution`, `solution` contains a layout assignment for all of...
_TypeAndLayout
python
pytest-dev__pytest-cov
src/pytest_cov/plugin.py
{ "start": 2236, "end": 6915 }
class ____(argparse.Action): def __call__(self, parser, namespace, values, option_string=None): report_type, file = values namespace.cov_report[report_type] = file # coverage.py doesn't set a default file for markdown output_format if report_type in ['markdown', 'markdown-append'] a...
StoreReport
python
has2k1__plotnine
plotnine/scales/scale_xy.py
{ "start": 7202, "end": 7279 }
class ____(scale_y_discrete): pass @dataclass(kw_only=True)
scale_y_ordinal
python
python-pillow__Pillow
Tests/test_imagegrab.py
{ "start": 208, "end": 5499 }
class ____: @pytest.mark.skipif( os.environ.get("USERNAME") == "ContainerAdministrator", reason="can't grab screen when running in Docker", ) @pytest.mark.skipif( sys.platform not in ("win32", "darwin"), reason="requires Windows or macOS" ) def test_grab(self) -> None: ...
TestImageGrab
python
pytransitions__transitions
transitions/extensions/asyncio.py
{ "start": 7742, "end": 10410 }
class ____(Event): """A collection of transitions assigned to the same trigger""" async def trigger(self, model, *args, **kwargs): """Serially execute all transitions that match the current state, halting as soon as one successfully completes. Note that `AsyncEvent` triggers must be awaited. ...
AsyncEvent
python
huggingface__transformers
tests/models/olmo2/test_modeling_olmo2.py
{ "start": 6773, "end": 14812 }
class ____(unittest.TestCase): def setUp(self): cleanup(torch_device, gc_collect=True) def tearDown(self): cleanup(torch_device, gc_collect=True) def test_model_1b_logits_bfloat16(self): input_ids = [[1, 306, 4658, 278, 6593, 310, 2834, 338]] model = Olmo2ForCausalLM.from_p...
Olmo2IntegrationTest
python
more-itertools__more-itertools
tests/test_more.py
{ "start": 30414, "end": 32504 }
class ____(TestCase): def test_basic(self): iterable = [10, 20, 30, 11, 21, 31, 12, 22, 23, 33] D = mi.bucket(iterable, key=lambda x: 10 * (x // 10)) # In-order access self.assertEqual(list(D[10]), [10, 11, 12]) # Out of order access self.assertEqual(list(D[30]), [3...
BucketTests
python
pytorch__pytorch
torch/testing/_internal/autograd_function_db.py
{ "start": 6390, "end": 7644 }
class ____(torch.autograd.Function): @staticmethod def forward(x, dim): device = x.device x = to_numpy(x) ind = np.argsort(x, axis=dim) ind_inv = np.argsort(ind, axis=dim) return ( torch.tensor(x, device=device), torch.tensor(ind, device=device), ...
NumpySort
python
pytorch__pytorch
test/dynamo/test_fx_graph_runnable.py
{ "start": 2387, "end": 2564 }
class ____(logging.Formatter): def format(self, record): return record.payload.strip() trace_log = logging.getLogger("torch.__trace")
StructuredTracePayloadFormatter
python
coleifer__peewee
tests/extra_fields.py
{ "start": 1055, "end": 1488 }
class ____(ModelTestCase): requires = [Pickled] def test_pickle_field(self): a = {'k1': 'v1', 'k2': [0, 1, 2], 'k3': None} b = 'just a string' Pickled.create(data=a, key='a') Pickled.create(data=b, key='b') a_db = Pickled.get(Pickled.key == 'a') self.assertEqual...
TestPickleField
python
weaviate__weaviate-python-client
weaviate/rbac/models.py
{ "start": 10515, "end": 10936 }
class ____(_TenantsPermission): pass PermissionsOutputType = Union[ AliasPermissionOutput, ClusterPermissionOutput, CollectionsPermissionOutput, DataPermissionOutput, RolesPermissionOutput, UsersPermissionOutput, BackupsPermissionOutput, NodesPermissionOutput, TenantsPermission...
TenantsPermissionOutput
python
doocs__leetcode
solution/3100-3199/3102.Minimize Manhattan Distances/Solution.py
{ "start": 0, "end": 462 }
class ____: def minimumDistance(self, points: List[List[int]]) -> int: sl1 = SortedList() sl2 = SortedList() for x, y in points: sl1.add(x + y) sl2.add(x - y) ans = inf for x, y in points: sl1.remove(x + y) sl2.remove(x - y) ...
Solution
python
paramiko__paramiko
paramiko/_winapi.py
{ "start": 3634, "end": 7308 }
class ____: """ A memory map object which can have security attributes overridden. """ def __init__(self, name, length, security_attributes=None): self.name = name self.length = length self.security_attributes = security_attributes self.pos = 0 def __enter__(self): ...
MemoryMap
python
aio-libs__aiohttp
aiohttp/web_urldispatcher.py
{ "start": 14062, "end": 14863 }
class ____(AbstractResource): def __init__(self, prefix: str, *, name: str | None = None) -> None: assert not prefix or prefix.startswith("/"), prefix assert prefix in ("", "/") or not prefix.endswith("/"), prefix super().__init__(name=name) self._prefix = _requote_path(prefix) ...
PrefixResource
python
more-itertools__more-itertools
tests/test_more.py
{ "start": 21572, "end": 21942 }
class ____(TestCase): def test_with_iter(self): s = StringIO('One fish\nTwo fish') initial_words = [line.split()[0] for line in mi.with_iter(s)] # Iterable's items should be faithfully represented self.assertEqual(initial_words, ['One', 'Two']) # The file object should be cl...
WithIterTests
python
scrapy__scrapy
scrapy/middleware.py
{ "start": 916, "end": 6812 }
class ____(ABC): """Base class for implementing middleware managers""" component_name: str _compat_spider: Spider | None = None def __init__(self, *middlewares: Any, crawler: Crawler | None = None) -> None: self.crawler: Crawler | None = crawler if crawler is None: warnings...
MiddlewareManager
python
allegroai__clearml
clearml/backend_api/services/v2_9/projects.py
{ "start": 83283, "end": 88259 }
class ____(Request): """ Update project information :param project: Project id :type project: str :param name: Project name. Unique within the company. :type name: str :param description: Project description :type description: str :param tags: User-defined tags list :type tags: ...
UpdateRequest
python
getsentry__sentry
src/sentry/web/frontend/auth_channel_login.py
{ "start": 568, "end": 3271 }
class ____(AuthOrganizationLoginView): @method_decorator(never_cache) def handle(self, request, channel, resource_id): # type: ignore[override] # intentional signature change if request.subdomain is not None: return self.redirect(reverse("sentry-auth-organization", args=[request.subdomain]...
AuthChannelLoginView
python
pypa__pip
tests/unit/test_build_constraints.py
{ "start": 352, "end": 4271 }
class ____: """Test SubprocessBuildEnvironmentInstaller build constraints functionality.""" @mock.patch.dict(os.environ, {}, clear=True) def test_deprecation_check_no_pip_constraint(self) -> None: """Test no deprecation warning when PIP_CONSTRAINT is not set.""" finder = make_test_finder() ...
TestSubprocessBuildEnvironmentInstaller
python
ansible__ansible
test/units/parsing/test_dataloader.py
{ "start": 7406, "end": 12328 }
class ____(unittest.TestCase): def setUp(self): self._loader = DataLoader() vault_secrets = [('default', TextVaultSecret('ansible'))] self._loader.set_vault_secrets(vault_secrets) self.test_vault_data_path = os.path.join(os.path.dirname(__file__), 'fixtures', 'vault.yml') def t...
TestDataLoaderWithVault
python
langchain-ai__langchain
libs/langchain/langchain_classic/output_parsers/combining.py
{ "start": 220, "end": 1980 }
class ____(BaseOutputParser[dict[str, Any]]): """Combine multiple output parsers into one.""" parsers: list[BaseOutputParser] @classmethod @override def is_lc_serializable(cls) -> bool: return True @pre_init def validate_parsers(cls, values: dict[str, Any]) -> dict[str, Any]: ...
CombiningOutputParser
python
charliermarsh__ruff
scripts/ty_benchmark/src/benchmark/venv.py
{ "start": 107, "end": 2597 }
class ____: project_path: Path def __init__(self, path: Path): self.project_path = path @property def path(self) -> Path: return self.project_path / "venv" @property def name(self) -> str: """The name of the virtual environment directory.""" return self.path.na...
Venv
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/dialects/oracle/cx_oracle.py
{ "start": 24040, "end": 24162 }
class ____(sqltypes.Unicode): def get_dbapi_type(self, dbapi): return dbapi.LONG_STRING
_OracleUnicodeStringCHAR
python
walkccc__LeetCode
solutions/2423. Remove Letter To Equalize Frequency/2423.py
{ "start": 0, "end": 404 }
class ____: def equalFrequency(self, word: str) -> bool: count = collections.Counter(word) # Try to remove each letter, then check if the frequency of all the letters # in `word` are equal. for c in word: count[c] -= 1 if count[c] == 0: del count[c] if min(count.values()) ==...
Solution
python
pypa__pipenv
pipenv/patched/pip/_internal/models/link.py
{ "start": 1031, "end": 3125 }
class ____: """Links to content may have embedded hash values. This class parses those. `name` must be any member of `_SUPPORTED_HASHES`. This class can be converted to and from `ArchiveInfo`. While ArchiveInfo intends to be JSON-serializable to conform to PEP 610, this class contains the logic for ...
LinkHash
python
spack__spack
var/spack/test_repos/spack_repo/builtin_mock/packages/attributes_foo_app/package.py
{ "start": 222, "end": 324 }
class ____(BundlePackage): version("1.0") depends_on("bar") depends_on("baz")
AttributesFooApp
python
getsentry__sentry
src/sentry/snuba/metrics/fields/base.py
{ "start": 12718, "end": 16193 }
class ____(MetricOperation): def validate_can_orderby(self) -> None: return def validate_can_groupby(self) -> bool: return False def validate_can_filter(self) -> bool: return False def get_meta_type(self) -> str | None: # If we have a percentile operation then we want ...
RawOp
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 987119, "end": 987615 }
class ____(sgqlc.types.Type): """Required status check""" __schema__ = github_schema __field_names__ = ("context", "integration_id") context = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name="context") """The status check context name that must be present on the commit.""" integra...
StatusCheckConfiguration
python
huggingface__transformers
src/transformers/models/sam_hq/configuration_sam_hq.py
{ "start": 8600, "end": 11780 }
class ____(PreTrainedConfig): r""" This is the configuration class to store the configuration of a [`SamHQMaskDecoder`]. It is used to instantiate a SAM_HQ mask decoder to the specified arguments, defining the model architecture. Instantiating a configuration defaults will yield a similar configuration ...
SamHQMaskDecoderConfig
python
kamyu104__LeetCode-Solutions
Python/latest-time-by-replacing-hidden-digits.py
{ "start": 29, "end": 591 }
class ____(object): def maximumTime(self, time): """ :type time: str :rtype: str """ result = list(time) for i, c in enumerate(time): if c != "?": continue if i == 0: result[i] = '2' if result[i+1] in "?0123" el...
Solution
python
getsentry__sentry
src/sentry/incidents/endpoints/serializers/query_subscription.py
{ "start": 349, "end": 1350 }
class ____(Serializer): def get_attrs( self, item_list: Sequence[SnubaQuery], user, **kwargs ) -> MutableMapping[SnubaQuery, dict[str, Any]]: prefetch_related_objects(item_list, "environment", "snubaqueryeventtype_set") return {} def serialize( self, obj: SnubaQuery, attrs: ...
SnubaQuerySerializer
python
pytorch__pytorch
test/nn/test_dropout.py
{ "start": 3491, "end": 13656 }
class ____(NNTestCase): def _test_dropout(self, cls, device, input, memory_format=torch.contiguous_format): p = 0.2 input = input.to(device).fill_(1 - p) module = cls(p) input_var = input.clone(memory_format=memory_format).requires_grad_() output = module(input_var) ...
TestDropoutNNDeviceType
python
ethereum__web3.py
web3/types.py
{ "start": 5887, "end": 5984 }
class ____(SubscriptionResponse): result: HexBytes | TxData
TransactionTypeSubscriptionResponse
python
more-itertools__more-itertools
tests/test_more.py
{ "start": 65526, "end": 66743 }
class ____(TestCase): """Tests for ``stagger()``""" def test_default(self): iterable = [0, 1, 2, 3] actual = list(mi.stagger(iterable)) expected = [(None, 0, 1), (0, 1, 2), (1, 2, 3)] self.assertEqual(actual, expected) def test_offsets(self): iterable = [0, 1, 2, 3]...
StaggerTest
python
catalyst-team__catalyst
examples/engines/train_resnet.py
{ "start": 1406, "end": 4792 }
class ____(dl.IRunner): def __init__(self, logdir: str, engine: str, **engine_params: Any): super().__init__() self._logdir = logdir self._engine = engine self._engine_params = engine_params def get_engine(self): return E2E[self._engine](**self._engine_params) def g...
CustomRunner
python
allegroai__clearml
clearml/backend_api/services/v2_9/models.py
{ "start": 27028, "end": 28077 }
class ____(Response): """ Response of models.delete endpoint. :param deleted: Indicates whether the model was deleted :type deleted: bool """ _service = "models" _action = "delete" _version = "2.9" _schema = { "definitions": {}, "properties": { "deleted"...
DeleteResponse
python
geekcomputers__Python
venv/Lib/site-packages/pip/_vendor/pygments/formatters/latex.py
{ "start": 4972, "end": 16227 }
class ____(Formatter): r""" Format tokens as LaTeX code. This needs the `fancyvrb` and `color` standard packages. Without the `full` option, code is formatted as one ``Verbatim`` environment, like this: .. sourcecode:: latex \begin{Verbatim}[commandchars=\\\{\}] \PY{k}{def }\P...
LatexFormatter
python
django-guardian__django-guardian
guardian/testapp/models.py
{ "start": 927, "end": 1073 }
class ____(GroupObjectPermissionAbstract): class Meta(GroupObjectPermissionAbstract.Meta): abstract = False
GenericGroupObjectPermission
python
simonw__datasette
datasette/filters.py
{ "start": 7201, "end": 8443 }
class ____(Filter): def __init__( self, key, display, sql_template, human_template, format="{}", numeric=False, no_argument=False, ): self.key = key self.display = display self.sql_template = sql_template self.human_...
TemplatedFilter
python
patrick-kidger__equinox
equinox/nn/_stateful.py
{ "start": 3326, "end": 13746 }
class ____: """Stores the state of a model. For example, the running statistics of all [`equinox.nn.BatchNorm`][] layers in the model. This is essentially a dictionary mapping from [`equinox.nn.StateIndex`][]s to PyTrees of arrays. This class should be initialised via [`equinox.nn.make_with_state`...
State
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 519916, "end": 520815 }
class ____(sgqlc.types.Type): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("field", "reviewers") field = sgqlc.types.Field( sgqlc.types.non_null("ProjectV2FieldConfiguration"), graphql_name="field" ) reviewers = sgqlc.types.Field( ...
ProjectV2ItemFieldReviewerValue
python
spack__spack
var/spack/test_repos/spack_repo/duplicates_test/packages/pkg_config/package.py
{ "start": 216, "end": 517 }
class ____(Package): """A package providing a virtual, which is frequently used as a pure build dependency.""" homepage = "http://www.example.com" url = "http://www.example.com/tdep-1.0.tar.gz" version("1.0.0", md5="0123456789abcdef0123456789abcdef") provides("pkgconfig")
PkgConfig
python
Textualize__textual
src/textual/scroll_view.py
{ "start": 360, "end": 6447 }
class ____(ScrollableContainer): """ A base class for a Widget that handles its own scrolling (i.e. doesn't rely on the compositor to render children). !!! note This is the typically wrong class for making something scrollable. If you want to make something scroll, set its `overflow` s...
ScrollView
python
PyCQA__pylint
tests/functional/c/classes_meth_could_be_a_function.py
{ "start": 206, "end": 235 }
class ____(XAsub): pass
XBsub
python
doocs__leetcode
solution/0300-0399/0322.Coin Change/Solution.py
{ "start": 0, "end": 436 }
class ____: def coinChange(self, coins: List[int], amount: int) -> int: m, n = len(coins), amount f = [[inf] * (n + 1) for _ in range(m + 1)] f[0][0] = 0 for i, x in enumerate(coins, 1): for j in range(n + 1): f[i][j] = f[i - 1][j] if j >= ...
Solution