@anvil-works/anvil-pyright 0.0.1 → 0.0.2-canary

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/dist/anvil-typeshed/TODOS.md +70 -0
  2. package/dist/anvil-typeshed/client/anvil/__init__.pyi +1291 -0
  3. package/dist/anvil-typeshed/client/anvil/__pycache__/server.cpython-39.pyc +0 -0
  4. package/dist/anvil-typeshed/client/anvil/email.pyi +152 -0
  5. package/dist/anvil-typeshed/client/anvil/facebook/__init__.pyi +8 -0
  6. package/dist/anvil-typeshed/client/anvil/facebook/auth.pyi +30 -0
  7. package/dist/anvil-typeshed/client/anvil/google/__init__.pyi +11 -0
  8. package/dist/anvil-typeshed/client/anvil/google/auth.pyi +37 -0
  9. package/dist/anvil-typeshed/client/anvil/google/drive.pyi +98 -0
  10. package/dist/anvil-typeshed/client/anvil/google/sheets.pyi +98 -0
  11. package/dist/anvil-typeshed/client/anvil/http.pyi +66 -0
  12. package/dist/anvil-typeshed/client/anvil/image.pyi +30 -0
  13. package/dist/anvil-typeshed/client/anvil/js/__init__.pyi +143 -0
  14. package/dist/anvil-typeshed/client/anvil/js/window/__init__.pyi +2935 -0
  15. package/dist/anvil-typeshed/client/anvil/media.pyi +46 -0
  16. package/dist/anvil-typeshed/client/anvil/microsoft/__init__.pyi +8 -0
  17. package/dist/anvil-typeshed/client/anvil/microsoft/auth.pyi +34 -0
  18. package/dist/anvil-typeshed/client/anvil/mpl_util.pyi +29 -0
  19. package/dist/anvil-typeshed/client/anvil/plotly_templates.pyi +15 -0
  20. package/dist/anvil-typeshed/client/anvil/saml/__init__.pyi +8 -0
  21. package/dist/anvil-typeshed/client/anvil/saml/auth.pyi +24 -0
  22. package/dist/anvil-typeshed/client/anvil/secrets.pyi +22 -0
  23. package/dist/anvil-typeshed/client/anvil/server.pyi +376 -0
  24. package/dist/anvil-typeshed/client/anvil/stripe.pyi +23 -0
  25. package/dist/anvil-typeshed/client/anvil/tables/__init__.pyi +297 -0
  26. package/dist/anvil-typeshed/client/anvil/tables/query.pyi +88 -0
  27. package/dist/anvil-typeshed/client/anvil/tz.pyi +92 -0
  28. package/dist/anvil-typeshed/client/anvil/users/__init__.pyi +191 -0
  29. package/dist/anvil-typeshed/client/anvil/users/mfa.pyi +76 -0
  30. package/dist/anvil-typeshed/client/stripe/__init__.pyi +8 -0
  31. package/dist/anvil-typeshed/client/stripe/checkout.pyi +67 -0
  32. package/dist/anvil-typeshed/server/anvil/__init__.pyi +148 -0
  33. package/dist/anvil-typeshed/server/anvil/email.pyi +188 -0
  34. package/dist/anvil-typeshed/server/anvil/facebook/__init__.pyi +8 -0
  35. package/dist/anvil-typeshed/server/anvil/facebook/auth.pyi +27 -0
  36. package/dist/anvil-typeshed/server/anvil/files.pyi +53 -0
  37. package/dist/anvil-typeshed/server/anvil/google/__init__.pyi +11 -0
  38. package/dist/anvil-typeshed/server/anvil/google/auth.pyi +31 -0
  39. package/dist/anvil-typeshed/server/anvil/google/drive.pyi +98 -0
  40. package/dist/anvil-typeshed/server/anvil/google/mail.pyi +24 -0
  41. package/dist/anvil-typeshed/server/anvil/google/sheets.pyi +98 -0
  42. package/dist/anvil-typeshed/server/anvil/http.pyi +66 -0
  43. package/dist/anvil-typeshed/server/anvil/image.pyi +30 -0
  44. package/dist/anvil-typeshed/server/anvil/media.pyi +32 -0
  45. package/dist/anvil-typeshed/server/anvil/microsoft/__init__.pyi +8 -0
  46. package/dist/anvil-typeshed/server/anvil/microsoft/auth.pyi +31 -0
  47. package/dist/anvil-typeshed/server/anvil/mpl_util.pyi +29 -0
  48. package/dist/anvil-typeshed/server/anvil/pdf.pyi +61 -0
  49. package/dist/anvil-typeshed/server/anvil/plotly_templates.pyi +15 -0
  50. package/dist/anvil-typeshed/server/anvil/saml/__init__.pyi +8 -0
  51. package/dist/anvil-typeshed/server/anvil/saml/auth.pyi +21 -0
  52. package/dist/anvil-typeshed/server/anvil/secrets.pyi +22 -0
  53. package/dist/anvil-typeshed/server/anvil/server.pyi +470 -0
  54. package/dist/anvil-typeshed/server/anvil/stripe.pyi +23 -0
  55. package/dist/anvil-typeshed/server/anvil/tables/__init__.pyi +319 -0
  56. package/dist/anvil-typeshed/server/anvil/tables/query.pyi +88 -0
  57. package/dist/anvil-typeshed/server/anvil/tz.pyi +92 -0
  58. package/dist/anvil-typeshed/server/anvil/users/__init__.pyi +83 -0
  59. package/dist/anvil-typeshed/server/anvil/users/mfa.pyi +65 -0
  60. package/dist/anvil-typeshed/server/stripe/__init__.pyi +8 -0
  61. package/dist/anvil-typeshed/server/stripe/checkout.pyi +9 -0
  62. package/dist/anvil-typeshed/source/anvil/__init__.pyi +1306 -0
  63. package/dist/anvil-typeshed/source/anvil/email.pyi +188 -0
  64. package/dist/anvil-typeshed/source/anvil/facebook/__init__.pyi +4 -0
  65. package/dist/anvil-typeshed/source/anvil/facebook/auth.pyi +28 -0
  66. package/dist/anvil-typeshed/source/anvil/files.pyi +50 -0
  67. package/dist/anvil-typeshed/source/anvil/google/__init__.pyi +7 -0
  68. package/dist/anvil-typeshed/source/anvil/google/auth.pyi +35 -0
  69. package/dist/anvil-typeshed/source/anvil/google/drive.pyi +94 -0
  70. package/dist/anvil-typeshed/source/anvil/google/mail.pyi +21 -0
  71. package/dist/anvil-typeshed/source/anvil/google/sheets.pyi +94 -0
  72. package/dist/anvil-typeshed/source/anvil/http.pyi +62 -0
  73. package/dist/anvil-typeshed/source/anvil/image.pyi +26 -0
  74. package/dist/anvil-typeshed/source/anvil/js/__init__.pyi +140 -0
  75. package/dist/anvil-typeshed/source/anvil/js/window/__init__.pyi +2932 -0
  76. package/dist/anvil-typeshed/source/anvil/media.pyi +62 -0
  77. package/dist/anvil-typeshed/source/anvil/microsoft/__init__.pyi +4 -0
  78. package/dist/anvil-typeshed/source/anvil/microsoft/auth.pyi +32 -0
  79. package/dist/anvil-typeshed/source/anvil/mpl_util.pyi +25 -0
  80. package/dist/anvil-typeshed/source/anvil/pdf.pyi +58 -0
  81. package/dist/anvil-typeshed/source/anvil/plotly_templates.pyi +11 -0
  82. package/dist/anvil-typeshed/source/anvil/saml/__init__.pyi +4 -0
  83. package/dist/anvil-typeshed/source/anvil/saml/auth.pyi +22 -0
  84. package/dist/anvil-typeshed/source/anvil/secrets.pyi +18 -0
  85. package/dist/anvil-typeshed/source/anvil/server.pyi +511 -0
  86. package/dist/anvil-typeshed/source/anvil/stripe.pyi +19 -0
  87. package/dist/anvil-typeshed/source/anvil/tables/__init__.pyi +319 -0
  88. package/dist/anvil-typeshed/source/anvil/tables/query.pyi +84 -0
  89. package/dist/anvil-typeshed/source/anvil/tz.pyi +88 -0
  90. package/dist/anvil-typeshed/source/anvil/users/__init__.pyi +196 -0
  91. package/dist/anvil-typeshed/source/anvil/users/mfa.pyi +74 -0
  92. package/dist/anvil-typeshed/source/stripe/__init__.pyi +4 -0
  93. package/dist/anvil-typeshed/source/stripe/checkout.pyi +65 -0
  94. package/dist/pyright-langserver.js +1 -1
  95. package/dist/pyright-langserver.js.map +1 -1
  96. package/dist/pyright.js +1 -1
  97. package/dist/pyright.js.map +1 -1
  98. package/package.json +1 -1
