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
tensorflow__tensorflow
tensorflow/python/kernel_tests/math_ops/reduction_ops_test.py
{ "start": 29503, "end": 33892 }
class ____(test.TestCase): def _compare(self, x, reduction_axes, keepdims, use_gpu=False): np_ans = x if reduction_axes is None: np_ans = np.amin(np_ans, keepdims=keepdims) else: for ra in reduction_axes[::-1]: np_ans = np.amin(np_ans, axis=ra, keepdims=keepdims) with self.cached_...
MinReductionTest
python
dask__dask
dask/array/tests/test_dispatch.py
{ "start": 7200, "end": 8283 }
class ____(np.lib.mixins.NDArrayOperatorsMixin): def __array_ufunc__(self, ufunc, method, *inputs, **kwargs): outputs = kwargs.get("out", ()) for item in inputs + outputs: if hasattr(item, "__array_ufunc__") and not isinstance( item, (np.ndarray, Array, UnknownScalarThatU...
UnknownScalarThatUnderstandsArrayOps
python
realpython__materials
python-312/typing/quiz.py
{ "start": 145, "end": 502 }
class ____: question: str answer: str @classmethod def from_file(cls, path: pathlib.Path) -> Self: question, answer, *_ = path.read_text(encoding="utf-8").split("\n") return cls(question, answer) def ask(self) -> bool: answer = input(f"\n{self.question} ") return an...
Question
python
dagster-io__dagster
python_modules/libraries/dagster-shared/dagster_shared/plus/config.py
{ "start": 454, "end": 1660 }
class ____(NamedTuple): path: Path raw_config: Mapping[str, Any] plus_config: Mapping[str, Any] is_dg_config: bool DAGSTER_CLOUD_BASE_URL = "https://dagster.cloud" def _get_dagster_plus_config_path_and_raw_config() -> Optional[DagsterPlusConfigInfo]: cloud_config_path = get_dagster_cloud_cli_con...
DagsterPlusConfigInfo
python
hynek__structlog
tests/test_stdlib.py
{ "start": 31046, "end": 44837 }
class ____: """ These are all integration tests because they're all about integration. """ def test_foreign_delegate(self, capsys): """ If foreign_pre_chain is None, non-structlog log entries are delegated to logging. The processor chain's event dict is invoked with `_fr...
TestProcessorFormatter
python
qdrant__qdrant-client
qdrant_client/local/multi_distances.py
{ "start": 1917, "end": 8014 }
class ____: def __init__(self, context_pairs: list[MultiContextPair]): self.context_pairs = context_pairs MultiQueryVector = Union[ MultiDiscoveryQuery, MultiContextQuery, MultiRecoQuery, ] def calculate_multi_distance( query_matrix: types.NumpyArray, matrices: list[types.NumpyArray]...
MultiContextQuery
python
pytorch__pytorch
torch/_dynamo/variables/ctx_manager.py
{ "start": 1935, "end": 5376 }
class ____(VariableTracker): _nonvar_fields = { "cm_obj", "target_values", "initial_values", "state", *VariableTracker._nonvar_fields, } def __init__( self, target_values: Any, initial_values: Optional[Any] = None, **kwargs: Any ) -> None: super()...
ContextWrappingVariable
python
django__django
django/core/serializers/base.py
{ "start": 1074, "end": 1786 }
class ____: progress_width = 75 def __init__(self, output, total_count): self.output = output self.total_count = total_count self.prev_done = 0 def update(self, count): if not self.output: return perc = count * 100 // self.total_count done = perc...
ProgressBar
python
django__django
tests/auth_tests/test_models.py
{ "start": 8391, "end": 9757 }
class ____(SimpleTestCase): def test_has_usable_password(self): """ Passwords are usable even if they don't correspond to a hasher in settings.PASSWORD_HASHERS. """ self.assertIs(User(password="some-gibbberish").has_usable_password(), True) def test_normalize_username(se...
AbstractBaseUserTests
python
ipython__ipython
tests/test_formatters.py
{ "start": 455, "end": 514 }
class ____(A): def __repr__(self): return "B()"
B
python
pytorch__pytorch
torch/onnx/_internal/exporter/_schemas.py
{ "start": 436, "end": 2045 }
class ____: def __repr__(self) -> str: return "_EMPTY_DEFAULT" _EMPTY_DEFAULT = _Empty() # Map from python type to corresponding ONNX AttributeProto type _PY_TYPE_TO_ATTR_TYPE = { float: ir.AttributeType.FLOAT, int: ir.AttributeType.INT, str: ir.AttributeType.STRING, bool: ir.AttributeTyp...
_Empty
python
walkccc__LeetCode
solutions/311. Sparse Matrix Multiplication/311.py
{ "start": 0, "end": 352 }
class ____: def multiply(self, mat1: list[list[int]], mat2: list[list[int]]) -> list[list[int]]: m = len(mat1) n = len(mat2) l = len(mat2[0]) ans = [[0] * l for _ in range(m)] for i in range(m): for j in range(l): for k in range(n): ans[i][j] += mat1[i][k] *...
Solution
python
dask__distributed
distributed/shuffle/_rechunk.py
{ "start": 5919, "end": 6204 }
class ____(NamedTuple): """Information used to perform a partial rechunk along a single axis""" #: Slice of the old chunks along this axis that belong to the partial old: slice #: Slice of the new chunks along this axis that belong to the partial new: slice
_Partial
python
HIPS__autograd
examples/convnet.py
{ "start": 2027, "end": 3202 }
class ____: def __init__(self, kernel_shape, num_filters): self.kernel_shape = kernel_shape self.num_filters = num_filters def forward_pass(self, inputs, param_vector): # Input dimensions: [data, color_in, y, x] # Params dimensions: [color_in, color_out, y, x] # Output ...
conv_layer
python
prabhupant__python-ds
data_structures/graphs/cycle_in_directed_graph.py
{ "start": 38, "end": 935 }
class ____: def __init__(self, vertices): self.V = vertices self.graph = defaultdict(list) def add_edge(self, u, v): self.graph[u].append(v) def is_cyclic_util(self, v, visited, rec_stack): visited[v] = True rec_stack[v] = True for neighbour in self.grap...
Graph
python
getsentry__sentry
src/sentry/users/services/user/model.py
{ "start": 853, "end": 1510 }
class ____(RpcModel): """Minimal set of user attributes that can be fetched efficiently.""" id: int = -1 pk: int = -1 name: str = "" email: str = "" username: str = "" actor_id: int | None = None display_name: str = "" label: str = "" is_superuser: bool = False is_authentica...
RpcUserProfile
python
scikit-learn__scikit-learn
sklearn/base.py
{ "start": 20722, "end": 24177 }
class ____: """Mixin class for all regression estimators in scikit-learn. This mixin defines the following functionality: - set estimator type to `"regressor"` through the `estimator_type` tag; - `score` method that default to :func:`~sklearn.metrics.r2_score`. - enforce that `fit` requires `y` to...
RegressorMixin
python
dask__distributed
distributed/scheduler.py
{ "start": 5355, "end": 7414 }
class ____: """A simple object holding information about a client.""" #: A unique identifier for this client. This is generally an opaque #: string generated by the client itself. client_key: str #: Cached hash of :attr:`~ClientState.client_key` _hash: int #: A set of tasks this client wa...
ClientState
python
google__pytype
pytype/config_test.py
{ "start": 120, "end": 3131 }
class ____(unittest.TestCase): def test_basic(self): version = sys.version_info[:2] argv = [ "-V", utils.format_version(version), "--use-pickled-files", "-o", "out.pyi", "--pythonpath", f"foo{os.pathsep}bar", "test.py", ] opts = config.O...
ConfigTest
python
apache__airflow
providers/google/src/airflow/providers/google/marketing_platform/hooks/search_ads.py
{ "start": 7905, "end": 8798 }
class ____(GoogleBaseHook): """Hook for Google Search Ads 360.""" _conn: build | None = None def __init__( self, api_version: str = "v2", gcp_conn_id: str = "google_cloud_default", impersonation_chain: str | Sequence[str] | None = None, **kwargs, ) -> None: ...
GoogleSearchAdsHook
python
ipython__ipython
IPython/lib/display.py
{ "start": 14771, "end": 22833 }
class ____(FileLink): """Class for embedding local file links in an IPython session, based on path e.g. to embed links to files that were generated in the IPython notebook under ``my/data``, you would do:: local_files = FileLinks("my/data") display(local_files) or in the HTML notebook...
FileLinks
python
run-llama__llama_index
llama-index-core/llama_index/core/storage/index_store/types.py
{ "start": 322, "end": 1406 }
class ____(ABC): @abstractmethod def index_structs(self) -> List[IndexStruct]: pass @abstractmethod async def async_index_structs(self) -> List[IndexStruct]: pass @abstractmethod def add_index_struct(self, index_struct: IndexStruct) -> None: pass @abstractmethod ...
BaseIndexStore
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/roots/mutation.py
{ "start": 22513, "end": 24336 }
class ____(graphene.Mutation): """Reloads a code location server.""" Output = graphene.NonNull(GrapheneReloadRepositoryLocationMutationResult) class Arguments: repositoryLocationName = graphene.NonNull(graphene.String) class Meta: name = "ReloadRepositoryLocationMutation" @captur...
GrapheneReloadRepositoryLocationMutation
python
facelessuser__pymdown-extensions
pymdownx/blocks/definition.py
{ "start": 120, "end": 1407 }
class ____(Block): """ Definition. Converts non `ul`, `ol` blocks (ideally `p` tags) into `dt` and will convert first level `li` elements of `ul` and `ol` elements to `dd` tags. When done, the `ul`, and `ol` elements will be removed. """ NAME = 'define' def on_create(self, parent)...
Definition
python
ray-project__ray
release/llm_tests/benchmark/configs.py
{ "start": 112, "end": 253 }
class ____(str, Enum): CONSTANT = "constant" UNIFORM = "uniform" EXPONENTIAL = "exponential" NORMAL = "normal"
DistributionType
python
airbytehq__airbyte
airbyte-integrations/connectors/destination-pgvector/destination_pgvector/common/state/state_writers.py
{ "start": 524, "end": 977 }
class ____(StateWriterBase): """A state writer that writes state artifacts to stdout. This is required when we are functioning as a "Destination" in the Airbyte protocol, and an orchestrator is responsible for saving those state artifacts. """ def write_state( self, state_message: ...
StdOutStateWriter
python
fluentpython__example-code-2e
22-dyn-attr-prop/blackknight.py
{ "start": 733, "end": 1292 }
class ____: def __init__(self): self.phrases = [ ('an arm', "'Tis but a scratch."), ('another arm', "It's just a flesh wound."), ('a leg', "I'm invincible!"), ('another leg', "All right, we'll call it a draw.") ] @property def member(self): ...
BlackKnight
python
chroma-core__chroma
chromadb/test/test_config.py
{ "start": 984, "end": 1289 }
class ____(Component): def __init__(self, system: System): data.inits += "C" super().__init__(system) self.require(ComponentD) @overrides def start(self) -> None: data.starts += "C" @overrides def stop(self) -> None: data.stops += "C"
ComponentC
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/abstractClass5.py
{ "start": 158, "end": 1393 }
class ____(ABC): @overload def func1(self, a: int) -> int: pass @overload @abstractmethod # This should generate an error because this overload is # missing an abstractmethod overload. def func1(self, a: float) -> float: pass @overload def func1(self, a: str) -> str...
ClassA
python
sanic-org__sanic
sanic/http/constants.py
{ "start": 33, "end": 669 }
class ____(Enum): """Enum for representing the stage of the request/response cycle | ``IDLE`` Waiting for request | ``REQUEST`` Request headers being received | ``HANDLER`` Headers done, handler running | ``RESPONSE`` Response headers sent, body in progress | ``FAILED`` Unrecoverable state...
Stage
python
walkccc__LeetCode
solutions/2366. Minimum Replacements to Sort the Array/2366.py
{ "start": 0, "end": 243 }
class ____: def minimumReplacement(self, nums: list[int]) -> int: ans = 0 mx = nums[-1] for i in range(len(nums) - 2, -1, -1): ops = (nums[i] - 1) // mx ans += ops mx = nums[i] // (ops + 1) return ans
Solution
python
dask__dask
dask/array/tests/test_array_core.py
{ "start": 68474, "end": 68813 }
class ____: def __init__(self): self.concurrent_uses = 0 self.max_concurrent_uses = 0 def __setitem__(self, key, value): self.concurrent_uses += 1 self.max_concurrent_uses = max(self.concurrent_uses, self.max_concurrent_uses) time.sleep(0.01) self.concurrent_uses...
ThreadSafeStore
python
getsentry__sentry
tests/sentry/releases/endpoints/test_project_release_details.py
{ "start": 806, "end": 1818 }
class ____(APITestCase): def test_simple(self) -> None: self.login_as(user=self.user) project = self.create_project(name="foo") project2 = self.create_project(name="bar", organization=project.organization) release = Release.objects.create(organization_id=project.organization_id, ve...
ReleaseDetailsTest
python
doocs__leetcode
solution/0900-0999/0924.Minimize Malware Spread/Solution.py
{ "start": 0, "end": 701 }
class ____: __slots__ = "p", "size" def __init__(self, n: int): self.p = list(range(n)) self.size = [1] * n def find(self, x: int) -> int: if self.p[x] != x: self.p[x] = self.find(self.p[x]) return self.p[x] def union(self, a: int, b: int) -> bool: ...
UnionFind
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/dataclassFrozen1.py
{ "start": 367, "end": 427 }
class ____(DC1): val3: int = 4 @dataclass(frozen=True)
DC3
python
apache__airflow
providers/amazon/tests/unit/amazon/aws/sensors/test_glacier.py
{ "start": 3337, "end": 3564 }
class ____: def test_job_status_success(self): assert JobStatus.SUCCEEDED.value == SUCCEEDED def test_job_status_in_progress(self): assert JobStatus.IN_PROGRESS.value == IN_PROGRESS
TestSensorJobDescription
python
dagster-io__dagster
python_modules/libraries/dagster-fivetran/dagster_fivetran_tests/deprecated/test_managed_elements.py
{ "start": 872, "end": 14896 }
class ____(AbstractContextManager): def __init__( self, connectors: dict[str, FivetranConnector], destinations: dict[str, FivetranDestination] ): self.rsps = responses.RequestsMock(assert_all_requests_are_fired=False) self.connectors = connectors self.destinations = destinations ...
MockFivetran
python
pypa__installer
src/installer/records.py
{ "start": 745, "end": 1973 }
class ____: """Represents the "hash" element of a RecordEntry. Most consumers should use :py:meth:`Hash.parse` instead, since no validation or parsing is performed by this constructor. """ name: str """Name of the hash function.""" value: str """Hashed value.""" def __str__(self)...
Hash
python
PyCQA__pycodestyle
pycodestyle.py
{ "start": 84011, "end": 86198 }
class ____(BaseReport): """Collect and print the results of the checks.""" def __init__(self, options): super().__init__(options) self._fmt = REPORT_FORMAT.get(options.format.lower(), options.format) self._repeat = options.repeat self._show_...
StandardReport
python
pappasam__jedi-language-server
jedi_language_server/text_edit_utils.py
{ "start": 5045, "end": 5739 }
class ____: """Data structure to convert byte offset file to line number and character.""" def __init__(self, code: str) -> None: # Create a list saying at what offset in the file each line starts. self.line_starts = [] offset = 0 for line in code.splitlines(keepends=True): ...
PositionLookup
python
python__mypy
mypy/join.py
{ "start": 1142, "end": 10295 }
class ____: def __init__(self) -> None: self.seen_instances: list[tuple[Instance, Instance]] = [] def join_instances(self, t: Instance, s: Instance) -> ProperType: if (t, s) in self.seen_instances or (s, t) in self.seen_instances: return object_from_instance(t) self.seen_in...
InstanceJoiner
python
sympy__sympy
sympy/geometry/parabola.py
{ "start": 523, "end": 10716 }
class ____(GeometrySet): """A parabolic GeometryEntity. A parabola is declared with a point, that is called 'focus', and a line, that is called 'directrix'. Only vertical or horizontal parabolas are currently supported. Parameters ========== focus : Point Default value is Point(0,...
Parabola
python
spack__spack
var/spack/test_repos/spack_repo/builtin_mock/packages/dtrun2/package.py
{ "start": 217, "end": 450 }
class ____(Package): """Simple package which acts as a run dependency""" homepage = "http://www.example.com" url = "http://www.example.com/dtrun2-1.0.tar.gz" version("1.0", md5="0123456789abcdef0123456789abcdef")
Dtrun2
python
getlogbook__logbook
src/logbook/queues.py
{ "start": 23036, "end": 24409 }
class ____(SubscriberBase): """This is a subscriber which represents a group of subscribers. This is helpful if you are writing a server-like application which has "slaves". This way a user is easily able to view every log record which happened somewhere in the entire system without having to check eve...
SubscriberGroup
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/methodOverride6.py
{ "start": 4078, "end": 4409 }
class ____(Generic[_T]): @overload def m1(self: "Parent4[int]", a: None) -> float: ... @overload def m1(self: "Parent4[int]", a: int) -> float: ... @overload def m1(self: "Parent4[float]", a: None) -> str: ... def m1(self, a: int | None = None) -> float | str: raise NotImplemented...
Parent4
python
redis__redis-py
tests/test_maint_notifications.py
{ "start": 9353, "end": 10926 }
class ____: """Test the NodeMigratingNotification class.""" def test_init(self): """Test NodeMigratingNotification initialization.""" with patch("time.monotonic", return_value=1000): notification = NodeMigratingNotification(id=1, ttl=5) assert notification.id == 1 ...
TestNodeMigratingNotification
python
charliermarsh__ruff
crates/ty_python_semantic/resources/corpus/73_class_generic_tuple.py
{ "start": 0, "end": 24 }
class ____[*T]: x: T
Foo
python
pytorch__pytorch
torch/_inductor/fx_passes/reinplace.py
{ "start": 1334, "end": 2299 }
class ____: inplace_op: Callable[..., Any] mutated_arg: int extra_check: Callable[[torch.fx.Node], bool] = lambda node: True _SCATTER_OP_TO_VIEW = { torch.ops.aten.diagonal_scatter.default: torch.ops.aten.diagonal.default, torch.ops.aten.select_scatter.default: torch.ops.aten.select.int, torch...
InplaceableOp
python
ansible__ansible
lib/ansible/module_utils/facts/hardware/base.py
{ "start": 1768, "end": 2003 }
class ____: platform = 'Generic' # FIXME: remove load_on_init when we can def __init__(self, module, load_on_init=False): self.module = module def populate(self, collected_facts=None): return {}
Hardware
python
facebookresearch__faiss
tests/test_contrib_with_scipy.py
{ "start": 388, "end": 2019 }
class ____(unittest.TestCase): def test_sparse_routines(self): """ the sparse assignment routine """ ds = datasets.SyntheticDataset(1000, 2000, 0, 200) xt = ds.get_train().copy() faiss.normalize_L2(xt) mask = np.abs(xt) > 0.045 xt[np.logical_not(mask)] = 0 ...
TestClustering
python
huggingface__transformers
src/transformers/models/edgetam/modular_edgetam.py
{ "start": 6357, "end": 6427 }
class ____(Sam2FeedForward): pass @auto_docstring
EdgeTamFeedForward
python
numba__numba
numba/tests/test_operators.py
{ "start": 45552, "end": 45637 }
class ____(TestMixedInts): op = FunctionalOperatorImpl
TestMixedIntsOperatorModule
python
readthedocs__readthedocs.org
readthedocs/rtd_tests/tests/test_project_forms.py
{ "start": 40599, "end": 44688 }
class ____(TestCase): def setUp(self): self.project = get(Project) def test_use_invalid_names(self): data = { "name": "VARIABLE WITH SPACES", "value": "string here", } form = EnvironmentVariableForm(data, project=self.project) self.assertFalse(for...
TestProjectEnvironmentVariablesForm
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/links/mlengine.py
{ "start": 2137, "end": 2380 }
class ____(BaseGoogleLink): """Helper class for constructing ML Engine link.""" name = "MLEngine Version Details" key = "ml_engine_version_details" format_str = MLENGINE_MODEL_VERSION_DETAILS_LINK
MLEngineModelVersionDetailsLink
python
django__django
django/contrib/redirects/migrations/0001_initial.py
{ "start": 43, "end": 2093 }
class ____(migrations.Migration): dependencies = [ ("sites", "0001_initial"), ] operations = [ migrations.CreateModel( name="Redirect", fields=[ ( "id", models.AutoField( verbose_name="ID...
Migration
python
numba__numba
numba/cuda/tests/cudapy/test_ufuncs.py
{ "start": 882, "end": 9680 }
class ____(BasicUFuncTest, TestCase): _numba_parallel_test_ = False def setUp(self): BasicUFuncTest.setUp(self) # The basic ufunc test does not set up complex inputs, so we'll add # some here for testing with CUDA. self.inputs.extend([ (np.complex64(-0.5 - 0.5j), ty...
TestUFuncs
python
openai__openai-python
src/openai/types/responses/response_reasoning_summary_part_added_event.py
{ "start": 400, "end": 1006 }
class ____(BaseModel): item_id: str """The ID of the item this summary part is associated with.""" output_index: int """The index of the output item this summary part is associated with.""" part: Part """The summary part that was added.""" sequence_number: int """The sequence number o...
ResponseReasoningSummaryPartAddedEvent
python
getsentry__sentry
src/sentry/rules/conditions/event_attribute.py
{ "start": 12901, "end": 13357 }
class ____(AttributeHandler): minimum_path_length = 2 @classmethod def _handle(cls, path: list[str], event: GroupEvent) -> list[str]: if path[1] == "crash_type": contexts = event.data.get("contexts", {}) unreal = contexts.get("unreal") if unreal is None: ...
UnrealAttributeHandler
python
pytest-dev__pytest
testing/python/fixtures.py
{ "start": 74801, "end": 107649 }
class ____: def test_parametrize(self, pytester: Pytester) -> None: pytester.makepyfile( """ import pytest @pytest.fixture(params=["a", "b", "c"]) def arg(request): return request.param values = [] def test_param(arg): ...
TestFixtureMarker
python
python-openxml__python-docx
src/docx/oxml/shape.py
{ "start": 6770, "end": 6914 }
class ____(BaseOxmlElement): """``<a:prstGeom>`` element, specifies an preset autoshape geometry, such as ``rect``."""
CT_PresetGeometry2D
python
sympy__sympy
sympy/solvers/diophantine/diophantine.py
{ "start": 7591, "end": 8551 }
class ____(DiophantineEquationType): """ Representation of a univariate diophantine equation. A univariate diophantine equation is an equation of the form `a_{0} + a_{1}x + a_{2}x^2 + .. + a_{n}x^n = 0` where `a_{1}, a_{2}, ..a_{n}` are integer constants and `x` is an integer variable. Example...
Univariate
python
ray-project__ray
python/ray/serve/schema.py
{ "start": 36633, "end": 36788 }
class ____(str, Enum): HEALTHY = "healthy" DELAYED = "delayed" UNAVAILABLE = "unavailable" @PublicAPI(stability="alpha")
AutoscalingMetricsHealth
python
ansible__ansible
lib/ansible/modules/service.py
{ "start": 44576, "end": 45321 }
class ____(FreeBsdService): """ This is the DragonFly BSD Service manipulation class - it uses the /etc/rc.conf file for controlling services started at boot and the 'service' binary to check status and perform direct service manipulation. """ platform = 'DragonFly' distribution = None ...
DragonFlyBsdService
python
anthropics__anthropic-sdk-python
src/anthropic/types/web_search_tool_20250305_param.py
{ "start": 841, "end": 1829 }
class ____(TypedDict, total=False): name: Required[Literal["web_search"]] """Name of the tool. This is how the tool will be called by the model and in `tool_use` blocks. """ type: Required[Literal["web_search_20250305"]] allowed_domains: Optional[SequenceNotStr[str]] """If provided, only ...
WebSearchTool20250305Param
python
davidhalter__jedi
test/completion/pep0526_variables.py
{ "start": 621, "end": 752 }
class ____(): bar: int baz: typing.ClassVar[str] #? int() Foo.bar #? int() Foo().bar #? str() Foo.baz #? str() Foo().baz
Foo
python
apache__airflow
providers/fab/src/airflow/providers/fab/auth_manager/models/__init__.py
{ "start": 10978, "end": 12708 }
class ____(Model): """Represents a user registration.""" __tablename__ = "ab_register_user" id = mapped_column( Integer, Sequence("ab_register_user_id_seq", start=1, increment=1, minvalue=1, cycle=False), primary_key=True, ) first_name: Mapped[str] = mapped_column(String(64...
RegisterUser
python
kamyu104__LeetCode-Solutions
Python/minimum-sideway-jumps.py
{ "start": 547, "end": 970 }
class ____(object): def minSideJumps(self, obstacles): """ :type obstacles: List[int] :rtype: int """ dp = [1, 0, 1] for i in obstacles: if i: dp[i-1] = float("inf") for j in xrange(3): if j+1 != i: ...
Solution2
python
pennersr__django-allauth
allauth/headless/account/inputs.py
{ "start": 9038, "end": 9114 }
class ____(ConfirmLoginCodeForm, inputs.Input): pass
ConfirmLoginCodeInput
python
doocs__leetcode
lcof2/剑指 Offer II 027. 回文链表/Solution.py
{ "start": 151, "end": 695 }
class ____: def isPalindrome(self, head: ListNode) -> bool: if head is None or head.next is None: return True slow, fast = head, head.next while fast and fast.next: slow, fast = slow.next, fast.next.next pre, cur = None, slow.next while cur: ...
Solution
python
crytic__slither
slither/core/declarations/function.py
{ "start": 3204, "end": 3279 }
class ____(Enum): Solidity = 0 Yul = 1 Vyper = 2
FunctionLanguage
python
sqlalchemy__sqlalchemy
test/ext/test_mutable.py
{ "start": 40361, "end": 43051 }
class ____(_CompositeTestBase, fixtures.MappedTest): @classmethod def setup_mappers(cls): foo = cls.tables.foo cls.Point = cls._type_fixture() cls.mapper_registry.map_imperatively( Foo, foo, properties={"data": composite(cls.Point, foo.c.x, foo.c.y)}...
MutableCompositesTest
python
dagster-io__dagster
python_modules/libraries/dagster-fivetran/dagster_fivetran/managed/types.py
{ "start": 2981, "end": 3622 }
class ____: def __init__(self, connector: FivetranConnector, connector_id: str): self.connector = connector self.connector_id = connector_id @classmethod def from_api_json(cls, api_json: dict[str, Any]): return cls( connector=FivetranConnector( schema_nam...
InitializedFivetranConnector
python
Pylons__pyramid
docs/tutorials/wiki2/src/basiclayout/tutorial/models/mymodel.py
{ "start": 132, "end": 366 }
class ____(Base): __tablename__ = 'models' id: Mapped[int] = mapped_column(primary_key=True) name: Mapped[Optional[str]] value: Mapped[Optional[int]] Index('my_index', MyModel.name, unique=True, mysql_length=255)
MyModel
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_chart_bar13.py
{ "start": 315, "end": 1894 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("chart_bar13.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file.""" workbook = Workbook(self.got_f...
TestCompareXLSXFiles
python
run-llama__llama_index
llama-index-core/llama_index/core/embeddings/mock_embed_model.py
{ "start": 248, "end": 1211 }
class ____(BaseEmbedding): """ Mock embedding. Used for token prediction. Args: embed_dim (int): embedding dimension """ embed_dim: int def __init__(self, embed_dim: int, **kwargs: Any) -> None: """Init params.""" super().__init__(embed_dim=embed_dim, **kwargs) ...
MockEmbedding
python
Textualize__textual
src/textual/css/errors.py
{ "start": 544, "end": 1261 }
class ____(ValueError): """Raised when the value of a style property is not valid Attributes: help_text: Optional HelpText to be rendered when this error is raised. """ def __init__(self, *args: object, help_text: HelpText | None = None): super().__init__(*args) sel...
StyleValueError
python
astropy__astropy
astropy/modeling/projections.py
{ "start": 23016, "end": 23300 }
class ____(Sky2PixProjection, Cylindrical): r""" Mercator - sky to pixel. Corresponds to the ``MER`` projection in FITS WCS. .. math:: x &= \phi \\ y &= \frac{180^{\circ}}{\pi}\ln \tan \left(\frac{90^{\circ} + \theta}{2}\right) """
Sky2Pix_Mercator
python
django__django
django/utils/log.py
{ "start": 4984, "end": 5384 }
class ____(logging.Filter): """ A logging filter that checks the return value of a given callable (which takes the record-to-be-logged as its only parameter) to decide whether to log a record. """ def __init__(self, callback): self.callback = callback def filter(self, record): ...
CallbackFilter
python
pypa__warehouse
tests/unit/admin/views/test_banners.py
{ "start": 6953, "end": 7429 }
class ____: def test_404_if_banner_does_not_exist(self, db_request): db_request.matchdict["banner_id"] = str(uuid.uuid4()) with pytest.raises(HTTPNotFound): views.preview_banner(db_request) def test_preview_banner(self, db_request): banner = BannerFactory.create() d...
TestPreviewBanner
python
tox-dev__tox
src/tox/config/loader/api.py
{ "start": 1680, "end": 2432 }
class ____: """Arguments that help loading a configuration value.""" def __init__(self, chain: list[str] | None, name: str | None, env_name: str | None) -> None: """ :param chain: the configuration chain (useful to detect circular references) :param name: the name of the configuration ...
ConfigLoadArgs
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/random/random_crop_test.py
{ "start": 885, "end": 2724 }
class ____(test.TestCase): @test_util.run_deprecated_v1 def testNoOp(self): # No random cropping is performed since the size is value.shape. for shape in (2, 1, 1), (2, 1, 3), (4, 5, 3): value = np.arange(0, np.prod(shape), dtype=np.int32).reshape(shape) with self.cached_session(): crop...
RandomCropTest
python
getsentry__sentry
src/sudo/forms.py
{ "start": 402, "end": 1106 }
class ____(forms.Form): """ A simple password input form used by the default :func:`~sudo.views.sudo` view. """ password = forms.CharField(label=_("Password"), widget=forms.PasswordInput) def __init__(self, user: AnonymousUser | AbstractBaseUser, *args: Any, **kwargs: Any) -> None: self.us...
SudoForm
python
ansible__ansible
lib/ansible/module_utils/urls.py
{ "start": 7072, "end": 7248 }
class ____(ConnectionError): """Failure to connect due to SSL validation failing No longer used, but kept for backwards compatibility """ pass
SSLValidationError
python
getsentry__sentry
tests/sentry/sentry_apps/test_sentry_app_installation_creator.py
{ "start": 1011, "end": 6622 }
class ____(TestCase): def setUp(self) -> None: self.user = self.create_user() self.org = self.create_organization() self.project1 = self.create_project(organization=self.org) self.project2 = self.create_project(organization=self.org) self.sentry_app = self.create_sentry_ap...
TestCreator
python
keras-team__keras
keras/src/ops/function_test.py
{ "start": 334, "end": 5838 }
class ____(testing.TestCase): def test_define_and_call(self): x1 = keras_tensor.KerasTensor((2, 3)) x2 = keras_tensor.KerasTensor((2, 3)) x = knp.add(x1, x2) y1 = x * 3 y2 = x**2 fn = function.Function( inputs=[x1, x2], outputs=[y1, y2], name="test_functio...
FunctionTest
python
getsentry__sentry
src/social_auth/exceptions.py
{ "start": 138, "end": 279 }
class ____(SocialAuthBaseException): def __str__(self) -> str: return gettext("Backend error: %s") % super().__str__()
BackendError
python
getsentry__sentry
tests/sentry_plugins/jira/test_plugin.py
{ "start": 10342, "end": 17449 }
class ____(TestCase): @cached_property def plugin(self) -> JiraPlugin: return JiraPlugin() @cached_property def request(self) -> RequestFactory: return RequestFactory() def test_conf_key(self) -> None: assert self.plugin.conf_key == "jira" def test_get_issue_label(self...
JiraPluginTest
python
boto__boto3
boto3/dynamodb/conditions.py
{ "start": 5888, "end": 6001 }
class ____(ConditionAttributeBase): expression_operator = 'size' expression_format = '{operator}({0})'
Size
python
run-llama__llama_index
llama-index-core/llama_index/core/indices/managed/types.py
{ "start": 52, "end": 169 }
class ____(str, Enum): """Managed Index query mode.""" DEFAULT = "default" MMR = "mmr"
ManagedIndexQueryMode
python
gevent__gevent
src/greentest/3.10/test_asyncore.py
{ "start": 739, "end": 870 }
class ____: def __init__(self): self.socket = dummysocket() def close(self): self.socket.close()
dummychannel
python
run-llama__llama_index
llama-index-core/llama_index/core/ingestion/transformations.py
{ "start": 2873, "end": 10583 }
class ____(Enum): @classmethod def from_component(cls, component: BaseComponent) -> "ConfigurableComponent": component_class = type(component) for component_type in cls: if component_type.value.component_type == component_class: return component_type raise Val...
ConfigurableComponent
python
astropy__astropy
astropy/modeling/tests/test_compound.py
{ "start": 13549, "end": 13756 }
class ____(Model): stddev = Parameter(default=0, min=0, max=0.3) mean = Parameter(default=0, fixed=True) @staticmethod def evaluate(stddev, mean): return stddev, mean
_ConstraintsTestA
python
encode__django-rest-framework
tests/test_validation_error.py
{ "start": 527, "end": 774 }
class ____(APIView): def get(self, request, *args, **kwargs): ExampleSerializer(data={}).is_valid(raise_exception=True) @api_view(['GET']) def error_view(request): ExampleSerializer(data={}).is_valid(raise_exception=True)
ErrorView
python
Farama-Foundation__Gymnasium
gymnasium/wrappers/vector/vectorize_observation.py
{ "start": 11925, "end": 12761 }
class ____(VectorizeTransformObservation): """Observation wrapper that flattens the observation. Example: >>> import gymnasium as gym >>> envs = gym.make_vec("CarRacing-v3", num_envs=3, vectorization_mode="sync") >>> obs, info = envs.reset(seed=123) >>> obs.shape (3, 96,...
FlattenObservation
python
optuna__optuna
optuna/samplers/nsgaii/_crossovers/_vsbx.py
{ "start": 295, "end": 5925 }
class ____(BaseCrossover): """Modified Simulated Binary Crossover operation used by :class:`~optuna.samplers.NSGAIISampler`. vSBX generates child individuals without excluding any region of the parameter space, while maintaining the excellent properties of SBX. In the paper, vSBX has only one argu...
VSBXCrossover
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/required1.py
{ "start": 297, "end": 1038 }
class ____(TypedDict): a: Required[int] b: NotRequired[int] # This should generate an error because NotRequired can't be # used in this context. c: NotRequired[NotRequired[int]] # This should generate an error because Required can't be # used in this context. d: Required[Required[int]]...
TD1
python
lxml__lxml
src/lxml/tests/test_unicode.py
{ "start": 5386, "end": 7821 }
class ____(HelperTestCase): def test_illegal_utf8(self): data = b'<test>\x80\x80\x80</test>' self.assertRaises(etree.XMLSyntaxError, etree.fromstring, data) def test_illegal_utf8_recover(self): data = b'<test>\x80\x80\x80</test>' parser = etree.XMLParser(recover=True) if...
EncodingsTestCase
python
GoogleCloudPlatform__python-docs-samples
appengine/standard/images/api/main.py
{ "start": 963, "end": 1782 }
class ____(webapp2.RequestHandler): def get(self): if self.request.get("id"): photo = Photo.get_by_id(int(self.request.get("id"))) if photo: img = images.Image(photo.full_size_image) img.resize(width=80, height=100) img.im_feeling_luck...
Thumbnailer
python
celery__celery
t/unit/app/test_beat.py
{ "start": 4243, "end": 4392 }
class ____(mScheduler): def send_task(self, *args, **kwargs): raise beat.SchedulingError('Could not apply task')
mSchedulerSchedulingError
python
ray-project__ray
rllib/examples/rl_modules/classes/lstm_containing_rlm.py
{ "start": 422, "end": 6039 }
class ____(TorchRLModule, ValueFunctionAPI): """An example TorchRLModule that contains an LSTM layer. .. testcode:: import numpy as np import gymnasium as gym B = 10 # batch size T = 5 # seq len e = 25 # embedding dim CELL = 32 # LSTM cell size # C...
LSTMContainingRLModule