mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-18 18:05:58 +08:00
initial commit
This commit is contained in:
82
django/db/backends/base/base.pyi
Normal file
82
django/db/backends/base/base.pyi
Normal file
@@ -0,0 +1,82 @@
|
||||
from django.db.backends.sqlite3.base import (
|
||||
DatabaseWrapper,
|
||||
SQLiteCursorWrapper,
|
||||
)
|
||||
from django.db.backends.sqlite3.schema import DatabaseSchemaEditor
|
||||
from django.db.backends.utils import (
|
||||
CursorDebugWrapper,
|
||||
CursorWrapper,
|
||||
)
|
||||
from django.db.utils import DatabaseErrorWrapper
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
Iterator,
|
||||
List,
|
||||
)
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
|
||||
class BaseDatabaseWrapper:
|
||||
def __init__(
|
||||
self,
|
||||
settings_dict: Dict[str, Any],
|
||||
alias: str = ...,
|
||||
allow_thread_sharing: bool = ...
|
||||
) -> None: ...
|
||||
def _commit(self): ...
|
||||
def _cursor(self, name: None = ...): ...
|
||||
def _prepare_cursor(
|
||||
self,
|
||||
cursor: SQLiteCursorWrapper
|
||||
) -> CursorWrapper: ...
|
||||
def _rollback(self): ...
|
||||
def _savepoint(self, sid: str) -> None: ...
|
||||
def _savepoint_commit(self, sid: str) -> None: ...
|
||||
def _savepoint_rollback(self, sid: str) -> None: ...
|
||||
def check_settings(self) -> None: ...
|
||||
def chunked_cursor(self) -> CursorWrapper: ...
|
||||
def close(self) -> None: ...
|
||||
def close_if_unusable_or_obsolete(self) -> None: ...
|
||||
def commit(self) -> None: ...
|
||||
def connect(self) -> None: ...
|
||||
def constraint_checks_disabled(self) -> Iterator[None]: ...
|
||||
def copy(
|
||||
self,
|
||||
alias: None = ...,
|
||||
allow_thread_sharing: None = ...
|
||||
) -> DatabaseWrapper: ...
|
||||
def cursor(self) -> CursorWrapper: ...
|
||||
def ensure_connection(self) -> None: ...
|
||||
def ensure_timezone(self) -> bool: ...
|
||||
def execute_wrapper(self, wrapper: MagicMock) -> Iterator[None]: ...
|
||||
def get_autocommit(self) -> bool: ...
|
||||
def get_rollback(self) -> bool: ...
|
||||
def make_cursor(
|
||||
self,
|
||||
cursor: SQLiteCursorWrapper
|
||||
) -> CursorWrapper: ...
|
||||
def make_debug_cursor(
|
||||
self,
|
||||
cursor: SQLiteCursorWrapper
|
||||
) -> CursorDebugWrapper: ...
|
||||
def on_commit(self, func: Callable) -> None: ...
|
||||
def prepare_database(self) -> None: ...
|
||||
@property
|
||||
def queries(self) -> List[Dict[str, str]]: ...
|
||||
@property
|
||||
def queries_logged(self) -> bool: ...
|
||||
def rollback(self) -> None: ...
|
||||
def run_and_clear_commit_hooks(self) -> None: ...
|
||||
def savepoint(self) -> str: ...
|
||||
def savepoint_commit(self, sid: str) -> None: ...
|
||||
def savepoint_rollback(self, sid: str) -> None: ...
|
||||
def schema_editor(self, *args, **kwargs) -> DatabaseSchemaEditor: ...
|
||||
def set_autocommit(self, autocommit: bool, force_begin_transaction_with_broken_autocommit: bool = ...) -> None: ...
|
||||
def set_rollback(self, rollback: bool) -> None: ...
|
||||
def validate_no_atomic_block(self) -> None: ...
|
||||
def validate_no_broken_transaction(self) -> None: ...
|
||||
def validate_thread_sharing(self) -> None: ...
|
||||
@cached_property
|
||||
def wrap_database_errors(self) -> DatabaseErrorWrapper: ...
|
||||
5
django/db/backends/base/client.pyi
Normal file
5
django/db/backends/base/client.pyi
Normal file
@@ -0,0 +1,5 @@
|
||||
from django.db.backends.base.base import BaseDatabaseWrapper
|
||||
|
||||
|
||||
class BaseDatabaseClient:
|
||||
def __init__(self, connection: BaseDatabaseWrapper) -> None: ...
|
||||
31
django/db/backends/base/creation.pyi
Normal file
31
django/db/backends/base/creation.pyi
Normal file
@@ -0,0 +1,31 @@
|
||||
from django.db.backends.sqlite3.base import DatabaseWrapper
|
||||
from typing import (
|
||||
Dict,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class BaseDatabaseCreation:
|
||||
def __init__(self, connection: DatabaseWrapper) -> None: ...
|
||||
def _get_database_display_str(self, verbosity: int, database_name: str) -> str: ...
|
||||
def _get_test_db_name(self) -> str: ...
|
||||
def create_test_db(
|
||||
self,
|
||||
verbosity: int = ...,
|
||||
autoclobber: bool = ...,
|
||||
serialize: bool = ...,
|
||||
keepdb: bool = ...
|
||||
) -> str: ...
|
||||
def deserialize_db_from_string(self, data: str) -> None: ...
|
||||
def destroy_test_db(
|
||||
self,
|
||||
old_database_name: str = ...,
|
||||
verbosity: int = ...,
|
||||
keepdb: bool = ...,
|
||||
suffix: None = ...
|
||||
) -> None: ...
|
||||
def serialize_db_to_string(self) -> str: ...
|
||||
def set_as_test_mirror(self, primary_settings_dict: Dict[str, Union[str, int, None, Dict[str, None]]]) -> None: ...
|
||||
def test_db_signature(self) -> Tuple[str, str, str, str]: ...
|
||||
5
django/db/backends/base/features.pyi
Normal file
5
django/db/backends/base/features.pyi
Normal file
@@ -0,0 +1,5 @@
|
||||
from django.db.backends.base.base import BaseDatabaseWrapper
|
||||
|
||||
|
||||
class BaseDatabaseFeatures:
|
||||
def __init__(self, connection: BaseDatabaseWrapper) -> None: ...
|
||||
26
django/db/backends/base/introspection.pyi
Normal file
26
django/db/backends/base/introspection.pyi
Normal file
@@ -0,0 +1,26 @@
|
||||
from django.db.backends.base.base import BaseDatabaseWrapper
|
||||
from django.db.backends.utils import CursorWrapper
|
||||
from typing import (
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class BaseDatabaseIntrospection:
|
||||
def __init__(self, connection: BaseDatabaseWrapper) -> None: ...
|
||||
def column_name_converter(self, name: str) -> str: ...
|
||||
def django_table_names(self, only_existing: bool = ..., include_views: bool = ...) -> List[str]: ...
|
||||
def get_field_type(
|
||||
self,
|
||||
data_type: str,
|
||||
description: FieldInfo
|
||||
) -> Union[str, Tuple[str, Dict[str, int]]]: ...
|
||||
def table_name_converter(self, name: str) -> str: ...
|
||||
def table_names(
|
||||
self,
|
||||
cursor: Optional[CursorWrapper] = ...,
|
||||
include_views: bool = ...
|
||||
) -> List[str]: ...
|
||||
82
django/db/backends/base/operations.pyi
Normal file
82
django/db/backends/base/operations.pyi
Normal file
@@ -0,0 +1,82 @@
|
||||
from datetime import (
|
||||
date,
|
||||
datetime,
|
||||
time,
|
||||
timedelta,
|
||||
)
|
||||
from decimal import Decimal
|
||||
from django.core.management.color import Style
|
||||
from django.db import DefaultConnectionProxy
|
||||
from django.db.backends.base.base import BaseDatabaseWrapper
|
||||
from django.db.backends.sqlite3.base import DatabaseWrapper
|
||||
from django.db.backends.utils import CursorWrapper
|
||||
from django.db.models.expressions import Expression
|
||||
from django.db.models.fields import Field
|
||||
from typing import (
|
||||
Any,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class BaseDatabaseOperations:
|
||||
def __init__(
|
||||
self,
|
||||
connection: Union[DefaultConnectionProxy, backends.base.base.BaseDatabaseWrapper]
|
||||
) -> None: ...
|
||||
def _get_limit_offset_params(self, low_mark: int, high_mark: Optional[int]) -> Tuple[int, int]: ...
|
||||
def adapt_datefield_value(self, value: Optional[date]) -> Optional[str]: ...
|
||||
def adapt_decimalfield_value(
|
||||
self,
|
||||
value: Optional[Decimal],
|
||||
max_digits: Optional[int] = ...,
|
||||
decimal_places: Optional[int] = ...
|
||||
) -> Optional[str]: ...
|
||||
def adapt_ipaddressfield_value(self, value: Optional[str]) -> Optional[str]: ...
|
||||
def adapt_timefield_value(self, value: Optional[Union[time, datetime]]) -> Optional[str]: ...
|
||||
def adapt_unknown_value(self, value: Union[Decimal, time, date, int]) -> Union[str, int]: ...
|
||||
def autoinc_sql(self, table: str, column: str) -> None: ...
|
||||
def binary_placeholder_sql(self, value: Optional[memoryview]) -> str: ...
|
||||
def combine_expression(self, connector: str, sub_expressions: List[str]) -> str: ...
|
||||
def compiler(self, compiler_name: str) -> Any: ...
|
||||
def convert_durationfield_value(
|
||||
self,
|
||||
value: Optional[Union[float, int]],
|
||||
expression: Expression,
|
||||
connection: DatabaseWrapper
|
||||
) -> Optional[timedelta]: ...
|
||||
def date_extract_sql(self, lookup_type: None, field_name: None): ...
|
||||
def datetime_cast_date_sql(self, field_name: None, tzname: None): ...
|
||||
def datetime_trunc_sql(self, lookup_type: None, field_name: None, tzname: None): ...
|
||||
def distinct_sql(self, fields: List[str], params: None) -> Tuple[List[str], List[Any]]: ...
|
||||
def end_transaction_sql(self, success: bool = ...) -> str: ...
|
||||
def execute_sql_flush(self, using: str, sql_list: List[str]) -> None: ...
|
||||
def explain_query_prefix(self, format: None = ..., **options): ...
|
||||
def field_cast_sql(self, db_type: Optional[str], internal_type: str) -> str: ...
|
||||
def force_no_ordering(self) -> List[Any]: ...
|
||||
def get_db_converters(self, expression: Expression) -> List[Any]: ...
|
||||
def last_insert_id(self, cursor: CursorWrapper, table_name: str, pk_name: str) -> int: ...
|
||||
def limit_offset_sql(self, low_mark: int, high_mark: Optional[int]) -> str: ...
|
||||
def lookup_cast(self, lookup_type: str, internal_type: str = ...) -> str: ...
|
||||
def max_in_list_size(self) -> None: ...
|
||||
def max_name_length(self) -> None: ...
|
||||
def modify_insert_params(self, placeholder: str, params: Any) -> Any: ...
|
||||
def prep_for_like_query(self, x: str) -> str: ...
|
||||
def process_clob(self, value: str) -> str: ...
|
||||
def random_function_sql(self) -> str: ...
|
||||
def savepoint_commit_sql(self, sid: str) -> str: ...
|
||||
def savepoint_create_sql(self, sid: str) -> str: ...
|
||||
def savepoint_rollback_sql(self, sid: str) -> str: ...
|
||||
def sequence_reset_by_name_sql(self, style: None, sequences: List[Any]) -> List[Any]: ...
|
||||
def sequence_reset_sql(self, style: Style, model_list: Any) -> List[Any]: ...
|
||||
def set_time_zone_sql(self) -> str: ...
|
||||
def tablespace_sql(self, tablespace: str, inline: bool = ...) -> str: ...
|
||||
def time_extract_sql(self, lookup_type: None, field_name: None): ...
|
||||
def time_trunc_sql(self, lookup_type: None, field_name: None): ...
|
||||
def unification_cast_sql(self, output_field: Field) -> str: ...
|
||||
def validate_autopk_value(self, value: int) -> int: ...
|
||||
def window_frame_rows_start_end(self, start: None = ..., end: None = ...): ...
|
||||
def year_lookup_bounds_for_date_field(self, value: int) -> List[str]: ...
|
||||
def year_lookup_bounds_for_datetime_field(self, value: int) -> List[str]: ...
|
||||
69
django/db/backends/base/schema.pyi
Normal file
69
django/db/backends/base/schema.pyi
Normal file
@@ -0,0 +1,69 @@
|
||||
from django.db.backends.ddl_references import Statement
|
||||
from django.db.backends.sqlite3.base import DatabaseWrapper
|
||||
from django.db.backends.sqlite3.schema import DatabaseSchemaEditor
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.fields import Field
|
||||
from typing import (
|
||||
Any,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Type,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class BaseDatabaseSchemaEditor:
|
||||
def __enter__(self) -> DatabaseSchemaEditor: ...
|
||||
def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
connection: DatabaseWrapper,
|
||||
collect_sql: bool = ...,
|
||||
atomic: bool = ...
|
||||
) -> None: ...
|
||||
def _constraint_names(
|
||||
self,
|
||||
model: Type[Model],
|
||||
column_names: List[str] = ...,
|
||||
unique: Optional[bool] = ...,
|
||||
primary_key: None = ...,
|
||||
index: Optional[bool] = ...,
|
||||
foreign_key: None = ...,
|
||||
check: None = ...,
|
||||
type_: None = ...
|
||||
) -> List[str]: ...
|
||||
def _create_index_name(
|
||||
self,
|
||||
table_name: str,
|
||||
column_names: Union[Tuple[str, str, str], Tuple[str], List[str]],
|
||||
suffix: str = ...
|
||||
) -> str: ...
|
||||
def _create_index_sql(
|
||||
self,
|
||||
model: Any,
|
||||
fields: Any,
|
||||
*,
|
||||
name = ...,
|
||||
suffix = ...,
|
||||
using = ...,
|
||||
db_tablespace = ...,
|
||||
col_suffixes = ...,
|
||||
sql = ...
|
||||
) -> Statement: ...
|
||||
def _create_unique_sql(self, model: Any, columns: List[str]) -> Statement: ...
|
||||
def _delete_composed_index(
|
||||
self,
|
||||
model: Type[Model],
|
||||
fields: Tuple[str, str],
|
||||
constraint_kwargs: Dict[str, bool],
|
||||
sql: str
|
||||
) -> None: ...
|
||||
@classmethod
|
||||
def _digest(cls, *args) -> str: ...
|
||||
def _field_indexes_sql(
|
||||
self,
|
||||
model: Any,
|
||||
field: Field
|
||||
) -> List[Statement]: ...
|
||||
11
django/db/backends/base/validation.pyi
Normal file
11
django/db/backends/base/validation.pyi
Normal file
@@ -0,0 +1,11 @@
|
||||
from django.db.backends.base.base import BaseDatabaseWrapper
|
||||
from django.db.models.fields import Field
|
||||
from typing import (
|
||||
Any,
|
||||
List,
|
||||
)
|
||||
|
||||
|
||||
class BaseDatabaseValidation:
|
||||
def __init__(self, connection: BaseDatabaseWrapper) -> None: ...
|
||||
def check_field(self, field: Field, **kwargs) -> List[Any]: ...
|
||||
59
django/db/backends/ddl_references.pyi
Normal file
59
django/db/backends/ddl_references.pyi
Normal file
@@ -0,0 +1,59 @@
|
||||
from typing import (
|
||||
Callable,
|
||||
List,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class Columns:
|
||||
def __init__(
|
||||
self,
|
||||
table: str,
|
||||
columns: List[str],
|
||||
quote_name: Callable,
|
||||
col_suffixes: Union[List[str], Tuple] = ...
|
||||
) -> None: ...
|
||||
def __str__(self) -> str: ...
|
||||
|
||||
|
||||
class ForeignKeyName:
|
||||
def __init__(
|
||||
self,
|
||||
from_table: str,
|
||||
from_columns: List[str],
|
||||
to_table: str,
|
||||
to_columns: List[str],
|
||||
suffix_template: str,
|
||||
create_fk_name: Callable
|
||||
) -> None: ...
|
||||
def __str__(self) -> str: ...
|
||||
def references_column(self, table: str, column: str) -> bool: ...
|
||||
def references_table(self, table: str) -> bool: ...
|
||||
def rename_column_references(self, table: str, old_column: str, new_column: str) -> None: ...
|
||||
|
||||
|
||||
class IndexName:
|
||||
def __init__(self, table: str, columns: List[str], suffix: str, create_index_name: Callable) -> None: ...
|
||||
def __str__(self) -> str: ...
|
||||
|
||||
|
||||
class Statement:
|
||||
def __init__(self, template: str, **parts) -> None: ...
|
||||
def __str__(self) -> str: ...
|
||||
def references_column(self, table: str, column: str) -> bool: ...
|
||||
def references_table(self, table: str) -> bool: ...
|
||||
def rename_table_references(self, old_table: str, new_table: str) -> None: ...
|
||||
|
||||
|
||||
class Table:
|
||||
def __init__(self, table: str, quote_name: Callable) -> None: ...
|
||||
def __str__(self) -> str: ...
|
||||
def references_table(self, table: str) -> bool: ...
|
||||
def rename_table_references(self, old_table: str, new_table: str) -> None: ...
|
||||
|
||||
|
||||
class TableColumns:
|
||||
def __init__(self, table: str, columns: List[str]) -> None: ...
|
||||
def references_column(self, table: str, column: str) -> bool: ...
|
||||
def rename_column_references(self, table: str, old_column: str, new_column: str) -> None: ...
|
||||
4
django/db/backends/dummy/base.pyi
Normal file
4
django/db/backends/dummy/base.pyi
Normal file
@@ -0,0 +1,4 @@
|
||||
def complain(*args, **kwargs): ...
|
||||
|
||||
|
||||
def ignore(*args, **kwargs) -> None: ...
|
||||
10
django/db/backends/mysql/client.pyi
Normal file
10
django/db/backends/mysql/client.pyi
Normal file
@@ -0,0 +1,10 @@
|
||||
from typing import (
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
)
|
||||
|
||||
|
||||
class DatabaseClient:
|
||||
@classmethod
|
||||
def settings_to_cmd_args(cls, settings_dict: Dict[str, Union[str, None]]) -> List[str]: ...
|
||||
9
django/db/backends/postgresql/client.pyi
Normal file
9
django/db/backends/postgresql/client.pyi
Normal file
@@ -0,0 +1,9 @@
|
||||
from typing import Dict
|
||||
|
||||
|
||||
def _escape_pgpass(txt: str) -> str: ...
|
||||
|
||||
|
||||
class DatabaseClient:
|
||||
@classmethod
|
||||
def runshell_db(cls, conn_params: Dict[str, str]) -> None: ...
|
||||
82
django/db/backends/sqlite3/base.pyi
Normal file
82
django/db/backends/sqlite3/base.pyi
Normal file
@@ -0,0 +1,82 @@
|
||||
from datetime import datetime
|
||||
from sqlite3 import Connection
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def _sqlite_date_extract(lookup_type: str, dt: str) -> int: ...
|
||||
|
||||
|
||||
def _sqlite_date_trunc(lookup_type: str, dt: str) -> str: ...
|
||||
|
||||
|
||||
def _sqlite_datetime_cast_date(dt: str, tzname: Optional[str]) -> str: ...
|
||||
|
||||
|
||||
def _sqlite_datetime_cast_time(dt: str, tzname: Optional[str]) -> str: ...
|
||||
|
||||
|
||||
def _sqlite_datetime_extract(lookup_type: str, dt: str, tzname: Optional[str]) -> int: ...
|
||||
|
||||
|
||||
def _sqlite_datetime_parse(dt: str, tzname: Optional[str]) -> datetime: ...
|
||||
|
||||
|
||||
def _sqlite_datetime_trunc(lookup_type: str, dt: str, tzname: Optional[str]) -> str: ...
|
||||
|
||||
|
||||
def _sqlite_format_dtdelta(conn: str, lhs: Union[str, int], rhs: Union[str, int]) -> str: ...
|
||||
|
||||
|
||||
def _sqlite_lpad(text: str, length: int, fill_text: str) -> str: ...
|
||||
|
||||
|
||||
def _sqlite_regexp(re_pattern: str, re_string: Optional[str]) -> bool: ...
|
||||
|
||||
|
||||
def _sqlite_rpad(text: str, length: int, fill_text: str) -> str: ...
|
||||
|
||||
|
||||
def _sqlite_time_extract(lookup_type: str, dt: str) -> int: ...
|
||||
|
||||
|
||||
def _sqlite_time_trunc(lookup_type: str, dt: str) -> str: ...
|
||||
|
||||
|
||||
def _sqlite_timestamp_diff(lhs: str, rhs: str) -> int: ...
|
||||
|
||||
|
||||
def decoder(conv_func: Callable) -> Callable: ...
|
||||
|
||||
|
||||
class DatabaseWrapper:
|
||||
def _savepoint_allowed(self) -> bool: ...
|
||||
def _set_autocommit(self, autocommit: bool) -> None: ...
|
||||
def _start_transaction_under_autocommit(self) -> None: ...
|
||||
def check_constraints(self, table_names: List[str] = ...) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def create_cursor(self, name: None = ...) -> SQLiteCursorWrapper: ...
|
||||
def disable_constraint_checking(self) -> bool: ...
|
||||
def enable_constraint_checking(self) -> None: ...
|
||||
def get_connection_params(self) -> Dict[str, Union[int, str]]: ...
|
||||
def get_new_connection(self, conn_params: Dict[str, Union[int, str]]) -> Connection: ...
|
||||
def init_connection_state(self) -> None: ...
|
||||
def is_in_memory_db(self) -> bool: ...
|
||||
def is_usable(self) -> bool: ...
|
||||
|
||||
|
||||
class SQLiteCursorWrapper:
|
||||
def convert_query(self, query: str) -> str: ...
|
||||
def execute(self, query: str, params: Any = ...) -> SQLiteCursorWrapper: ...
|
||||
def executemany(
|
||||
self,
|
||||
query: str,
|
||||
param_list: Union[List[Tuple[int]], List[Tuple[int, int]]]
|
||||
) -> SQLiteCursorWrapper: ...
|
||||
10
django/db/backends/sqlite3/creation.pyi
Normal file
10
django/db/backends/sqlite3/creation.pyi
Normal file
@@ -0,0 +1,10 @@
|
||||
from typing import Tuple
|
||||
|
||||
|
||||
class DatabaseCreation:
|
||||
def _create_test_db(self, verbosity: int, autoclobber: bool, keepdb: bool = ...) -> str: ...
|
||||
def _destroy_test_db(self, test_database_name: str, verbosity: int) -> None: ...
|
||||
def _get_test_db_name(self) -> str: ...
|
||||
@staticmethod
|
||||
def is_in_memory_db(database_name: str) -> bool: ...
|
||||
def test_db_signature(self) -> Tuple[str, str]: ...
|
||||
3
django/db/backends/sqlite3/features.pyi
Normal file
3
django/db/backends/sqlite3/features.pyi
Normal file
@@ -0,0 +1,3 @@
|
||||
class DatabaseFeatures:
|
||||
@cached_property
|
||||
def supports_stddev(self) -> bool: ...
|
||||
65
django/db/backends/sqlite3/introspection.pyi
Normal file
65
django/db/backends/sqlite3/introspection.pyi
Normal file
@@ -0,0 +1,65 @@
|
||||
from django.db.backends.base.introspection import (
|
||||
FieldInfo,
|
||||
TableInfo,
|
||||
)
|
||||
from django.db.backends.utils import CursorWrapper
|
||||
from django.db.models.fields import CharField
|
||||
from django.db.models.fields.related import ForeignKey
|
||||
from typing import (
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def get_field_size(name: str) -> Optional[int]: ...
|
||||
|
||||
|
||||
class DatabaseIntrospection:
|
||||
def _get_foreign_key_constraints(
|
||||
self,
|
||||
cursor: CursorWrapper,
|
||||
table_name: str
|
||||
) -> Dict[str, Dict[str, Union[List[str], bool, Tuple[str, str]]]]: ...
|
||||
def _table_info(
|
||||
self,
|
||||
cursor: CursorWrapper,
|
||||
name: str
|
||||
) -> List[Dict[str, Union[str, None, int]]]: ...
|
||||
def get_constraints(
|
||||
self,
|
||||
cursor: CursorWrapper,
|
||||
table_name: str
|
||||
) -> Dict[str, Dict[str, Union[List[str], bool, str, Tuple[str, str]]]]: ...
|
||||
def get_key_columns(
|
||||
self,
|
||||
cursor: CursorWrapper,
|
||||
table_name: str
|
||||
) -> List[Tuple[str, str, str]]: ...
|
||||
def get_primary_key_column(self, cursor: CursorWrapper, table_name: str) -> str: ...
|
||||
def get_relations(
|
||||
self,
|
||||
cursor: CursorWrapper,
|
||||
table_name: str
|
||||
) -> Dict[str, Tuple[str, str]]: ...
|
||||
def get_sequences(
|
||||
self,
|
||||
cursor: CursorWrapper,
|
||||
table_name: str,
|
||||
table_fields: List[Union[ForeignKey, CharField]] = ...
|
||||
) -> List[Dict[str, str]]: ...
|
||||
def get_table_description(
|
||||
self,
|
||||
cursor: CursorWrapper,
|
||||
table_name: str
|
||||
) -> List[FieldInfo]: ...
|
||||
def get_table_list(
|
||||
self,
|
||||
cursor: CursorWrapper
|
||||
) -> List[TableInfo]: ...
|
||||
|
||||
|
||||
class FlexibleFieldLookupDict:
|
||||
def __getitem__(self, key: str) -> Union[str, Tuple[str, Dict[str, int]]]: ...
|
||||
114
django/db/backends/sqlite3/operations.pyi
Normal file
114
django/db/backends/sqlite3/operations.pyi
Normal file
@@ -0,0 +1,114 @@
|
||||
from datetime import (
|
||||
date,
|
||||
datetime,
|
||||
time,
|
||||
timedelta,
|
||||
)
|
||||
from django.core.management.color import Style
|
||||
from django.db.backends.sqlite3.base import (
|
||||
DatabaseWrapper,
|
||||
SQLiteCursorWrapper,
|
||||
)
|
||||
from django.db.backends.utils import CursorDebugWrapper
|
||||
from django.db.models.aggregates import Aggregate
|
||||
from django.db.models.expressions import (
|
||||
BaseExpression,
|
||||
Col,
|
||||
CombinedExpression,
|
||||
Expression,
|
||||
F,
|
||||
)
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
from uuid import UUID
|
||||
|
||||
|
||||
class DatabaseOperations:
|
||||
def _convert_tzname_to_sql(self, tzname: Optional[str]) -> str: ...
|
||||
def _quote_params_for_last_executed_query(self, params: Any): ...
|
||||
def adapt_datetimefield_value(
|
||||
self,
|
||||
value: Optional[Union[datetime, F]]
|
||||
) -> Optional[Union[str, F]]: ...
|
||||
def adapt_timefield_value(self, value: Optional[time]) -> Optional[str]: ...
|
||||
def bulk_batch_size(self, fields: Any, objs: Any) -> int: ...
|
||||
def bulk_insert_sql(self, fields: Any, placeholder_rows: Any) -> str: ...
|
||||
def check_expression_support(self, expression: BaseExpression) -> None: ...
|
||||
def combine_duration_expression(self, connector: str, sub_expressions: List[str]) -> str: ...
|
||||
def combine_expression(self, connector: str, sub_expressions: List[str]) -> str: ...
|
||||
def convert_booleanfield_value(
|
||||
self,
|
||||
value: Optional[int],
|
||||
expression: Expression,
|
||||
connection: DatabaseWrapper
|
||||
) -> Optional[bool]: ...
|
||||
def convert_datefield_value(
|
||||
self,
|
||||
value: Optional[Union[str, date]],
|
||||
expression: Expression,
|
||||
connection: DatabaseWrapper
|
||||
) -> Optional[date]: ...
|
||||
def convert_datetimefield_value(
|
||||
self,
|
||||
value: Optional[Union[str, datetime]],
|
||||
expression: Expression,
|
||||
connection: DatabaseWrapper
|
||||
) -> Optional[datetime]: ...
|
||||
def convert_timefield_value(
|
||||
self,
|
||||
value: Optional[Union[str, time]],
|
||||
expression: Expression,
|
||||
connection: DatabaseWrapper
|
||||
) -> Optional[time]: ...
|
||||
def convert_uuidfield_value(
|
||||
self,
|
||||
value: Optional[str],
|
||||
expression: Col,
|
||||
connection: DatabaseWrapper
|
||||
) -> Optional[UUID]: ...
|
||||
def date_extract_sql(self, lookup_type: str, field_name: str) -> str: ...
|
||||
def date_interval_sql(self, timedelta: timedelta) -> str: ...
|
||||
def date_trunc_sql(self, lookup_type: str, field_name: str) -> str: ...
|
||||
def datetime_cast_date_sql(self, field_name: str, tzname: str) -> str: ...
|
||||
def datetime_cast_time_sql(self, field_name: str, tzname: str) -> str: ...
|
||||
def datetime_extract_sql(self, lookup_type: str, field_name: str, tzname: Optional[str]) -> str: ...
|
||||
def datetime_trunc_sql(self, lookup_type: str, field_name: str, tzname: Optional[str]) -> str: ...
|
||||
def execute_sql_flush(self, using: str, sql_list: List[str]) -> None: ...
|
||||
def format_for_duration_arithmetic(self, sql: str) -> str: ...
|
||||
def get_db_converters(self, expression: Expression) -> List[Callable]: ...
|
||||
def get_decimalfield_converter(
|
||||
self,
|
||||
expression: Union[Col, CombinedExpression, Aggregate]
|
||||
) -> Callable: ...
|
||||
def integer_field_range(self, internal_type: str) -> Tuple[None, None]: ...
|
||||
def last_executed_query(
|
||||
self,
|
||||
cursor: Union[SQLiteCursorWrapper, CursorDebugWrapper],
|
||||
sql: str,
|
||||
params: Optional[Union[Tuple, List[str]]]
|
||||
) -> str: ...
|
||||
def no_limit_value(self) -> int: ...
|
||||
def pk_default_value(self) -> str: ...
|
||||
def quote_name(self, name: str) -> str: ...
|
||||
def sql_flush(
|
||||
self,
|
||||
style: Style,
|
||||
tables: List[str],
|
||||
sequences: Union[List[Dict[str, str]], Tuple],
|
||||
allow_cascade: bool = ...
|
||||
) -> List[str]: ...
|
||||
def subtract_temporals(
|
||||
self,
|
||||
internal_type: str,
|
||||
lhs: Tuple[str, List[Any]],
|
||||
rhs: Union[Tuple[str, List[Any]], Tuple[str, List[str]]]
|
||||
) -> Union[Tuple[str, List[Any]], Tuple[str, List[str]]]: ...
|
||||
def time_extract_sql(self, lookup_type: str, field_name: str) -> str: ...
|
||||
def time_trunc_sql(self, lookup_type: str, field_name: str) -> str: ...
|
||||
62
django/db/backends/sqlite3/schema.pyi
Normal file
62
django/db/backends/sqlite3/schema.pyi
Normal file
@@ -0,0 +1,62 @@
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.fields import (
|
||||
AutoField,
|
||||
Field,
|
||||
IntegerField,
|
||||
SlugField,
|
||||
TimeField,
|
||||
)
|
||||
from typing import (
|
||||
Any,
|
||||
Dict,
|
||||
Optional,
|
||||
Type,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class DatabaseSchemaEditor:
|
||||
def __enter__(self) -> DatabaseSchemaEditor: ...
|
||||
def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ...
|
||||
def _alter_field(
|
||||
self,
|
||||
model: Any,
|
||||
old_field: Field,
|
||||
new_field: Field,
|
||||
old_type: str,
|
||||
new_type: str,
|
||||
old_db_params: Dict[str, Union[str, None]],
|
||||
new_db_params: Dict[str, Union[str, None]],
|
||||
strict: bool = ...
|
||||
) -> None: ...
|
||||
def _is_referenced_by_fk_constraint(
|
||||
self,
|
||||
table_name: str,
|
||||
column_name: Optional[str] = ...,
|
||||
ignore_self: bool = ...
|
||||
) -> bool: ...
|
||||
def _remake_table(
|
||||
self,
|
||||
model: Any,
|
||||
create_field: Optional[Union[IntegerField, TimeField]] = ...,
|
||||
delete_field: Optional[Union[AutoField, SlugField]] = ...,
|
||||
alter_field: Any = ...
|
||||
) -> None: ...
|
||||
def add_field(self, model: Type[Model], field: Field) -> None: ...
|
||||
def alter_db_table(
|
||||
self,
|
||||
model: Any,
|
||||
old_db_table: str,
|
||||
new_db_table: str,
|
||||
disable_constraints: bool = ...
|
||||
) -> None: ...
|
||||
def alter_field(
|
||||
self,
|
||||
model: Any,
|
||||
old_field: Field,
|
||||
new_field: Field,
|
||||
strict: bool = ...
|
||||
) -> None: ...
|
||||
def delete_model(self, model: Any, handle_autom2m: bool = ...) -> None: ...
|
||||
def quote_value(self, value: Optional[Union[int, memoryview, str]]) -> str: ...
|
||||
def remove_field(self, model: Type[Model], field: Field) -> None: ...
|
||||
78
django/db/backends/utils.pyi
Normal file
78
django/db/backends/utils.pyi
Normal file
@@ -0,0 +1,78 @@
|
||||
from datetime import (
|
||||
date,
|
||||
time,
|
||||
)
|
||||
from decimal import Decimal
|
||||
from django.db.backends.sqlite3.base import (
|
||||
DatabaseWrapper,
|
||||
SQLiteCursorWrapper,
|
||||
)
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def format_number(
|
||||
value: Optional[Decimal],
|
||||
max_digits: Optional[int],
|
||||
decimal_places: Optional[int]
|
||||
) -> Optional[str]: ...
|
||||
|
||||
|
||||
def rev_typecast_decimal(d: Decimal) -> str: ...
|
||||
|
||||
|
||||
def split_identifier(identifier: str) -> Tuple[str, str]: ...
|
||||
|
||||
|
||||
def strip_quotes(table_name: str) -> str: ...
|
||||
|
||||
|
||||
def truncate_name(identifier: str, length: Optional[int] = ..., hash_len: int = ...) -> str: ...
|
||||
|
||||
|
||||
def typecast_date(s: str) -> date: ...
|
||||
|
||||
|
||||
def typecast_time(s: str) -> Optional[time]: ...
|
||||
|
||||
|
||||
def typecast_timestamp(s: str) -> date: ...
|
||||
|
||||
|
||||
class CursorDebugWrapper:
|
||||
def execute(self, sql: str, params: Optional[Union[Tuple, List[str]]] = ...): ...
|
||||
|
||||
|
||||
class CursorWrapper:
|
||||
def __enter__(self) -> CursorWrapper: ...
|
||||
def __exit__(self, type: None, value: None, traceback: None) -> None: ...
|
||||
def __getattr__(self, attr: str) -> Any: ...
|
||||
def __init__(
|
||||
self,
|
||||
cursor: SQLiteCursorWrapper,
|
||||
db: DatabaseWrapper
|
||||
) -> None: ...
|
||||
def __iter__(self) -> None: ...
|
||||
def _execute(self, sql: str, params: Any, *ignored_wrapper_args): ...
|
||||
def _execute_with_wrappers(
|
||||
self,
|
||||
sql: str,
|
||||
params: Any,
|
||||
many: bool,
|
||||
executor: Callable
|
||||
) -> Optional[SQLiteCursorWrapper]: ...
|
||||
def _executemany(
|
||||
self,
|
||||
sql: str,
|
||||
param_list: Union[List[Tuple[int]], List[Tuple[int, int, int]]],
|
||||
*ignored_wrapper_args
|
||||
): ...
|
||||
def callproc(self, procname: str, params: List[Any] = ..., kparams: Dict[str, int] = ...): ...
|
||||
def execute(self, sql: str, params: Any = ...) -> SQLiteCursorWrapper: ...
|
||||
Reference in New Issue
Block a user