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
huggingface__transformers
src/transformers/models/wav2vec2_conformer/modeling_wav2vec2_conformer.py
{ "start": 15586, "end": 17754 }
class ____(nn.Module): """Convolution block used in the conformer block""" def __init__(self, config): super().__init__() if (config.conv_depthwise_kernel_size - 1) % 2 == 1: raise ValueError("`config.conv_depthwise_kernel_size` should be a odd number for 'SAME' padding") se...
Wav2Vec2ConformerConvolutionModule
python
fsspec__filesystem_spec
fsspec/exceptions.py
{ "start": 64, "end": 220 }
class ____(ValueError): """ Raised when a cached file is opened with a different blocksize than it was written with """
BlocksizeMismatchError
python
apache__airflow
providers/amazon/tests/unit/amazon/aws/waiters/test_eks.py
{ "start": 1023, "end": 2513 }
class ____: def test_service_waiters(self): hook = EksHook() with open(hook.waiter_path) as config_file: expected_waiters = json.load(config_file)["waiters"] for waiter in list(expected_waiters.keys()): assert waiter in hook.list_waiters() assert waiter i...
TestCustomEKSServiceWaiters
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_chart_format13.py
{ "start": 315, "end": 1557 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("chart_format13.xlsx") def test_create_file(self): """Test the creation of an XlsxWriter file with chart formatting.""" workbook = ...
TestCompareXLSXFiles
python
django__django
tests/basic/models.py
{ "start": 1546, "end": 1612 }
class ____(PrimaryKeyWithDefault): pass
ChildPrimaryKeyWithDefault
python
ansible__ansible
lib/ansible/galaxy/collection/gpg.py
{ "start": 4667, "end": 5064 }
class ____(GpgBaseError): """"It was not possible to check the signature. This may be caused by a missing public key or an unsupported algorithm. A RC of 4 indicates unknown algorithm, a 9 indicates a missing public key. """ keyid: str pkalgo: int hashalgo: int sig_class: str t...
GpgErrSig
python
readthedocs__readthedocs.org
readthedocs/projects/migrations/0034_remove_unused_project_model_fields.py
{ "start": 121, "end": 1261 }
class ____(migrations.Migration): safe = Safe.after_deploy() dependencies = [ ("projects", "0033_add_environment_variables"), ] operations = [ migrations.RemoveField( model_name="project", name="copyright", ), migrations.RemoveField( m...
Migration
python
pypa__setuptools
setuptools/_vendor/backports/tarfile/__init__.py
{ "start": 9841, "end": 9951 }
class ____(TarError): """Exception for unsupported operations on stream-like TarFiles.""" pass
StreamError
python
doocs__leetcode
solution/2400-2499/2477.Minimum Fuel Cost to Report to the Capital/Solution.py
{ "start": 0, "end": 523 }
class ____: def minimumFuelCost(self, roads: List[List[int]], seats: int) -> int: def dfs(a: int, fa: int) -> int: nonlocal ans sz = 1 for b in g[a]: if b != fa: t = dfs(b, a) ans += ceil(t / seats) ...
Solution
python
ray-project__ray
python/ray/train/v2/_internal/execution/callback.py
{ "start": 6369, "end": 6743 }
class ____(RayTrainCallback): """ Callbacks that are hooked to the train context event. These callbacks are created on the train driver process and then copied and passed to all the workers. The execution of these callbacks happens on the train context of the workers. """ @contextmanager ...
TrainContextCallback
python
huggingface__transformers
src/transformers/models/glm4v_moe/modeling_glm4v_moe.py
{ "start": 26766, "end": 28083 }
class ____(PreTrainedModel): config: Glm4vMoeConfig base_model_prefix = "model" supports_gradient_checkpointing = True _no_split_modules = ["Glm4vMoeTextDecoderLayer", "Glm4vMoeVisionBlock"] _skip_keys_device_placement = "past_key_values" _supports_flash_attn = True _supports_sdpa = True ...
Glm4vMoePreTrainedModel
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/array_ops/array_ops_test.py
{ "start": 44979, "end": 46265 }
class ____(test_lib.Benchmark): """Benchmark new strided slice operation on non-trivial case.""" def run_and_time(self, slice_op): self.evaluate(variables.global_variables_initializer()) for _ in range(10): _ = self.evaluate(slice_op) iters = 1000 t0 = time.time() for _ in range(iters): ...
StridedSliceBenchmark
python
doocs__leetcode
solution/3100-3199/3157.Find the Level of Tree with Minimum Sum/Solution.py
{ "start": 192, "end": 729 }
class ____: def minimumLevel(self, root: Optional[TreeNode]) -> int: q = deque([root]) ans = 0 level, s = 1, inf while q: t = 0 for _ in range(len(q)): node = q.popleft() t += node.val if node.left: ...
Solution
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/roots/mutation.py
{ "start": 21385, "end": 21822 }
class ____(graphene.Union): """The output from reloading a code location server.""" class Meta: types = ( GrapheneWorkspaceLocationEntry, GrapheneReloadNotSupported, GrapheneRepositoryLocationNotFound, GrapheneUnauthorizedError, GraphenePython...
GrapheneReloadRepositoryLocationMutationResult
python
django-extensions__django-extensions
django_extensions/management/commands/raise_test_exception.py
{ "start": 175, "end": 635 }
class ____(BaseCommand): help = ( "Raises a test Exception named DjangoExtensionsTestException. " "Useful for debugging integration with error reporters like Sentry." ) @signalcommand def handle(self, *args, **options): message = ( "This is a test exception via the "...
Command
python
pytorch__pytorch
torch/testing/_internal/opinfo/refs.py
{ "start": 4301, "end": 5579 }
class ____(ReductionOpInfo): """ An OpInfo for a Python reference of an elementwise unary operation. """ def __init__( self, name, # the stringname of the callable Python reference *, op=None, # the function variant of the operation, populated as torch.<name> if None ...
ReductionPythonRefInfo
python
ray-project__ray
rllib/evaluation/tests/test_rollout_worker.py
{ "start": 2403, "end": 2715 }
class ____(gym.Env): def __init__(self): self.observation_space = gym.spaces.Discrete(1) self.action_space = gym.spaces.Discrete(2) def reset(self, *, seed=None, options=None): raise ValueError("kaboom") def step(self, action): raise ValueError("kaboom")
FailOnStepEnv
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/annotated2.py
{ "start": 225, "end": 262 }
class ____: ... def func1(): ...
ClassA
python
kamyu104__LeetCode-Solutions
Python/minimum-amount-of-time-to-collect-garbage.py
{ "start": 100, "end": 738 }
class ____(object): def garbageCollection(self, garbage, travel): """ :type garbage: List[str] :type travel: List[int] :rtype: int """ result = 0 lookup = {} for i in xrange(len(garbage)): for c in garbage[i]: lookup[c] = i ...
Solution
python
pallets__click
src/click/types.py
{ "start": 20018, "end": 20164 }
class ____(_NumberParamTypeBase): name = "float" _number_class = float def __repr__(self) -> str: return "FLOAT"
FloatParamType
python
getsentry__sentry
tests/sentry/models/test_project.py
{ "start": 36722, "end": 37593 }
class ____(TestCase): def test_hybrid_cloud_deletion(self) -> None: proj = self.create_project() user = self.create_user() proj_id = proj.id with assume_test_silo_mode(SiloMode.CONTROL): UserOption.objects.set_value(user, "cool_key", "Hello!", project_id=proj.id) ...
ProjectDeletionTest
python
HypothesisWorks__hypothesis
hypothesis-python/tests/cover/test_lookup.py
{ "start": 33615, "end": 37168 }
class ____: def __init__(self, foo: bool | None = None): self.foo = foo def test_from_type_can_be_default_or_annotation(): find_any(st.from_type(AnnotatedAndDefault), lambda x: x.foo is None) find_any(st.from_type(AnnotatedAndDefault), lambda x: isinstance(x.foo, bool)) @pytest.mark.parametrize(...
AnnotatedAndDefault
python
apache__airflow
providers/amazon/src/airflow/providers/amazon/aws/operators/sagemaker.py
{ "start": 60359, "end": 64891 }
class ____(SageMakerBaseOperator): """ Starts a SageMaker pipeline execution. .. seealso:: For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:SageMakerStartPipelineOperator` :param config: The configuration to start the pipeline execution. ...
SageMakerStartPipelineOperator
python
django__django
django/contrib/gis/serializers/geojson.py
{ "start": 218, "end": 2732 }
class ____(JSONSerializer): """ Convert a queryset to GeoJSON, http://geojson.org/ """ def _init_options(self): super()._init_options() self.geometry_field = self.json_kwargs.pop("geometry_field", None) self.id_field = self.json_kwargs.pop("id_field", None) self.srid = s...
Serializer
python
Pylons__pyramid
tests/test_paster.py
{ "start": 107, "end": 1435 }
class ____(unittest.TestCase): def _callFUT(self, config_file, section_name, options=None, _loader=None): import pyramid.paster old_loader = pyramid.paster.get_config_loader try: if _loader is not None: pyramid.paster.get_config_loader = _loader retur...
Test_get_app
python
encode__django-rest-framework
tests/test_one_to_one_with_inheritance.py
{ "start": 603, "end": 772 }
class ____(serializers.ModelSerializer): class Meta: model = ChildAssociatedModel fields = ['id', 'child_name'] # Tests
ChildAssociatedModelSerializer
python
keon__algorithms
algorithms/tree/bst/BSTIterator.py
{ "start": 1, "end": 459 }
class ____: def __init__(self, root): self.stack = [] while root: self.stack.append(root) root = root.left def has_next(self): return bool(self.stack) def next(self): node = self.stack.pop() tmp = node if tmp.right: tmp = ...
BSTIterator
python
django-import-export__django-import-export
tests/scripts/bulk_import.py
{ "start": 431, "end": 5342 }
class ____(resources.ModelResource): class Meta: model = Book fields = ("id", "name", "author_email", "price") use_bulk = True batch_size = 1000 skip_unchanged = True # skip_diff = True # This flag can speed up imports # Cannot be used when performing ...
_BookResource
python
huggingface__transformers
tests/models/mllama/test_image_processing_mllama.py
{ "start": 1100, "end": 5466 }
class ____: def __init__( self, parent, batch_size=7, num_channels=3, image_size=18, num_images=18, min_resolution=30, max_resolution=400, do_resize=True, size=None, do_rescale=True, rescale_factor=1 / 255, do_no...
MllamaImageProcessingTester
python
fabric__fabric
tests/task.py
{ "start": 1058, "end": 3072 }
class ____: def accepts_Invoke_level_kwargs(self): # Arbitrarily selected list of invoke-level kwargs... def body(c, parts): "I am a docstring" pass # Faux @task() t = fabric.task( name="dadbod", aliases=["heavenly", "check", "shop"], ...
task_
python
pytorch__pytorch
benchmarks/operator_benchmark/pt/remainder_test.py
{ "start": 841, "end": 1654 }
class ____(op_bench.TorchBenchmarkBase): def init(self, M, N, K, device, dtype, op_func): self.dividend = torch.rand(M, N, K, device=device) self.dividend = (self.dividend * 1000 - 500).to(dtype=dtype) self.divisor = torch.rand(M, N, K, device=device) # +1 so we don't divide by zero...
RemainderOpBenchmark
python
openai__openai-python
src/openai/types/vector_store_create_params.py
{ "start": 1574, "end": 1894 }
class ____(TypedDict, total=False): anchor: Required[Literal["last_active_at"]] """Anchor timestamp after which the expiration policy applies. Supported anchors: `last_active_at`. """ days: Required[int] """The number of days after the anchor time that the vector store will expire."""
ExpiresAfter
python
joke2k__faker
faker/providers/currency/en_AU/__init__.py
{ "start": 46, "end": 279 }
class ____(CurrencyProvider): price_formats = ["#.##", "%#.##", "%##.##", "%,###.##", "%#,###.##"] def pricetag(self) -> str: return "$\N{NO-BREAK SPACE}" + self.numerify(self.random_element(self.price_formats))
Provider
python
realpython__materials
python-raise-exception/api.py
{ "start": 18, "end": 365 }
class ____(Exception): pass def call_external_api(url): try: response = requests.get(url) response.raise_for_status() data = response.json() except requests.RequestException as error: raise APIError(f"{error}") from None return data print(call_external_api("https://ap...
APIError
python
matplotlib__matplotlib
lib/mpl_toolkits/axisartist/axis_artist.py
{ "start": 21713, "end": 38340 }
class ____(martist.Artist): """ An artist which draws axis (a line along which the n-th axes coord is constant) line, ticks, tick labels, and axis label. """ zorder = 2.5 @property def LABELPAD(self): return self.label.get_pad() @LABELPAD.setter def LABELPAD(self, v): ...
AxisArtist
python
huggingface__transformers
src/transformers/image_utils.py
{ "start": 2351, "end": 2658 }
class ____(ExplicitEnum): COCO_DETECTION = AnnotationFormat.COCO_DETECTION.value COCO_PANOPTIC = AnnotationFormat.COCO_PANOPTIC.value AnnotationType = dict[str, Union[int, str, list[dict]]] def is_pil_image(img): return is_vision_available() and isinstance(img, PIL.Image.Image)
AnnotionFormat
python
python__mypy
mypyc/irbuild/for_helpers.py
{ "start": 20320, "end": 22389 }
class ____: """Abstract base class for generating for loops.""" def __init__( self, builder: IRBuilder, index: Lvalue, body_block: BasicBlock, loop_exit: BasicBlock, line: int, nested: bool, ) -> None: self.builder = builder self.index...
ForGenerator
python
pyca__cryptography
tests/x509/test_x509_ext.py
{ "start": 101975, "end": 104727 }
class ____: def test_invalid_access_method(self): with pytest.raises(TypeError): x509.AccessDescription( "notanoid", # type:ignore[arg-type] x509.DNSName("test"), ) def test_invalid_access_location(self): with pytest.raises(TypeError): ...
TestAccessDescription
python
langchain-ai__langchain
libs/langchain/langchain_classic/model_laboratory.py
{ "start": 398, "end": 4035 }
class ____: """A utility to experiment with and compare the performance of different models.""" def __init__(self, chains: Sequence[Chain], names: list[str] | None = None): """Initialize the ModelLaboratory with chains to experiment with. Args: chains: A sequence of chains to exper...
ModelLaboratory
python
tensorflow__tensorflow
third_party/xla/xla/backends/cpu/testlib/elemental_kernel_emitter_test.py
{ "start": 1798, "end": 4403 }
class ____: op: HloOpcode np_op: Callable[[np.ndarray, ...], np.ndarray] input_ranges: tuple[float, float] = (-1.0, 1.0) decimal_precision: int = 6 # For simple unpacking def __iter__(self): return iter( (self.op, self.np_op, self.input_ranges, self.decimal_precision) ) def __repr__(self...
ElementalHloOpcodeDef
python
huggingface__transformers
src/transformers/models/nanochat/modular_nanochat.py
{ "start": 5333, "end": 7918 }
class ____(LlamaModel): def __init__(self, config: NanoChatConfig): super().__init__(config) self.norm = NanoChatRMSNorm(eps=config.rms_norm_eps) def forward( self, input_ids: Optional[torch.LongTensor] = None, attention_mask: Optional[torch.Tensor] = None, posi...
NanoChatModel
python
sphinx-doc__sphinx
sphinx/addnodes.py
{ "start": 1463, "end": 1577 }
class ____: """A node which does not support smart-quotes.""" support_smartquotes = False
not_smartquotable
python
optuna__optuna
optuna/samplers/nsgaii/_crossovers/_uniform.py
{ "start": 214, "end": 1760 }
class ____(BaseCrossover): """Uniform Crossover operation used by :class:`~optuna.samplers.NSGAIISampler`. Select each parameter with equal probability from the two parent individuals. For further information about uniform crossover, please refer to the following paper: - `Gilbert Syswerda. 1989. Unif...
UniformCrossover
python
pytorch__pytorch
torch/_export/db/examples/tensor_setattr.py
{ "start": 42, "end": 337 }
class ____(torch.nn.Module): """ setattr() call onto tensors is not supported. """ def forward(self, x, attr): setattr(x, attr, torch.randn(3, 2)) return x + 4 example_args = (torch.randn(3, 2), "attr") tags = {"python.builtin"} model = TensorSetattr()
TensorSetattr
python
spack__spack
var/spack/test_repos/spack_repo/builtin_mock/packages/dependent_of_dev_build/package.py
{ "start": 218, "end": 559 }
class ____(Package): homepage = "example.com" url = "fake.com" version("0.0.0", sha256="0123456789abcdef0123456789abcdef") depends_on("dev-build-test-install") def install(self, spec, prefix): with open(prefix.filename, "w", encoding="utf-8") as f: f.write("This file is instal...
DependentOfDevBuild
python
dagster-io__dagster
python_modules/automation/automation_tests/dagster_docs_tests/test_common_errors.py
{ "start": 5083, "end": 7259 }
class ____: """Test detection of malformed parameter descriptions.""" # Using function-based validation approach def test_missing_parameter_descriptions(self): """Test detection of parameters without descriptions.""" docstring = '''"""Function with missing parameter descriptions. ...
TestParameterDescriptionErrors
python
getsentry__sentry
tests/sentry/pipeline/test_pipeline.py
{ "start": 1095, "end": 1743 }
class ____(Pipeline[Never, PipelineSessionStore]): pipeline_name = "test_pipeline" def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.finished = False self.dispatch_count = 0 @cached_property def provider(self) -> DummyProvider: ret = {"dummy": ...
DummyPipeline
python
plotly__plotly.py
_plotly_utils/png.py
{ "start": 42784, "end": 44085 }
class ____: """A PNG image. You can create an :class:`Image` object from an array of pixels by calling :meth:`png.from_array`. It can be saved to disk with the :meth:`save` method. """ def __init__(self, rows, info): """ .. note :: The constructor is not public. Please...
Image
python
cython__cython
Cython/Debugger/Tests/test_libcython_in_gdb.py
{ "start": 906, "end": 1143 }
class ____(type): def __init__(self, name, bases, dict): for func_name, func in dict.items(): if inspect.isfunction(func): setattr(self, func_name, print_on_call_decorator(func))
TraceMethodCallMeta
python
numpy__numpy
benchmarks/benchmarks/bench_core.py
{ "start": 4442, "end": 5149 }
class ____(Benchmark): params = [ [bool, np.uint8, np.uint64, np.int64, np.float32, np.float64], [(1_000_000,), (1000, 1000), (100, ), (2, )] ] param_names = ["dtype", "shape"] def setup(self, dtype, size): self.x = np.random.randint(0, 3, size=size).astype(dtype) self.x...
Nonzero
python
Delgan__loguru
loguru/_simple_sinks.py
{ "start": 3244, "end": 5957 }
class ____: """A sink that handles asynchronous logging operations. Parameters ---------- function The async function to execute. loop The event loop to use. error_interceptor An interceptor for handling errors. """ def __init__(self, function, loop, error_inter...
AsyncSink
python
spack__spack
lib/spack/spack/repo.py
{ "start": 80367, "end": 80742 }
class ____(UnknownEntityError): """Raised when we encounter an unknown namespace""" def __init__(self, namespace, name=None): msg, long_msg = f"Unknown namespace: {namespace}", None if name == "yaml": long_msg = f"Did you mean to specify a filename with './{namespace}.{name}'?" ...
UnknownNamespaceError
python
google__pytype
pytype/tests/test_typeguard.py
{ "start": 111, "end": 789 }
class ____(test_base.BaseTest): """Tests for typing_extensions.TypeGuard.""" def test_typing_extensions(self): self.Check(""" from typing_extensions import TypeGuard def is_str_list(val: list[object]) -> TypeGuard[list[str]]: return all(isinstance(x, str) for x in val) def f(val: li...
TypingExtensionsTest
python
tensorflow__tensorflow
tensorflow/python/framework/op_def_library_test.py
{ "start": 55117, "end": 55856 }
class ____(test_util.TensorFlowTestCase): def testNoGraph(self): out = op_def_library.apply_op("Simple", a=3) self.assertEqual(out.graph, ops.get_default_graph()) def testDefaultGraph(self): graph = ops.Graph() with graph.as_default(): out = op_def_library.apply_op("Simple", a=3) self....
OpDefLibraryGraphTest
python
facebookresearch__faiss
tests/test_binary_hashindex.py
{ "start": 3490, "end": 5821 }
class ____(unittest.TestCase): def test_hash_and_multihash(self): d = 128 nq = 100 nb = 2000 (_, xb, xq) = make_binary_dataset(d, 0, nb, nq) index_ref = faiss.IndexBinaryFlat(d) index_ref.add(xb) k = 10 Dref, Iref = index_ref.search(xq, k) ...
TestKnn
python
ray-project__ray
python/ray/tune/search/ax/ax_search.py
{ "start": 992, "end": 15666 }
class ____(Searcher): """Uses `Ax <https://ax.dev/>`_ to optimize hyperparameters. Ax is a platform for understanding, managing, deploying, and automating adaptive experiments. Ax provides an easy to use interface with BoTorch, a flexible, modern library for Bayesian optimization in PyTorch. More i...
AxSearch
python
doocs__leetcode
solution/1200-1299/1237.Find Positive Integer Solution for a Given Equation/Solution.py
{ "start": 349, "end": 723 }
class ____: def findSolution(self, customfunction: "CustomFunction", z: int) -> List[List[int]]: ans = [] for x in range(1, z + 1): y = 1 + bisect_left( range(1, z + 1), z, key=lambda y: customfunction.f(x, y) ) if customfunction.f(x, y) == z: ...
Solution
python
paramiko__paramiko
tests/test_config.py
{ "start": 34572, "end": 36074 }
class ____: # NOTE: this is still a cherry-pick of a few levels of complexity, there's # no point testing literally all possible combinations. def test_originalhost_host(self): result = load_config("match-complex").lookup("target") assert result["hostname"] == "bogus" assert result[...
TestComplexMatching
python
fastapi__sqlmodel
docs_src/tutorial/fastapi/multiple_models/tutorial002.py
{ "start": 411, "end": 1271 }
class ____(HeroBase): id: int sqlite_file_name = "database.db" sqlite_url = f"sqlite:///{sqlite_file_name}" connect_args = {"check_same_thread": False} engine = create_engine(sqlite_url, echo=True, connect_args=connect_args) def create_db_and_tables(): SQLModel.metadata.create_all(engine) app = FastAPI()...
HeroPublic
python
pydantic__pydantic
pydantic/v1/types.py
{ "start": 10640, "end": 13028 }
class ____(str): strip_whitespace = False to_upper = False to_lower = False min_length: OptionalInt = None max_length: OptionalInt = None curtail_length: OptionalInt = None regex: Optional[Union[str, Pattern[str]]] = None strict = False @classmethod def __modify_schema__(cls, fi...
ConstrainedStr
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 661346, "end": 661777 }
class ____(sgqlc.types.Type): """Autogenerated return type of FollowUser""" __schema__ = github_schema __field_names__ = ("client_mutation_id", "user") client_mutation_id = sgqlc.types.Field(String, graphql_name="clientMutationId") """A unique identifier for the client performing the mutation.""" ...
FollowUserPayload
python
encode__django-rest-framework
tests/models.py
{ "start": 908, "end": 1011 }
class ____(RESTFrameworkModel): users = models.ManyToManyField(User) # ForeignKey
BasicModelWithUsers
python
tensorflow__tensorflow
tensorflow/python/eager/remote_cloud_tpu_test.py
{ "start": 1993, "end": 2997 }
class ____(absltest.TestCase): """Test that we can connect to a real Cloud TPU.""" def test_connect(self): # Log full diff on failure. self.maxDiff = None # pylint:disable=invalid-name self.assertCountEqual( EXPECTED_DEVICES_PRE_CONNECT, [device.name for device in config.list_logical_...
RemoteCloudTPUTest
python
getsentry__sentry
src/sentry/auth/helper.py
{ "start": 3400, "end": 26929 }
class ____: # SSO auth handler auth_provider: AuthProvider provider: Provider organization: RpcOrganization request: HttpRequest identity: Mapping[str, Any] referrer: str | None = "in-app" @cached_property def user(self) -> User | AnonymousUser: email = self.identity.get("e...
AuthIdentityHandler
python
great-expectations__great_expectations
tests/expectations/metrics/conftest.py
{ "start": 466, "end": 606 }
class ____: def __init__(self, dialect: Dialect): self.dialect = dialect def connect(self) -> None: pass
MockSaEngine
python
pytorch__pytorch
torch/_inductor/codegen/cuda/cuda_cpp_scheduling.py
{ "start": 832, "end": 977 }
class ____(WhyNoFuse): def __init__(self, name1: str, name2: str) -> None: self.name1 = name1 self.name2 = name2
WhyNoFuseNames
python
scipy__scipy
scipy/stats/_multivariate.py
{ "start": 123449, "end": 127084 }
class ____(multi_rv_frozen): __class_getitem__ = None def __init__(self, df, scale, seed=None): """Create a frozen inverse Wishart distribution. Parameters ---------- df : array_like Degrees of freedom of the distribution scale : array_like Scale...
invwishart_frozen
python
plotly__plotly.py
plotly/graph_objs/scatterternary/unselected/_textfont.py
{ "start": 233, "end": 2618 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "scatterternary.unselected" _path_str = "scatterternary.unselected.textfont" _valid_props = {"color"} @property def color(self): """ Sets the text font color of unselected points, applied only when a selection exists. ...
Textfont
python
pandas-dev__pandas
asv_bench/benchmarks/io/csv.py
{ "start": 5049, "end": 5569 }
class ____(BaseIO): fname = "__test__.csv" timeout = 1500 params = [1000, 10000, 100000] param_names = ["nobs"] def setup(self, nobs): d = "2018-11-29" dt = "2018-11-26 11:18:27.0" self.data = DataFrame( { "dt": [np.datetime64(dt)] * nobs, ...
ToCSVDatetimeBig
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/orm/descriptor_props.py
{ "start": 32648, "end": 34541 }
class ____(DescriptorProperty[_T]): """A 'do nothing' :class:`.MapperProperty` that disables an attribute on a concrete subclass that is only present on the inherited mapper, not the concrete classes' mapper. Cases where this occurs include: * When the superclass mapper is mapped against a "...
ConcreteInheritedProperty
python
django__django
tests/admin_inlines/admin.py
{ "start": 6717, "end": 6808 }
class ____(admin.ModelAdmin): inlines = [ReadOnlyChapterInline]
NovelReadonlyChapterAdmin
python
HypothesisWorks__hypothesis
hypothesis-python/tests/cover/test_type_lookup.py
{ "start": 7624, "end": 8834 }
class ____: __init__ = "Hello!" def test_uninspectable_builds(): with pytest.raises(TypeError, match="object is not callable"): check_can_generate_examples(st.builds(BrokenClass)) def test_uninspectable_from_type(): with pytest.raises(TypeError, match="object is not callable"): check_can...
BrokenClass
python
sqlalchemy__sqlalchemy
test/orm/test_syntax_extensions.py
{ "start": 787, "end": 1054 }
class ____(SyntaxExtension, ClauseElement): _traverse_internals = [] def apply_to_select(self, select_stmt): select_stmt.apply_syntax_extension_point( lambda existing: [*existing, self], "post_select", )
PostSelectClause
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/protocol3.py
{ "start": 3221, "end": 3737 }
class ____: x: str = "" # This should generate an error because named tuple # attributes are immutable. p9_1: Proto9 = NT9() # This should generate an error because frozen dataclass # attributes are immutable. p9_2: Proto9 = DCFrozen9() p9_3: Proto9 = DC9() # This should generate an error because named tuple #...
DCFrozen9
python
streamlit__streamlit
lib/streamlit/watcher/event_based_path_watcher.py
{ "start": 8600, "end": 9165 }
class ____: """Emits notifications when a single path is modified.""" def __init__( self, md5: str, modification_time: float, *, # keyword-only arguments: glob_pattern: str | None = None, allow_nonexistent: bool = False, ) -> None: self.md5 = md5 ...
WatchedPath
python
huggingface__transformers
src/transformers/models/bamba/modeling_bamba.py
{ "start": 15938, "end": 19086 }
class ____(nn.Module): """Multi-headed attention from 'Attention Is All You Need' paper""" def __init__(self, config: BambaConfig, layer_idx: int): super().__init__() self.config = config self.layer_idx = layer_idx self.head_dim = getattr(config, "head_dim", config.hidden_size /...
BambaAttention
python
readthedocs__readthedocs.org
readthedocs/organizations/models.py
{ "start": 2045, "end": 9219 }
class ____(models.Model): """Organization model.""" # Auto fields pub_date = models.DateTimeField(_("Publication date"), auto_now_add=True) modified_date = models.DateTimeField(_("Modified date"), auto_now=True) # Foreign projects = models.ManyToManyField( "projects.Project", v...
Organization
python
python__mypy
mypyc/irbuild/nonlocalcontrol.py
{ "start": 4856, "end": 5621 }
class ____(NonlocalControl): """Abstract nonlocal control that runs some cleanup code.""" def __init__(self, outer: NonlocalControl) -> None: self.outer = outer @abstractmethod def gen_cleanup(self, builder: IRBuilder, line: int) -> None: ... def gen_break(self, builder: IRBuilder, line: ...
CleanupNonlocalControl
python
run-llama__llama_index
llama-index-integrations/llms/llama-index-llms-mymagic/llama_index/llms/mymagic/base.py
{ "start": 410, "end": 9568 }
class ____(LLM): """ MyMagicAI LLM. Examples: `pip install llama-index-llms-mymagic` ```python from llama_index.llms.mymagic import MyMagicAI llm = MyMagicAI( api_key="your-api-key", storage_provider="s3", # s3, gcs bucket_name="your-bu...
MyMagicAI
python
simonw__datasette
datasette/views/special.py
{ "start": 20633, "end": 21673 }
class ____(BaseView): name = "messages_debug" has_json_alternate = False async def get(self, request): await self.ds.ensure_permission(action="view-instance", actor=request.actor) return await self.render(["messages_debug.html"], request) async def post(self, request): await se...
MessagesDebugView
python
conda__conda
conda/plugins/types.py
{ "start": 6492, "end": 7045 }
class ____(CondaPlugin): """ Return type to use when defining a conda pre-command plugin hook. For details on how this is used, see :meth:`~conda.plugins.hookspec.CondaSpecs.conda_pre_commands`. :param name: Pre-command name (e.g., ``custom_plugin_pre_commands``). :param action: Callable which...
CondaPreCommand
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/roots/query.py
{ "start": 7889, "end": 52311 }
class ____(graphene.ObjectType): """The root for all queries to retrieve data from the Dagster instance.""" class Meta: name = "Query" version = graphene.Field( graphene.NonNull(graphene.String), description="Retrieve the version of Dagster running in the Dagster deployment.", ...
GrapheneQuery
python
ray-project__ray
python/ray/_private/thirdparty/pynvml/pynvml.py
{ "start": 64158, "end": 64335 }
class ____(_PrintableStructure): _fields_ = [ ('version', c_uint), ('bar1Size', c_ulonglong), ] VgpuTypeBar1Info_v1 = 0x1000010
c_nvmlVgpuTypeBar1Info_v1_t
python
apache__airflow
airflow-core/src/airflow/executors/workloads.py
{ "start": 2786, "end": 2979 }
class ____(BaseModel): """Schema for Callback with minimal required fields needed for Executors and Task SDK.""" id: uuid.UUID fetch_type: CallbackFetchMethod data: dict
Callback
python
getsentry__sentry
src/sentry/api/serializers/models/event.py
{ "start": 13962, "end": 18511 }
class ____(EventSerializer): """ Applies formatting to SQL queries in the serialized event. """ def __init__(self) -> None: super().__init__() self.formatted_sql_cache: dict[str, str] = {} def get_attrs(self, item_list, user, **kwargs): is_public = kwargs.pop("is_public", F...
SqlFormatEventSerializer
python
dagster-io__dagster
python_modules/libraries/dagster-airlift/dagster_airlift/core/components/airflow_instance/component.py
{ "start": 4221, "end": 4332 }
class ____(BaseModel): name: str auth_type: Literal["basic_auth", "mwaa"]
AirflowInstanceScaffolderParams
python
openai__openai-python
src/openai/resources/chat/completions/completions.py
{ "start": 2592, "end": 81258 }
class ____(SyncAPIResource): @cached_property def messages(self) -> Messages: return Messages(self._client) @cached_property def with_raw_response(self) -> CompletionsWithRawResponse: """ This property can be used as a prefix for any HTTP method call to return the raw re...
Completions
python
django__django
tests/test_runner/tests.py
{ "start": 909, "end": 1091 }
class ____: def __init__(self): self.tests = [] def addTest(self, test): self.tests.append(test) def __iter__(self): yield from self.tests
MySuite
python
doocs__leetcode
solution/0700-0799/0791.Custom Sort String/Solution.py
{ "start": 0, "end": 184 }
class ____: def customSortString(self, order: str, s: str) -> str: d = {c: i for i, c in enumerate(order)} return ''.join(sorted(s, key=lambda x: d.get(x, 0)))
Solution
python
pexpect__pexpect
pexpect/_async_w_await.py
{ "start": 2156, "end": 3802 }
class ____(asyncio.Protocol): transport = None def set_expecter(self, expecter): self.expecter = expecter self.fut = asyncio.Future() def found(self, result): if not self.fut.done(): self.fut.set_result(result) self.transport.pause_reading() def error(s...
PatternWaiter
python
openai__openai-python
src/openai/types/beta/realtime/response_create_event_param.py
{ "start": 438, "end": 886 }
class ____(TypedDict, total=False): description: str """ The description of the function, including guidance on when and how to call it, and guidance about what to tell the user when calling (if anything). """ name: str """The name of the function.""" parameters: object """Paramete...
ResponseTool
python
jazzband__django-model-utils
tests/test_models/test_status_model.py
{ "start": 2745, "end": 2971 }
class ____(StatusModelTests): def setUp(self) -> None: self.model = StatusPlainTuple self.on_hold = StatusPlainTuple.STATUS[2][0] self.active = StatusPlainTuple.STATUS[0][0]
StatusModelPlainTupleTests
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/flake8_bugbear/class_as_data_structure.py
{ "start": 72, "end": 185 }
class ____: # B903 def __init__(self, x: float, y: float) -> None: self.x = x self.y = y
Point
python
nryoung__algorithms
algorithms/data_structures/binary_search_tree.py
{ "start": 432, "end": 732 }
class ____(object): """ Implementation of a Node in a Binary Search Tree. """ def __init__(self, key=None, val=None, size_of_subtree=1): self.key = key self.val = val self.size_of_subtree = size_of_subtree self.left = None self.right = None
Node
python
apache__avro
lang/py/avro/io.py
{ "start": 7442, "end": 14558 }
class ____: """Read leaf values.""" _reader: IO[bytes] def __init__(self, reader: IO[bytes]) -> None: """ reader is a Python object on which we can call read, seek, and tell. """ self._reader = reader @property def reader(self) -> IO[bytes]: return self._re...
BinaryDecoder
python
huggingface__transformers
src/transformers/models/ministral/modular_ministral.py
{ "start": 8710, "end": 8769 }
class ____(Qwen2DecoderLayer): pass
MinistralDecoderLayer
python
apache__airflow
airflow-core/tests/unit/always/test_project_structure.py
{ "start": 40400, "end": 40936 }
class ____(ExampleCoverageTest): PROVIDER = "slack" CLASS_DIRS = ProjectStructureTest.CLASS_DIRS BASE_CLASSES = { "airflow.providers.slack.transfers.base_sql_to_slack.BaseSqlToSlackOperator", "airflow.providers.slack.operators.slack.SlackAPIOperator", } MISSING_EXAMPLES_FOR_CLASSES =...
TestSlackProviderProjectStructure
python
apache__airflow
airflow-ctl/src/airflowctl/api/datamodels/generated.py
{ "start": 31474, "end": 32182 }
class ____(BaseModel): """ XCom response serializer with string return type. """ key: Annotated[str, Field(title="Key")] timestamp: Annotated[datetime, Field(title="Timestamp")] logical_date: Annotated[datetime | None, Field(title="Logical Date")] = None map_index: Annotated[int, Field(titl...
XComResponseString
python
numpy__numpy
numpy/_typing/_nbit_base.py
{ "start": 2425, "end": 2560 }
class ____(_128Bit): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] pass @final @set_module("numpy._typing")
_96Bit
python
kubernetes-client__python
kubernetes/client/models/v1_se_linux_options.py
{ "start": 383, "end": 5755 }
class ____(object): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. """ """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attri...
V1SELinuxOptions