Missing stubs (#467)

* adding missing db.backends typings and updated test

* added missing stubs

* reformatted files

* removed contrib.postgres.forms

* fixed test
This commit is contained in:
Na'aman Hirschfeld
2020-10-11 11:14:08 +02:00
committed by GitHub
parent 2a732fd257
commit ce370ea79f
188 changed files with 4708 additions and 21 deletions

View File

@@ -0,0 +1,57 @@
from django.db.backends.base.base import BaseDatabaseWrapper as BaseDatabaseWrapper
from typing import Any, Optional
def wrap_oracle_errors() -> None: ...
class _UninitializedOperatorsDescriptor:
def __get__(self, instance: Any, cls: Optional[Any] = ...): ...
class DatabaseWrapper(BaseDatabaseWrapper):
vendor: str = ...
display_name: str = ...
data_types: Any = ...
data_type_check_constraints: Any = ...
operators: Any = ...
pattern_esc: str = ...
Database: Any = ...
SchemaEditorClass: Any = ...
client_class: Any = ...
creation_class: Any = ...
features_class: Any = ...
introspection_class: Any = ...
ops_class: Any = ...
validation_class: Any = ...
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def get_connection_params(self): ...
def get_new_connection(self, conn_params: Any): ...
pattern_ops: Any = ...
def init_connection_state(self) -> None: ...
def create_cursor(self, name: Optional[Any] = ...): ...
def check_constraints(self, table_names: Optional[Any] = ...) -> None: ...
def is_usable(self): ...
def cx_oracle_version(self): ...
def oracle_version(self): ...
class OracleParam:
force_bytes: Any = ...
input_size: Any = ...
def __init__(self, param: Any, cursor: Any, strings_only: bool = ...) -> None: ...
class VariableWrapper:
var: Any = ...
def __init__(self, var: Any) -> None: ...
def bind_parameter(self, cursor: Any): ...
def __getattr__(self, key: Any): ...
def __setattr__(self, key: Any, value: Any) -> None: ...
class FormatStylePlaceholderCursor:
charset: str = ...
cursor: Any = ...
def __init__(self, connection: Any) -> None: ...
def execute(self, query: Any, params: Optional[Any] = ...): ...
def executemany(self, query: Any, params: Optional[Any] = ...): ...
def close(self) -> None: ...
def var(self, *args: Any): ...
def arrayvar(self, *args: Any): ...
def __getattr__(self, attr: Any): ...
def __iter__(self) -> Any: ...

View File

@@ -0,0 +1,5 @@
from django.db.backends.base.client import BaseDatabaseClient as BaseDatabaseClient
class DatabaseClient(BaseDatabaseClient):
executable_name: str = ...
wrapper_name: str = ...

View File

@@ -0,0 +1,8 @@
from django.db.backends.base.creation import BaseDatabaseCreation as BaseDatabaseCreation
from typing import Any
TEST_DATABASE_PREFIX: str
class DatabaseCreation(BaseDatabaseCreation):
def set_as_test_mirror(self, primary_settings_dict: Any) -> None: ...
def test_db_signature(self): ...

View File

@@ -0,0 +1,48 @@
from django.db.backends.base.features import BaseDatabaseFeatures as BaseDatabaseFeatures
from typing import Any
class DatabaseFeatures(BaseDatabaseFeatures):
interprets_empty_strings_as_nulls: bool = ...
has_select_for_update: bool = ...
has_select_for_update_nowait: bool = ...
has_select_for_update_skip_locked: bool = ...
has_select_for_update_of: bool = ...
select_for_update_of_column: bool = ...
can_return_columns_from_insert: bool = ...
can_introspect_autofield: bool = ...
supports_subqueries_in_group_by: bool = ...
supports_transactions: bool = ...
supports_timezones: bool = ...
has_native_duration_field: bool = ...
can_defer_constraint_checks: bool = ...
supports_partially_nullable_unique_constraints: bool = ...
supports_deferrable_unique_constraints: bool = ...
truncates_names: bool = ...
supports_tablespaces: bool = ...
supports_sequence_reset: bool = ...
can_introspect_materialized_views: bool = ...
can_introspect_time_field: bool = ...
atomic_transactions: bool = ...
supports_combined_alters: bool = ...
nulls_order_largest: bool = ...
requires_literal_defaults: bool = ...
closed_cursor_error_class: Any = ...
bare_select_suffix: str = ...
supports_select_for_update_with_limit: bool = ...
supports_temporal_subtraction: bool = ...
ignores_table_name_case: bool = ...
supports_index_on_text_field: bool = ...
has_case_insensitive_like: bool = ...
create_test_procedure_without_params_sql: str = ...
create_test_procedure_with_int_param_sql: str = ...
supports_callproc_kwargs: bool = ...
supports_over_clause: bool = ...
supports_frame_range_fixed_distance: bool = ...
supports_ignore_conflicts: bool = ...
max_query_params: Any = ...
supports_partial_indexes: bool = ...
supports_slicing_ordering_in_compound: bool = ...
allows_multiple_constraints_on_same_fields: bool = ...
supports_boolean_expr_in_select_clause: bool = ...
supports_primitives_in_json_field: bool = ...
supports_json_field_contains: bool = ...

View File

@@ -0,0 +1,12 @@
from django.db.models import Func as Func
from typing import Any, Optional
class IntervalToSeconds(Func):
function: str = ...
template: str = ...
def __init__(self, expression: Any, *, output_field: Optional[Any] = ..., **extra: Any) -> None: ...
class SecondsToInterval(Func):
function: str = ...
template: str = ...
def __init__(self, expression: Any, *, output_field: Optional[Any] = ..., **extra: Any) -> None: ...

View File

@@ -0,0 +1,17 @@
from django.db.backends.base.introspection import BaseDatabaseIntrospection as BaseDatabaseIntrospection
from typing import Any
FieldInfo: Any
class DatabaseIntrospection(BaseDatabaseIntrospection):
cache_bust_counter: int = ...
def data_types_reverse(self): ...
def get_field_type(self, data_type: Any, description: Any): ...
def get_table_list(self, cursor: Any): ...
def get_table_description(self, cursor: Any, table_name: Any): ...
def identifier_converter(self, name: Any): ...
def get_sequences(self, cursor: Any, table_name: Any, table_fields: Any = ...): ...
def get_relations(self, cursor: Any, table_name: Any): ...
def get_key_columns(self, cursor: Any, table_name: Any): ...
def get_primary_key_column(self, cursor: Any, table_name: Any): ...
def get_constraints(self, cursor: Any, table_name: Any): ...

View File

@@ -0,0 +1,57 @@
from django.db.backends.base.operations import BaseDatabaseOperations as BaseDatabaseOperations
from typing import Any, Optional
class DatabaseOperations(BaseDatabaseOperations):
integer_field_ranges: Any = ...
set_operators: Any = ...
cast_char_field_without_max_length: str = ...
cast_data_types: Any = ...
def cache_key_culling_sql(self): ...
def date_extract_sql(self, lookup_type: Any, field_name: Any): ...
def date_trunc_sql(self, lookup_type: Any, field_name: Any): ...
def datetime_cast_date_sql(self, field_name: Any, tzname: Any): ...
def datetime_cast_time_sql(self, field_name: Any, tzname: Any): ...
def datetime_extract_sql(self, lookup_type: Any, field_name: Any, tzname: Any): ...
def datetime_trunc_sql(self, lookup_type: Any, field_name: Any, tzname: Any): ...
def time_trunc_sql(self, lookup_type: Any, field_name: Any): ...
def get_db_converters(self, expression: Any): ...
def convert_textfield_value(self, value: Any, expression: Any, connection: Any): ...
def convert_binaryfield_value(self, value: Any, expression: Any, connection: Any): ...
def convert_booleanfield_value(self, value: Any, expression: Any, connection: Any): ...
def convert_datetimefield_value(self, value: Any, expression: Any, connection: Any): ...
def convert_datefield_value(self, value: Any, expression: Any, connection: Any): ...
def convert_timefield_value(self, value: Any, expression: Any, connection: Any): ...
def convert_uuidfield_value(self, value: Any, expression: Any, connection: Any): ...
@staticmethod
def convert_empty_string(value: Any, expression: Any, connection: Any): ...
@staticmethod
def convert_empty_bytes(value: Any, expression: Any, connection: Any): ...
def deferrable_sql(self): ...
def fetch_returned_insert_columns(self, cursor: Any, returning_params: Any): ...
def field_cast_sql(self, db_type: Any, internal_type: Any): ...
def no_limit_value(self) -> None: ...
def limit_offset_sql(self, low_mark: Any, high_mark: Any): ...
def last_executed_query(self, cursor: Any, sql: Any, params: Any): ...
def last_insert_id(self, cursor: Any, table_name: Any, pk_name: Any): ...
def lookup_cast(self, lookup_type: Any, internal_type: Optional[Any] = ...): ...
def max_in_list_size(self): ...
def max_name_length(self): ...
def pk_default_value(self): ...
def prep_for_iexact_query(self, x: Any): ...
def process_clob(self, value: Any): ...
def quote_name(self, name: Any): ...
def random_function_sql(self): ...
def regex_lookup(self, lookup_type: Any): ...
def return_insert_columns(self, fields: Any): ...
def sequence_reset_by_name_sql(self, style: Any, sequences: Any): ...
def sequence_reset_sql(self, style: Any, model_list: Any): ...
def start_transaction_sql(self): ...
def tablespace_sql(self, tablespace: Any, inline: bool = ...): ...
def adapt_datefield_value(self, value: Any): ...
def adapt_datetimefield_value(self, value: Any): ...
def adapt_timefield_value(self, value: Any): ...
def combine_expression(self, connector: Any, sub_expressions: Any): ...
def bulk_insert_sql(self, fields: Any, placeholder_rows: Any): ...
def subtract_temporals(self, internal_type: Any, lhs: Any, rhs: Any): ...
def bulk_batch_size(self, fields: Any, objs: Any): ...
def conditional_expression_supported_in_where_clause(self, expression: Any): ...

View File

@@ -0,0 +1,20 @@
from django.db.backends.base.schema import BaseDatabaseSchemaEditor as BaseDatabaseSchemaEditor
from typing import Any
class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
sql_create_column: str = ...
sql_alter_column_type: str = ...
sql_alter_column_null: str = ...
sql_alter_column_not_null: str = ...
sql_alter_column_default: str = ...
sql_alter_column_no_default: str = ...
sql_delete_column: str = ...
sql_create_column_inline_fk: str = ...
sql_delete_table: str = ...
sql_create_index: str = ...
def quote_value(self, value: Any): ...
def remove_field(self, model: Any, field: Any) -> None: ...
def delete_model(self, model: Any) -> None: ...
def alter_field(self, model: Any, old_field: Any, new_field: Any, strict: bool = ...) -> None: ...
def normalize_name(self, name: Any): ...
def prepare_default(self, value: Any): ...

View File

@@ -0,0 +1,24 @@
import datetime
from typing import Any
class InsertVar:
types: Any = ...
db_type: Any = ...
bound_param: Any = ...
def __init__(self, field: Any) -> None: ...
def bind_parameter(self, cursor: Any): ...
def get_value(self): ...
class Oracle_datetime(datetime.datetime):
input_size: Any = ...
@classmethod
def from_datetime(cls, dt: Any): ...
class BulkInsertMapper:
BLOB: str = ...
CLOB: str = ...
DATE: str = ...
INTERVAL: str = ...
NUMBER: str = ...
TIMESTAMP: str = ...
types: Any = ...

View File

@@ -0,0 +1,5 @@
from django.db.backends.base.validation import BaseDatabaseValidation as BaseDatabaseValidation
from typing import Any
class DatabaseValidation(BaseDatabaseValidation):
def check_field_type(self, field: Any, field_type: Any): ...