File: ddl_references.pyi

package info (click to toggle)
python-django-stubs 5.2.9-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,832 kB
  • sloc: python: 5,185; makefile: 15; sh: 8
file content (88 lines) | stat: -rw-r--r-- 3,384 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
from collections.abc import Sequence
from typing import Any, Protocol, type_check_only

@type_check_only
class _QuoteCallable(Protocol):
    """Get rid of `cannot assign to method`"""

    def __call__(self, column: str, /) -> str: ...

class Reference:
    def references_table(self, table: Any) -> bool: ...
    def references_column(self, table: Any, column: Any) -> bool: ...
    def references_index(self, table: Any, index: Any) -> bool: ...
    def rename_table_references(self, old_table: Any, new_table: Any) -> None: ...
    def rename_column_references(self, table: Any, old_column: Any, new_column: Any) -> None: ...

class Table(Reference):
    table: str
    quote_name: _QuoteCallable
    def __init__(self, table: str, quote_name: _QuoteCallable) -> None: ...
    def references_index(self, table: Any, index: Any) -> bool: ...
    def references_table(self, table: str) -> bool: ...
    def rename_table_references(self, old_table: str, new_table: str) -> None: ...

class TableColumns(Table):
    table: str
    columns: list[str]
    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: ...

class Columns(TableColumns):
    columns: list[str]
    table: str
    quote_name: _QuoteCallable
    col_suffixes: Sequence[str]
    def __init__(
        self, table: str, columns: list[str], quote_name: _QuoteCallable, col_suffixes: Sequence[str] = ()
    ) -> None: ...

@type_check_only
class _NameCallable(Protocol):
    """Get rid of `cannot assign to method`"""

    def __call__(self, table: str, columns: list[str], suffix: str, /) -> str: ...

class IndexName(TableColumns):
    columns: list[str]
    table: str
    suffix: str
    create_index_name: _NameCallable
    def __init__(self, table: str, columns: list[str], suffix: str, create_index_name: _NameCallable) -> None: ...

class IndexColumns(Columns):
    opclasses: Any
    def __init__(
        self, table: Any, columns: Any, quote_name: Any, col_suffixes: Any = (), opclasses: Any = ()
    ) -> None: ...

class ForeignKeyName(TableColumns):
    columns: list[str]
    table: str
    to_reference: TableColumns
    suffix_template: str
    create_fk_name: _NameCallable
    def __init__(
        self,
        from_table: str,
        from_columns: list[str],
        to_table: str,
        to_columns: list[str],
        suffix_template: str,
        create_fk_name: _NameCallable,
    ) -> None: ...
    def references_table(self, table: str) -> bool: ...
    def references_column(self, table: str, column: str) -> bool: ...
    def rename_table_references(self, old_table: str, new_table: str) -> None: ...
    def rename_column_references(self, table: str, old_column: str, new_column: str) -> None: ...

class Statement(Reference):
    template: str
    parts: dict[str, Table]
    def __init__(self, template: str, **parts: Any) -> None: ...
    def references_table(self, table: str) -> bool: ...
    def references_column(self, table: str, column: str) -> bool: ...
    def references_index(self, table: Any, index: Any) -> bool: ...
    def rename_table_references(self, old_table: str, new_table: str) -> None: ...
    def rename_column_references(self, table: str, old_column: str, new_column: str) -> None: ...