@@ -0,0 +1,297 @@
1
+ # AUTO-GENERATED FILE - DO NOT EDIT
2
+ # Edit the source file in anvil-typeshed/source/ instead, then run:
3
+ # npm run generate-anvil-stubs
4
+ #
5
+ # Type stubs for anvil.tables module
6
+ # Generated files: client/anvil/tables/__init__.pyi, server/anvil/tables/__init__.pyi
7
+
8
+ from typing import Any, Generic, TypeVar, Iterator, Callable, overload
9
+
10
+ _T = TypeVar("_T", bound="Row")
11
+ _F = TypeVar("_F", bound="Callable[..., Any]")
12
+
13
+ class Row:
14
+ """Base class for table rows.
15
+
16
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-tables-in-code)"""
17
+ def __init_subclass__(
18
+ cls,
19
+ *,
20
+ attrs: bool = False,
21
+ buffered: bool = False,
22
+ client_writable: bool = False,
23
+ client_updatable: bool = False,
24
+ client_creatable: bool = False,
25
+ client_deletable: bool = False,
26
+ **kwargs: Any
27
+ ) -> None: ...
28
+ def __getitem__(self, key: str, /) -> Any: ...
29
+ def __setitem__(self, key: str, value: Any, /) -> None: ...
30
+ def update(self, **kwargs: Any) -> None:
31
+ """Update multiple columns of this row at once.
32
+
33
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-tables-in-code)"""
34
+ ...
35
+ def delete(self) -> None:
36
+ """Delete this row from the table.
37
+
38
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-tables-in-code)"""
39
+ ...
40
+ def get_id(self) -> str:
41
+ """Get the unique ID of this row.
42
+
43
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-tables-in-code)"""
44
+ ...
45
+ def save(self) -> None:
46
+ """Save buffered changes to this row.
47
+
48
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-tables-in-code)"""
49
+ ...
50
+ def reset(self) -> None:
51
+ """Reset buffered changes to this row.
52
+
53
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-tables-in-code)"""
54
+ ...
55
+ def buffer_changes(self, buffered: bool | None = None) -> Any:
56
+ """Context manager for buffered mode.
57
+
58
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-tables-in-code)"""
59
+ ...
60
+ @property
61
+ def buffered_changes(self) -> dict[str, Any] | None:
62
+ """Pending buffered changes for this row.
63
+
64
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-tables-in-code)"""
65
+ ...
66
+ def refresh(self, fetch: Any = None) -> None:
67
+ """Refresh this row from the database.
68
+
69
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-tables-in-code)"""
70
+ ...
71
+ def fetch(self, fetch: Any) -> None:
72
+ """Fetch specific columns for this row.
73
+
74
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-tables-in-code)"""
75
+ ...
76
+ def values(self) -> Iterator[Any]:
77
+ """Iterator of column values.
78
+
79
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-tables-in-code)"""
80
+ ...
81
+ def keys(self) -> Iterator[str]:
82
+ """Iterator of column names.
83
+
84
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-tables-in-code)"""
85
+ ...
86
+ def items(self) -> Iterator[tuple[str, Any]]:
87
+ """Iterator of (name, value) pairs.
88
+
89
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-tables-in-code)"""
90
+ ...
91
+
92
+ class SearchIterator(Generic[_T], Iterator[_T]):
93
+ """Iterator returned by table.search().
94
+
95
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-tables-in-code)"""
96
+ def __iter__(self) -> "SearchIterator[_T]": ...
97
+ def __next__(self) -> _T: ...
98
+ def __len__(self) -> int: ...
99
+ @overload
100
+ def __getitem__(self, index: int) -> _T: ...
101
+ @overload
102
+ def __getitem__(self, index: slice) -> list[_T]: ...
103
+ def __getitem__(self, index: int | slice) -> _T | list[_T]: ...
104
+
105
+ class Table(Generic[_T]):
106
+ """Base class for tables.
107
+
108
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-tables-in-code)"""
109
+ Row: type[_T]
110
+ def get(self, **kwargs: Any) -> _T | None:
111
+ """Get a single row matching the given criteria.
112
+
113
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-tables-in-code)"""
114
+ ...
115
+ def get_by_id(self, row_id: str, /) -> _T | None:
116
+ """Get a row by its unique ID.
117
+
118
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-tables-in-code)"""
119
+ ...
120
+ def search(self, *args: Any, **kwargs: Any) -> SearchIterator[_T]:
121
+ """Search for rows matching the given criteria.
122
+
123
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-tables-in-code)"""
124
+ ...
125
+ def add_row(self, **kwargs: Any) -> _T:
126
+ """Add a new row to this table.
127
+
128
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-tables-in-code)"""
129
+ ...
130
+ def list_columns(self) -> list[dict[str, Any]]:
131
+ """List all columns in this table.
132
+
133
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-tables-in-code)"""
134
+ ...
135
+ def delete_all_rows(self) -> None:
136
+ """Delete all rows from this table.
137
+
138
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-tables-in-code)"""
139
+ ...
140
+ def client_readable(self, **kwargs: Any) -> "Table[_T]":
141
+ """Return a view of this table that clients can read.
142
+
143
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-security)"""
144
+ ...
145
+ def client_writable(self, **kwargs: Any) -> "Table[_T]":
146
+ """Return a view of this table that clients can write to.
147
+
148
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-security)"""
149
+ ...
150
+ def client_writable_cascade(self, **kwargs: Any) -> "Table[_T]":
151
+ """Return a view of this table that clients can write to, with cascading permissions.
152
+
153
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-security)"""
154
+ ...
155
+
156
+ # Query operators
157
+ def order_by(column: str, /, ascending: bool = True) -> Any:
158
+ """Create an ordering query operator.
159
+
160
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-tables-in-code#searching-and-querying-data-tables)"""
161
+ ...
162
+
163
+ class _Query:
164
+ """Query operators for searching tables.
165
+
166
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-tables-in-code#searching-and-querying-data-tables)"""
167
+ @staticmethod
168
+ def any_of(*args: Any) -> Any:
169
+ """Match any of the given conditions.
170
+
171
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-tables-in-code#searching-and-querying-data-tables)"""
172
+ ...
173
+ @staticmethod
174
+ def all_of(*args: Any) -> Any:
175
+ """Match all of the given conditions.
176
+
177
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-tables-in-code#searching-and-querying-data-tables)"""
178
+ ...
179
+ @staticmethod
180
+ def none_of(*args: Any) -> Any:
181
+ """Match none of the given conditions.
182
+
183
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-tables-in-code#searching-and-querying-data-tables)"""
184
+ ...
185
+ @staticmethod
186
+ def like(pattern: str) -> Any:
187
+ """Match using SQL LIKE pattern (case-sensitive).
188
+
189
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-tables-in-code#searching-and-querying-data-tables)"""
190
+ ...
191
+ @staticmethod
192
+ def ilike(pattern: str) -> Any:
193
+ """Match using SQL LIKE pattern (case-insensitive).
194
+
195
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-tables-in-code#searching-and-querying-data-tables)"""
196
+ ...
197
+ @staticmethod
198
+ def full_text_match(query: str, raw: bool = False) -> Any:
199
+ """Full-text search.
200
+
201
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-tables-in-code#searching-and-querying-data-tables)"""
202
+ ...
203
+ @staticmethod
204
+ def greater_than(value: Any) -> Any:
205
+ """Match values greater than the given value.
206
+
207
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-tables-in-code#searching-and-querying-data-tables)"""
208
+ ...
209
+ @staticmethod
210
+ def greater_than_or_equal_to(value: Any) -> Any:
211
+ """Match values greater than or equal to the given value.
212
+
213
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-tables-in-code#searching-and-querying-data-tables)"""
214
+ ...
215
+ @staticmethod
216
+ def less_than(value: Any) -> Any:
217
+ """Match values less than the given value.
218
+
219
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-tables-in-code#searching-and-querying-data-tables)"""
220
+ ...
221
+ @staticmethod
222
+ def less_than_or_equal_to(value: Any) -> Any:
223
+ """Match values less than or equal to the given value.
224
+
225
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-tables-in-code#searching-and-querying-data-tables)"""
226
+ ...
227
+ @staticmethod
228
+ def between(min_value: Any, max_value: Any, min_inclusive: bool = True, max_inclusive: bool = False) -> Any:
229
+ """Match values between the given bounds.
230
+
231
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-tables-in-code#searching-and-querying-data-tables)"""
232
+ ...
233
+ @staticmethod
234
+ def not_(value: Any) -> Any:
235
+ """Negate a query condition.
236
+
237
+ [Anvil Docs](https://anvil.works/docs/data-tables/data-tables-in-code#searching-and-querying-data-tables)"""
238
+ ...
239
+
240
+ q: _Query
241
+
242
+ # Exceptions
243
+ class TableError(Exception):
244
+ """Superclass of all table exceptions.
245
+
246
+ [Anvil Docs](https://anvil.works/docs/data-tables/transactions)"""
247
+ ...
248
+
249
+ class TransactionConflict(TableError):
250
+ """Raised when a transaction conflicts and has been aborted.
251
+
252
+ [Anvil Docs](https://anvil.works/docs/data-tables/transactions)"""
253
+ ...
254
+
255
+ class NoSuchColumnError(TableError):
256
+ """Raised when attempting to access a column that does not exist in this table."""
257
+ ...
258
+
259
+ class QuotaExceededError(TableError):
260
+ """Raised when an app has exceeded its quota."""
261
+ ...
262
+
263
+ class RowDeleted(TableError):
264
+ """Raised when attempting to access a table row that has been deleted."""
265
+ ...
266
+
267
+ # Transaction support
268
+ class Transaction:
269
+ """A database transaction context manager.
270
+
271
+ [Anvil Docs](https://anvil.works/docs/data-tables/transactions)"""
272
+ def __init__(self, relaxed: bool = False) -> None: ...
273
+ def __enter__(self) -> "Transaction": ...
274
+ def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> bool: ...
275
+ def abort(self) -> None:
276
+ """Abort this transaction and roll back all changes.
277
+
278
+ [Anvil Docs](https://anvil.works/docs/data-tables/transactions)"""
279
+ ...
280
+
281
+
282
+ def get_table_by_id(table_id: str) -> Table[Row]:
283
+ """Get a table by id. Can pass a row id in, and the table the row belongs to will be returned.
284
+
285
+ [Anvil Docs](https://anvil.works/docs/data-tables/accelerated-tables)"""
286
+ ...
287
+
288
+
289
+ # app_tables will be dynamically typed based on db_schema
290
+ class _AppTables:
291
+ """Container for all app tables. Individual tables are generated from db_schema.
292
+
293
+ [Anvil Docs](https://anvil.works/docs/data-tables)"""
294
+ def __getattr__(self, name: str) -> Table[Row]: ...
295
+ def __getitem__(self, name: str) -> Table[Row]: ...
296
+
297
+ app_tables: _AppTables
@@ -0,0 +1,88 @@
1
+ # AUTO-GENERATED FILE - DO NOT EDIT
2
+ # Edit the source file in anvil-typeshed/source/ instead, then run:
3
+ # npm run generate-anvil-stubs
4
+ #
5
+ # Type stubs for anvil.tables.query module
6
+ # Generated files: client/anvil/tables/query.pyi, server/anvil/tables/query.pyi
7
+
8
+ from typing import Any
9
+
10
+ def like(pattern: str, /) -> Any:
11
+ """Match values using a case-sensitive LIKE query, using the % wildcard character."""
12
+ ...
13
+
14
+ def ilike(pattern: str, /) -> Any:
15
+ """Match values using a case-insensitive ILIKE query, using the % wildcard character."""
16
+ ...
17
+
18
+ def greater_than(value: Any, /) -> Any:
19
+ """Match values greater than the provided value."""
20
+ ...
21
+
22
+ def less_than(value: Any, /) -> Any:
23
+ """Match values less than the provided value."""
24
+ ...
25
+
26
+ def greater_than_or_equal_to(value: Any, /) -> Any:
27
+ """Match values greater than or equal to the provided value."""
28
+ ...
29
+
30
+ def less_than_or_equal_to(value: Any, /) -> Any:
31
+ """Match values less than or equal to the provided value."""
32
+ ...
33
+
34
+ def between(
35
+ min: Any,
36
+ max: Any,
37
+ *,
38
+ min_inclusive: bool = True,
39
+ max_inclusive: bool = False,
40
+ ) -> Any:
41
+ """Match values between the provided min and max, optionally inclusive."""
42
+ ...
43
+
44
+ def full_text_match(query: str, *, raw: bool = False) -> Any:
45
+ """Match values that match the provided full-text search query."""
46
+ ...
47
+
48
+ def all_of(*query_expressions: Any, **kwargs: Any) -> Any:
49
+ """Match all query parameters given as arguments and keyword arguments."""
50
+ ...
51
+
52
+ def any_of(*query_expressions: Any, **kwargs: Any) -> Any:
53
+ """Match any query parameters given as arguments and keyword arguments."""
54
+ ...
55
+
56
+ def none_of(*query_expressions: Any, **kwargs: Any) -> Any:
57
+ """Match none of the query parameters given as arguments and keyword arguments."""
58
+ ...
59
+
60
+ def not_(value: Any, /) -> Any:
61
+ """Match none of the query parameters given as arguments and keyword arguments."""
62
+ ...
63
+
64
+ def page_size(rows: int) -> Any:
65
+ """Define the number of rows that are fetched per round trip to the server."""
66
+ ...
67
+
68
+ def fetch_only(*only_cols: str, **linked_cols: Any) -> Any:
69
+ """Control which columns are loaded from a table search to speed up queries by only fetching the data you need.
70
+
71
+ Args:
72
+ only_cols: Column names to fetch from the table.
73
+ Example: fetch_only('email', group=q.fetch_only('name'))
74
+ linked_cols: Linked columns to fetch, specified as keyword arguments.
75
+ Each value must be another fetch_only() object.
76
+
77
+ [Anvil Docs](https://anvil.works/docs/data-tables/accelerated-tables#explicit-cache-control)"""
78
+ ...
79
+
80
+ def only_cols(*cols: str) -> Any:
81
+ """Control which columns are accessible from a view, restricting access to specific columns.
82
+
83
+ Args:
84
+ cols: Column names to make accessible in the view.
85
+ Example: only_cols('email', 'enabled')
86
+
87
+ [Anvil Docs](https://anvil.works/docs/data-tables/accelerated-tables#column-restricted-views)"""
88
+ ...
@@ -0,0 +1,92 @@
1
+ # AUTO-GENERATED FILE - DO NOT EDIT
2
+ # Edit the source file in anvil-typeshed/source/ instead, then run:
3
+ # npm run generate-anvil-stubs
4
+ #
5
+ """Timezone utilities for Anvil applications.
6
+
7
+ This module provides timezone classes for working with datetime objects.
8
+ """
9
+
10
+ import datetime
11
+
12
+ class tzoffset(datetime.tzinfo):
13
+ """Create a timezone with a specific offset.
14
+
15
+ Use an offset in seconds, minutes or hours. Only one of the three
16
+ keyword arguments should be provided.
17
+
18
+ Args:
19
+ seconds: Offset from UTC in seconds.
20
+ minutes: Offset from UTC in minutes.
21
+ hours: Offset from UTC in hours.
22
+
23
+ Example:
24
+ ```python
25
+ import anvil.tz
26
+ import datetime
27
+
28
+ # Create a timezone 5 hours behind UTC
29
+ eastern = anvil.tz.tzoffset(hours=-5)
30
+ dt = datetime.datetime.now(eastern)
31
+ ```
32
+ """
33
+
34
+ def __init__(
35
+ self,
36
+ *,
37
+ seconds: int | None = None,
38
+ minutes: int | None = None,
39
+ hours: int | None = None,
40
+ ) -> None: ...
41
+ def utcoffset(self, dt: datetime.datetime | None) -> datetime.timedelta: ...
42
+ def dst(self, dt: datetime.datetime | None) -> datetime.timedelta: ...
43
+ def tzname(self, dt: datetime.datetime | None) -> str | None: ...
44
+
45
+ class tzlocal(tzoffset):
46
+ """Use the local timezone of the browser.
47
+
48
+ Creates a timezone object representing the local timezone where the
49
+ code is running (browser for client code, server for server code).
50
+
51
+ Example:
52
+ ```python
53
+ import anvil.tz
54
+ import datetime
55
+
56
+ local_tz = anvil.tz.tzlocal()
57
+ local_time = datetime.datetime.now(local_tz)
58
+ ```
59
+ """
60
+
61
+ def __init__(self) -> None: ...
62
+
63
+ class tzutc(tzoffset):
64
+ """Create a timezone set to UTC.
65
+
66
+ Creates a timezone object representing Coordinated Universal Time (UTC).
67
+
68
+ Example:
69
+ ```python
70
+ import anvil.tz
71
+ import datetime
72
+
73
+ utc_tz = anvil.tz.tzutc()
74
+ utc_time = datetime.datetime.now(utc_tz)
75
+ ```
76
+ """
77
+
78
+ def __init__(self) -> None: ...
79
+
80
+ UTC: tzutc
81
+ """An object representing the UTC timezone.
82
+
83
+ A pre-instantiated `tzutc` object for convenience.
84
+
85
+ Example:
86
+ ```python
87
+ import anvil.tz
88
+ import datetime
89
+
90
+ utc_time = datetime.datetime.now(anvil.tz.UTC)
91
+ ```
92
+ """
@@ -0,0 +1,191 @@
1
+ # AUTO-GENERATED FILE - DO NOT EDIT
2
+ # Edit the source file in anvil-typeshed/source/ instead, then run:
3
+ # npm run generate-anvil-stubs
4
+ #
5
+ # Type stubs for anvil.users module
6
+ # Generated files: client/anvil/users/__init__.pyi, server/anvil/users/__init__.pyi
7
+
8
+ from typing import Any
9
+ from anvil.tables import Row
10
+ from anvil.users import mfa as mfa
11
+
12
+ # Exceptions (available in both environments)
13
+ class UserExists(Exception): ...
14
+ class AuthenticationFailed(Exception): ...
15
+ class EmailNotConfirmed(AuthenticationFailed): ...
16
+ class AccountIsNotEnabled(AuthenticationFailed): ...
17
+ class TooManyPasswordFailures(AuthenticationFailed): ...
18
+ class PasswordNotAcceptable(Exception): ...
19
+ class MFARequired(AuthenticationFailed): ...
20
+ class MFAException(AuthenticationFailed): ...
21
+ class PasswordResetRequested(Exception): ...
22
+
23
+ # Functions available in both environments
24
+ def get_user(allow_remembered: bool = True) -> Row | None:
25
+ """Get the row from the users table that corresponds to the currently logged-in user. If allow_remembered is true (the default), the user may have logged in in a previous session. Returns None if no user is logged in.
26
+
27
+ [Anvil Docs](https://anvil.works/docs/users)"""
28
+ ...
29
+
30
+ def logout(invalidate_client_objects: bool = False) -> None:
31
+ """Forget the current logged-in user.
32
+
33
+ If invalidate_client_objects is true, all live objects (table rows, Capabilities, unfetched Media, etc) will be invalidated
34
+
35
+ [Anvil Docs](https://anvil.works/docs/users)"""
36
+ ...
37
+
38
+ def login_with_email(email: str, password: str, remember: bool = False) -> Row | None:
39
+ """Log in with the specified email address and password. Raises anvil.users.AuthenticationFailed exception if the login failed.
40
+
41
+ By default, login status is not remembered between sessions; set remember=True to remember login status.
42
+
43
+ [Anvil Docs](https://anvil.works/docs/users/email_login)"""
44
+ ...
45
+
46
+ def signup_with_email(email: str, password: str, remember: bool = False) -> Row | None:
47
+ """Sign up for a new account with the specified email address and password. Raises anvil.users.UserExists if an account is already registered with this email address.
48
+
49
+ By default, login status is not remembered between sessions; set remember=True to remember login status.
50
+
51
+ [Anvil Docs](https://anvil.works/docs/users/email_login)"""
52
+ ...
53
+
54
+ def send_password_reset_email(email_address: str) -> None:
55
+ """Send a password-reset email to the specified user
56
+
57
+ [Anvil Docs](https://anvil.works/docs/users/email_login)"""
58
+ ...
59
+
60
+ def send_token_login_email(email_address: str) -> None:
61
+ """Send a login link email to the specified user
62
+
63
+ [Anvil Docs](https://anvil.works/docs/users/email_login)"""
64
+ ...
65
+
66
+ def reset_password(old_password: str, new_password: str) -> None:
67
+ """Reset the password for the current user
68
+
69
+ [Anvil Docs](https://anvil.works/docs/users/email_login)"""
70
+ ...
71
+
72
+ def send_mfa_reset_email(email_address: str) -> None:
73
+ """Send a two-factor authentication reset email to the specified user.
74
+
75
+ [Anvil Docs](https://anvil.works/docs/users/mfa)"""
76
+ ...
77
+
78
+
79
+ def login_with_google(additional_scopes: list[str] | None = None, remember: bool = False) -> Row | None:
80
+ """Log in with a Google account. Prompts the user to authenticate with Google, then logs in with their Google email address (if that user exists). Returns None if the login was cancelled or we have no record of this user.
81
+
82
+ additional_scopes: If supplied, these are passed on to anvil.google.auth.login().
83
+
84
+ By default, login status is not remembered between sessions; set remember=True to remember login status.
85
+
86
+ [Anvil Docs](https://anvil.works/docs/users/google)"""
87
+ ...
88
+
89
+ def signup_with_google(additional_scopes: list[str] | None = None, remember: bool = False) -> Row | None:
90
+ """Sign up for a new account with the email address associated with the user's Google account. Prompts the user to authenticate with Google, then registers a new user with that email address. Raises anvil.users.UserExists if this email address is already registered; returns new user or None if cancelled.
91
+
92
+ additional_scopes: If supplied, these are passed on to anvil.google.auth.login().
93
+
94
+ By default, login status is not remembered between sessions; set remember=True to remember login status.
95
+
96
+ [Anvil Docs](https://anvil.works/docs/users/google)"""
97
+ ...
98
+
99
+ def login_with_facebook(additional_scopes: list[str] | None = None, remember: bool = False) -> Row | None:
100
+ """Log in with a Facebook account. Prompts the user to authenticate with Facebook, then logs in with their Facebook email address (if that user exists). Returns None if the login was cancelled or we have no record of this user.
101
+
102
+ additional_scopes: If supplied, these are passed on to anvil.facebook.auth.login().
103
+
104
+ By default, login status is not remembered between sessions; set remember=True to remember login status.
105
+
106
+ [Anvil Docs](https://anvil.works/docs/users/facebook)"""
107
+ ...
108
+
109
+ def signup_with_facebook(additional_scopes: list[str] | None = None, remember: bool = False) -> Row | None:
110
+ """Sign up for a new account with the email address associated with the user's Facebook account. Prompts the user to authenticate with Facebook, then registers a new user with that email address. Raises anvil.users.UserExists if this email address is already registered; returns new user or None if cancelled.
111
+
112
+ additional_scopes: If supplied, these are passed on to anvil.facebook.auth.login().
113
+
114
+ By default, login status is not remembered between sessions; set remember=True to remember login status.
115
+
116
+ [Anvil Docs](https://anvil.works/docs/users/facebook)"""
117
+ ...
118
+
119
+ def login_with_microsoft(additional_scopes: list[str] | None = None, remember: bool = False) -> Row | None:
120
+ """Log in with a Microsoft account. Prompts the user to authenticate with Microsoft, then logs in with their Microsoft email address (if that user exists). Returns None if the login was cancelled or we have no record of this user.
121
+
122
+ additional_scopes: If supplied, these are passed on to anvil.microsoft.auth.login().
123
+
124
+ By default, login status is not remembered between sessions; set remember=True to remember login status.
125
+
126
+ [Anvil Docs](https://anvil.works/docs/users/microsoft)"""
127
+ ...
128
+
129
+ def signup_with_microsoft(additional_scopes: list[str] | None = None, remember: bool = False) -> Row | None:
130
+ """Sign up for a new account with the email address associated with the user's Microsoft account. Prompts the user to authenticate with Microsoft, then registers a new user with that email address. Raises anvil.users.UserExists if this email address is already registered; returns new user or None if cancelled.
131
+
132
+ additional_scopes: If supplied, these are passed on to anvil.microsoft.auth.login().
133
+
134
+ By default, login status is not remembered between sessions; set remember=True to remember login status.
135
+
136
+ [Anvil Docs](https://anvil.works/docs/users/microsoft)"""
137
+ ...
138
+
139
+ def login_with_saml(remember: bool = False) -> Row | None:
140
+ """Log in via a SAML Identity Provider. Prompts the user to authenticate with SAML, then logs in with their email address (if that user exists). Returns None if the login was cancelled or we have no record of this user.
141
+
142
+ By default, login status is not remembered between sessions; set remember=True to remember login status.
143
+
144
+ [Anvil Docs](https://anvil.works/docs/users/saml)"""
145
+ ...
146
+
147
+ def signup_with_saml(remember: bool = False) -> Row | None:
148
+ """Sign up for a new account with the email address associated with the user's SAML account. Prompts the user to authenticate via SAML, then registers a new user with that email address. Raises anvil.users.UserExists if this email address is already registered; returns new user or None if cancelled.
149
+
150
+ By default, login status is not remembered between sessions; set remember=True to remember login status.
151
+
152
+ [Anvil Docs](https://anvil.works/docs/users/saml)"""
153
+ ...
154
+
155
+ def login_with_form(show_signup_option: bool = True, remember_by_default: bool = True, allow_remembered: bool = True, allow_cancel: bool = False, initial_email: str | None = None) -> Row | None:
156
+ """Display a login form and allow user to log in. Returns user object if logged in, or None if cancelled.
157
+
158
+ show_signup_option: if True, the form will also show the option to sign up for a new account.
159
+
160
+ remember_by_default: if True, the 'remember me' checkbox will be enabled by default.
161
+
162
+ allow_remembered: if False, users with remembered login status will still be required to log in.
163
+
164
+ allow_cancel: if True, the login form has a Cancel button that the user can use to dismiss the form.
165
+
166
+ initial_email: Optional email address to pre-fill the Email box with when email login is enabled.
167
+
168
+ [Anvil Docs](https://anvil.works/docs/users/authentication_forms)"""
169
+ ...
170
+
171
+ def signup_with_form(remember_by_default: bool = True, allow_cancel: bool = False) -> Row | None:
172
+ """Display a sign-up form allowing a user to create a new account. Returns the new user object, or None if cancelled.
173
+
174
+ remember_by_default: if True, the 'remember me' checkbox will be enabled by default.
175
+
176
+ allow_cancel: if True, the signup form has a Cancel button that the user can use to dismiss the form.
177
+
178
+ [Anvil Docs](https://anvil.works/docs/users/authentication_forms)"""
179
+ ...
180
+
181
+ def change_password_with_form(require_old_password: bool = True) -> None:
182
+ """Display a form allowing the current user to reset their password.
183
+
184
+ [Anvil Docs](https://anvil.works/docs/users/authentication_forms)"""
185
+ ...
186
+
187
+ def configure_account_with_form() -> None:
188
+ """Display a form allowing the current user to configure their account. The form contains links for password reset and two-factor authentication configuration.
189
+
190
+ [Anvil Docs](https://anvil.works/docs/users/authentication_forms)"""
191
+ ...