app.pyi 4.58 KB
Newer Older
1
2
3
4
"""
This type stub file was generated by pyright.
"""

20after4's avatar
20after4 committed
5
from datasette.database import Database
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from .utils.asgi import NotFound

app_root = ...
SQLITE_LIMIT_ATTACHED = ...
Setting = ...
SETTINGS = ...
DEFAULT_SETTINGS = ...
async def favicon(request, send): # -> None:
    ...

class Datasette:
    INFO = ...
    WARNING = ...
    ERROR = ...
    def __init__(self, files, immutables=..., cache_headers=..., cors=..., inspect_data=..., metadata=..., sqlite_extensions=..., template_dir=..., plugins_dir=..., static_mounts=..., memory=..., config=..., secret=..., version_note=..., config_dir=..., pdb=..., crossdb=...) -> None:
        ...
20after4's avatar
20after4 committed
22

23
24
    async def refresh_schemas(self): # -> None:
        ...
20after4's avatar
20after4 committed
25

26
27
28
    @property
    def urls(self): # -> Urls:
        ...
20after4's avatar
20after4 committed
29

30
31
    async def invoke_startup(self): # -> None:
        ...
20after4's avatar
20after4 committed
32

33
34
    def sign(self, value, namespace=...): # -> _t_str_bytes:
        ...
20after4's avatar
20after4 committed
35

36
37
    def unsign(self, signed, namespace=...): # -> Any:
        ...
20after4's avatar
20after4 committed
38
39

    def get_database(self, name=...) -> Database:
40
        ...
20after4's avatar
20after4 committed
41

42
43
    def add_database(self, db, name=...):
        ...
20after4's avatar
20after4 committed
44
45

    def add_memory_database(self, memory_name) -> Database:
46
        ...
20after4's avatar
20after4 committed
47

48
49
    def remove_database(self, name): # -> None:
        ...
20after4's avatar
20after4 committed
50

51
52
    def setting(self, key): # -> Any | None:
        ...
20after4's avatar
20after4 committed
53

54
55
    def config_dict(self): # -> dict[Any, Any | None]:
        ...
20after4's avatar
20after4 committed
56

57
58
59
60
61
62
    def metadata(self, key=..., database=..., table=..., fallback=...): # -> dict[Unknown, Unknown] | None:
        """
        Looks up metadata, cascading backwards from specified level.
        Returns None if metadata value is not found.
        """
        ...
20after4's avatar
20after4 committed
63

64
65
66
    def plugin_config(self, plugin_name, database=..., table=..., fallback=...): # -> str | dict[Unknown, Unknown] | list[Unknown] | None:
        """Return config for plugin, falling back from specified database/table"""
        ...
20after4's avatar
20after4 committed
67

68
69
    def app_css_hash(self): # -> str:
        ...
20after4's avatar
20after4 committed
70

71
72
    async def get_canned_queries(self, database_name, actor): # -> dict[Unknown, Unknown]:
        ...
20after4's avatar
20after4 committed
73

74
75
    async def get_canned_query(self, database_name, query_name, actor): # -> None:
        ...
20after4's avatar
20after4 committed
76

77
78
    def update_with_inherited_metadata(self, metadata): # -> None:
        ...
20after4's avatar
20after4 committed
79

80
81
    def add_message(self, request, message, type=...): # -> None:
        ...
20after4's avatar
20after4 committed
82

83
84
85
    async def permission_allowed(self, actor, action, resource=..., default=...):
        """Check permissions using the permissions_allowed plugin hook"""
        ...
20after4's avatar
20after4 committed
86

87
88
    async def execute(self, db_name, sql, params=..., truncate=..., custom_time_limit=..., page_size=..., log_sql_errors=...):
        ...
20after4's avatar
20after4 committed
89

90
91
92
    async def expand_foreign_keys(self, database, table, column, values): # -> dict[tuple[Unknown, Unknown], str]:
        """Returns dict mapping (column, value) -> label"""
        ...
20after4's avatar
20after4 committed
93

94
95
    def absolute_url(self, request, path):
        ...
20after4's avatar
20after4 committed
96

97
98
99
    def table_metadata(self, database, table): # -> dict[Unknown, Unknown]:
        """Fetch table-specific metadata."""
        ...
20after4's avatar
20after4 committed
100

101
102
    async def render_template(self, templates, context=..., request=..., view_name=...): # -> str:
        ...
20after4's avatar
20after4 committed
103

104
105
106
    def app(self): # -> AsgiLifespan:
        """Returns an ASGI app function that serves the whole of Datasette"""
        ...
20after4's avatar
20after4 committed
107

108
109
110
111
112


class DatasetteRouter:
    def __init__(self, datasette, routes) -> None:
        ...
20after4's avatar
20after4 committed
113

114
115
    async def __call__(self, scope, receive, send): # -> None:
        ...
20after4's avatar
20after4 committed
116

117
118
    async def route_path(self, scope, receive, send, path): # -> None:
        ...
20after4's avatar
20after4 committed
119

120
121
    async def handle_404(self, request, send, exception=...): # -> None:
        ...
20after4's avatar
20after4 committed
122

123
124
    async def handle_500(self, request, send, exception): # -> None:
        ...
20after4's avatar
20after4 committed
125

126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145


_cleaner_task_str_re = ...
def wrap_view(view_fn, datasette): # -> (request: Unknown, send: Unknown) -> Coroutine[Any, Any, Unknown | None]:
    ...

def permanent_redirect(path, forward_query_string=..., forward_rest=...): # -> (request: Unknown, send: Unknown) -> Coroutine[Any, Any, Unknown | None]:
    ...

_curly_re = ...
def route_pattern_from_filepath(filepath): # -> Pattern[str]:
    ...

class NotFoundExplicit(NotFound):
    ...


class DatasetteClient:
    def __init__(self, ds) -> None:
        ...
20after4's avatar
20after4 committed
146

147
148
    async def get(self, path, **kwargs): # -> Response:
        ...
20after4's avatar
20after4 committed
149

150
151
    async def options(self, path, **kwargs): # -> Response:
        ...
20after4's avatar
20after4 committed
152

153
154
    async def head(self, path, **kwargs): # -> Response:
        ...
20after4's avatar
20after4 committed
155

156
157
    async def post(self, path, **kwargs): # -> Response:
        ...
20after4's avatar
20after4 committed
158

159
160
    async def put(self, path, **kwargs): # -> Response:
        ...
20after4's avatar
20after4 committed
161

162
163
    async def patch(self, path, **kwargs): # -> Response:
        ...
20after4's avatar
20after4 committed
164

165
166
    async def delete(self, path, **kwargs): # -> Response:
        ...
20after4's avatar
20after4 committed
167

168
169
    async def request(self, method, path, **kwargs): # -> Response:
        ...
20after4's avatar
20after4 committed
170

171
172