@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.
- package/dist/anvil-typeshed/TODOS.md +70 -0
- package/dist/anvil-typeshed/client/anvil/__init__.pyi +1291 -0
- package/dist/anvil-typeshed/client/anvil/__pycache__/server.cpython-39.pyc +0 -0
- package/dist/anvil-typeshed/client/anvil/email.pyi +152 -0
- package/dist/anvil-typeshed/client/anvil/facebook/__init__.pyi +8 -0
- package/dist/anvil-typeshed/client/anvil/facebook/auth.pyi +30 -0
- package/dist/anvil-typeshed/client/anvil/google/__init__.pyi +11 -0
- package/dist/anvil-typeshed/client/anvil/google/auth.pyi +37 -0
- package/dist/anvil-typeshed/client/anvil/google/drive.pyi +98 -0
- package/dist/anvil-typeshed/client/anvil/google/sheets.pyi +98 -0
- package/dist/anvil-typeshed/client/anvil/http.pyi +66 -0
- package/dist/anvil-typeshed/client/anvil/image.pyi +30 -0
- package/dist/anvil-typeshed/client/anvil/js/__init__.pyi +143 -0
- package/dist/anvil-typeshed/client/anvil/js/window/__init__.pyi +2935 -0
- package/dist/anvil-typeshed/client/anvil/media.pyi +46 -0
- package/dist/anvil-typeshed/client/anvil/microsoft/__init__.pyi +8 -0
- package/dist/anvil-typeshed/client/anvil/microsoft/auth.pyi +34 -0
- package/dist/anvil-typeshed/client/anvil/mpl_util.pyi +29 -0
- package/dist/anvil-typeshed/client/anvil/plotly_templates.pyi +15 -0
- package/dist/anvil-typeshed/client/anvil/saml/__init__.pyi +8 -0
- package/dist/anvil-typeshed/client/anvil/saml/auth.pyi +24 -0
- package/dist/anvil-typeshed/client/anvil/secrets.pyi +22 -0
- package/dist/anvil-typeshed/client/anvil/server.pyi +376 -0
- package/dist/anvil-typeshed/client/anvil/stripe.pyi +23 -0
- package/dist/anvil-typeshed/client/anvil/tables/__init__.pyi +297 -0
- package/dist/anvil-typeshed/client/anvil/tables/query.pyi +88 -0
- package/dist/anvil-typeshed/client/anvil/tz.pyi +92 -0
- package/dist/anvil-typeshed/client/anvil/users/__init__.pyi +191 -0
- package/dist/anvil-typeshed/client/anvil/users/mfa.pyi +76 -0
- package/dist/anvil-typeshed/client/stripe/__init__.pyi +8 -0
- package/dist/anvil-typeshed/client/stripe/checkout.pyi +67 -0
- package/dist/anvil-typeshed/server/anvil/__init__.pyi +148 -0
- package/dist/anvil-typeshed/server/anvil/email.pyi +188 -0
- package/dist/anvil-typeshed/server/anvil/facebook/__init__.pyi +8 -0
- package/dist/anvil-typeshed/server/anvil/facebook/auth.pyi +27 -0
- package/dist/anvil-typeshed/server/anvil/files.pyi +53 -0
- package/dist/anvil-typeshed/server/anvil/google/__init__.pyi +11 -0
- package/dist/anvil-typeshed/server/anvil/google/auth.pyi +31 -0
- package/dist/anvil-typeshed/server/anvil/google/drive.pyi +98 -0
- package/dist/anvil-typeshed/server/anvil/google/mail.pyi +24 -0
- package/dist/anvil-typeshed/server/anvil/google/sheets.pyi +98 -0
- package/dist/anvil-typeshed/server/anvil/http.pyi +66 -0
- package/dist/anvil-typeshed/server/anvil/image.pyi +30 -0
- package/dist/anvil-typeshed/server/anvil/media.pyi +32 -0
- package/dist/anvil-typeshed/server/anvil/microsoft/__init__.pyi +8 -0
- package/dist/anvil-typeshed/server/anvil/microsoft/auth.pyi +31 -0
- package/dist/anvil-typeshed/server/anvil/mpl_util.pyi +29 -0
- package/dist/anvil-typeshed/server/anvil/pdf.pyi +61 -0
- package/dist/anvil-typeshed/server/anvil/plotly_templates.pyi +15 -0
- package/dist/anvil-typeshed/server/anvil/saml/__init__.pyi +8 -0
- package/dist/anvil-typeshed/server/anvil/saml/auth.pyi +21 -0
- package/dist/anvil-typeshed/server/anvil/secrets.pyi +22 -0
- package/dist/anvil-typeshed/server/anvil/server.pyi +470 -0
- package/dist/anvil-typeshed/server/anvil/stripe.pyi +23 -0
- package/dist/anvil-typeshed/server/anvil/tables/__init__.pyi +319 -0
- package/dist/anvil-typeshed/server/anvil/tables/query.pyi +88 -0
- package/dist/anvil-typeshed/server/anvil/tz.pyi +92 -0
- package/dist/anvil-typeshed/server/anvil/users/__init__.pyi +83 -0
- package/dist/anvil-typeshed/server/anvil/users/mfa.pyi +65 -0
- package/dist/anvil-typeshed/server/stripe/__init__.pyi +8 -0
- package/dist/anvil-typeshed/server/stripe/checkout.pyi +9 -0
- package/dist/anvil-typeshed/source/anvil/__init__.pyi +1306 -0
- package/dist/anvil-typeshed/source/anvil/email.pyi +188 -0
- package/dist/anvil-typeshed/source/anvil/facebook/__init__.pyi +4 -0
- package/dist/anvil-typeshed/source/anvil/facebook/auth.pyi +28 -0
- package/dist/anvil-typeshed/source/anvil/files.pyi +50 -0
- package/dist/anvil-typeshed/source/anvil/google/__init__.pyi +7 -0
- package/dist/anvil-typeshed/source/anvil/google/auth.pyi +35 -0
- package/dist/anvil-typeshed/source/anvil/google/drive.pyi +94 -0
- package/dist/anvil-typeshed/source/anvil/google/mail.pyi +21 -0
- package/dist/anvil-typeshed/source/anvil/google/sheets.pyi +94 -0
- package/dist/anvil-typeshed/source/anvil/http.pyi +62 -0
- package/dist/anvil-typeshed/source/anvil/image.pyi +26 -0
- package/dist/anvil-typeshed/source/anvil/js/__init__.pyi +140 -0
- package/dist/anvil-typeshed/source/anvil/js/window/__init__.pyi +2932 -0
- package/dist/anvil-typeshed/source/anvil/media.pyi +62 -0
- package/dist/anvil-typeshed/source/anvil/microsoft/__init__.pyi +4 -0
- package/dist/anvil-typeshed/source/anvil/microsoft/auth.pyi +32 -0
- package/dist/anvil-typeshed/source/anvil/mpl_util.pyi +25 -0
- package/dist/anvil-typeshed/source/anvil/pdf.pyi +58 -0
- package/dist/anvil-typeshed/source/anvil/plotly_templates.pyi +11 -0
- package/dist/anvil-typeshed/source/anvil/saml/__init__.pyi +4 -0
- package/dist/anvil-typeshed/source/anvil/saml/auth.pyi +22 -0
- package/dist/anvil-typeshed/source/anvil/secrets.pyi +18 -0
- package/dist/anvil-typeshed/source/anvil/server.pyi +511 -0
- package/dist/anvil-typeshed/source/anvil/stripe.pyi +19 -0
- package/dist/anvil-typeshed/source/anvil/tables/__init__.pyi +319 -0
- package/dist/anvil-typeshed/source/anvil/tables/query.pyi +84 -0
- package/dist/anvil-typeshed/source/anvil/tz.pyi +88 -0
- package/dist/anvil-typeshed/source/anvil/users/__init__.pyi +196 -0
- package/dist/anvil-typeshed/source/anvil/users/mfa.pyi +74 -0
- package/dist/anvil-typeshed/source/stripe/__init__.pyi +4 -0
- package/dist/anvil-typeshed/source/stripe/checkout.pyi +65 -0
- package/dist/pyright-langserver.js +1 -1
- package/dist/pyright-langserver.js.map +1 -1
- package/dist/pyright.js +1 -1
- package/dist/pyright.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,98 @@
|
|
|
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.google.drive module
|
|
6
|
+
# Generated files: client/anvil/google/drive.pyi, server/anvil/google/drive.pyi
|
|
7
|
+
|
|
8
|
+
from typing import Iterator
|
|
9
|
+
|
|
10
|
+
from anvil import Media
|
|
11
|
+
|
|
12
|
+
class DriveItem:
|
|
13
|
+
"""Base class for Google Drive items (files and folders)."""
|
|
14
|
+
|
|
15
|
+
id: str
|
|
16
|
+
"""ID of the DriveItem."""
|
|
17
|
+
|
|
18
|
+
def move(self, dest_folder: "Folder", /) -> None:
|
|
19
|
+
"""Move the DriveItem from one folder to another."""
|
|
20
|
+
...
|
|
21
|
+
def trash(self) -> None:
|
|
22
|
+
"""Move the DriveItem to the trash folder."""
|
|
23
|
+
...
|
|
24
|
+
def delete(self) -> None:
|
|
25
|
+
"""Delete the DriveItem (this cannot be undone)."""
|
|
26
|
+
...
|
|
27
|
+
|
|
28
|
+
class File(DriveItem, Media):
|
|
29
|
+
"""A Google Drive file."""
|
|
30
|
+
|
|
31
|
+
def get_bytes(self) -> bytes:
|
|
32
|
+
"""Get the contents of an object representing a Google Drive file.
|
|
33
|
+
|
|
34
|
+
Native Google files such as Docs, Slides and Sheets must first be exported
|
|
35
|
+
to an appropriate file type. All other file types support get_bytes()."""
|
|
36
|
+
...
|
|
37
|
+
def set_bytes(self, content: bytes, /) -> None:
|
|
38
|
+
"""Set the contents of an object representing a Google Drive file."""
|
|
39
|
+
...
|
|
40
|
+
def set_media(self, media: Media, /) -> None:
|
|
41
|
+
"""Upload new contents to an existing File.
|
|
42
|
+
|
|
43
|
+
Media must be a Media object."""
|
|
44
|
+
...
|
|
45
|
+
|
|
46
|
+
class Folder(DriveItem):
|
|
47
|
+
"""A Google Drive folder.
|
|
48
|
+
|
|
49
|
+
[Anvil Docs](https://anvil.works/docs/integrations/google/google-drive#folders)"""
|
|
50
|
+
|
|
51
|
+
folders: list["Folder"]
|
|
52
|
+
"""List of Folder items in the Folder."""
|
|
53
|
+
|
|
54
|
+
files: list[File]
|
|
55
|
+
"""List of File items in the Folder."""
|
|
56
|
+
|
|
57
|
+
def list_files(self) -> Iterator[File]:
|
|
58
|
+
"""List the files (not folders) in the Folder."""
|
|
59
|
+
...
|
|
60
|
+
def list_folders(self) -> Iterator["Folder"]:
|
|
61
|
+
"""List the folders (not files) in the Folder."""
|
|
62
|
+
...
|
|
63
|
+
def get(self, title: str, /) -> File | None:
|
|
64
|
+
"""Get the File item by title.
|
|
65
|
+
|
|
66
|
+
The title argument should be a string."""
|
|
67
|
+
...
|
|
68
|
+
def get_by_id(self, id: str, /) -> File | None:
|
|
69
|
+
"""Get the File item by ID.
|
|
70
|
+
|
|
71
|
+
The ID argument should be a string."""
|
|
72
|
+
...
|
|
73
|
+
def create_folder(self, title: str, /) -> "Folder":
|
|
74
|
+
"""Create a new folder within the Folder."""
|
|
75
|
+
...
|
|
76
|
+
def create_file(
|
|
77
|
+
self,
|
|
78
|
+
title: str,
|
|
79
|
+
*,
|
|
80
|
+
content_bytes: bytes | None = None,
|
|
81
|
+
content_type: str = "text/plain",
|
|
82
|
+
) -> File:
|
|
83
|
+
"""Create a new file within the Folder."""
|
|
84
|
+
...
|
|
85
|
+
|
|
86
|
+
def login(*, extra_scopes: list[str] | None = None) -> None:
|
|
87
|
+
"""Prompt the user to log in to their Google account and ask permission to access their Google Drive files.
|
|
88
|
+
|
|
89
|
+
[Anvil Docs](https://anvil.works/docs/integrations/google/google-drive#user-files)"""
|
|
90
|
+
...
|
|
91
|
+
|
|
92
|
+
def get_user_files() -> Folder:
|
|
93
|
+
"""Return the top-level folder containing all the files in the Users drive.
|
|
94
|
+
|
|
95
|
+
anvil.google.drive.login() must be called first.
|
|
96
|
+
|
|
97
|
+
[Anvil Docs](https://anvil.works/docs/integrations/google/google-drive#user-files)"""
|
|
98
|
+
...
|
|
@@ -0,0 +1,24 @@
|
|
|
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.google.mail module
|
|
6
|
+
# Generated files: server/anvil/google/mail.pyi
|
|
7
|
+
|
|
8
|
+
def send(
|
|
9
|
+
*,
|
|
10
|
+
to: str | list[str] | None = None,
|
|
11
|
+
subject: str | None = None,
|
|
12
|
+
text: str | None = None,
|
|
13
|
+
html: str | None = None,
|
|
14
|
+
cc: str | list[str] | None = None,
|
|
15
|
+
bcc: str | list[str] | None = None,
|
|
16
|
+
from_address: str | None = None,
|
|
17
|
+
draft: bool = False,
|
|
18
|
+
) -> None:
|
|
19
|
+
"""Send an email via GMail.
|
|
20
|
+
|
|
21
|
+
'to', 'cc' and 'bcc' may be strings (email addresses) or lists of strings (multiple addresses).
|
|
22
|
+
At least one of 'text' and 'html' need to be provided (both strings).
|
|
23
|
+
Passing draft=True will create a draft message rather than sending it."""
|
|
24
|
+
...
|
|
@@ -0,0 +1,98 @@
|
|
|
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.google.sheets module
|
|
6
|
+
# Generated files: client/anvil/google/sheets.pyi, server/anvil/google/sheets.pyi
|
|
7
|
+
|
|
8
|
+
from typing import Any, Iterator
|
|
9
|
+
|
|
10
|
+
class Cell:
|
|
11
|
+
"""A cell in a Google Sheets worksheet."""
|
|
12
|
+
|
|
13
|
+
row: int
|
|
14
|
+
"""This cell's row index (starting from 1)."""
|
|
15
|
+
|
|
16
|
+
col: int
|
|
17
|
+
"""This cell's column index (starting from 1)."""
|
|
18
|
+
|
|
19
|
+
value: str
|
|
20
|
+
"""The value in this cell."""
|
|
21
|
+
|
|
22
|
+
input_value: str
|
|
23
|
+
"""The value that was entered into the cell."""
|
|
24
|
+
|
|
25
|
+
class Row:
|
|
26
|
+
"""A row in a Google Sheets worksheet."""
|
|
27
|
+
|
|
28
|
+
def __getattr__(self, name: str) -> Any: ...
|
|
29
|
+
def __setattr__(self, name: str, value: Any) -> None: ...
|
|
30
|
+
def delete(self) -> None:
|
|
31
|
+
"""Delete this row from the worksheet.
|
|
32
|
+
|
|
33
|
+
This will cause data in subsequent rows to shift up."""
|
|
34
|
+
...
|
|
35
|
+
|
|
36
|
+
class Worksheet:
|
|
37
|
+
"""A worksheet (tab) in a Google Sheets spreadsheet."""
|
|
38
|
+
|
|
39
|
+
title: str
|
|
40
|
+
"""The title of this worksheet."""
|
|
41
|
+
|
|
42
|
+
row_count: int
|
|
43
|
+
"""The number of rows in this worksheet."""
|
|
44
|
+
|
|
45
|
+
column_count: int
|
|
46
|
+
"""The number of columns in this worksheet."""
|
|
47
|
+
|
|
48
|
+
fields: list[str]
|
|
49
|
+
"""The fields in this worksheet (ie the column headers, or the values in the first row)."""
|
|
50
|
+
|
|
51
|
+
rows: list[Row]
|
|
52
|
+
"""The rows in this worksheet (excluding the header)."""
|
|
53
|
+
|
|
54
|
+
cells: list[Cell]
|
|
55
|
+
"""A list of all the cells in this worksheet."""
|
|
56
|
+
|
|
57
|
+
def list_rows(self, **query: Any) -> list[Row]:
|
|
58
|
+
"""List rows in this worksheet.
|
|
59
|
+
|
|
60
|
+
Optionally restricting to rows with the specified column values
|
|
61
|
+
specified as keyword arguments."""
|
|
62
|
+
...
|
|
63
|
+
def add_row(self, **fields: Any) -> Row:
|
|
64
|
+
"""Add a row to the end of the worksheet.
|
|
65
|
+
|
|
66
|
+
Specifying values for columns as keywords arguments."""
|
|
67
|
+
...
|
|
68
|
+
def list_cells(
|
|
69
|
+
self,
|
|
70
|
+
*,
|
|
71
|
+
min_row: int | None = None,
|
|
72
|
+
max_row: int | None = None,
|
|
73
|
+
min_col: int | None = None,
|
|
74
|
+
max_col: int | None = None,
|
|
75
|
+
) -> list[Cell]:
|
|
76
|
+
"""List cells in the worksheet, optionally specifying a region."""
|
|
77
|
+
...
|
|
78
|
+
def get_cell(self, row: int, col: int) -> Cell:
|
|
79
|
+
"""Get a particular cell from the spreadsheet."""
|
|
80
|
+
...
|
|
81
|
+
def __iter__(self) -> Iterator[Cell]: ...
|
|
82
|
+
|
|
83
|
+
class Spreadsheet:
|
|
84
|
+
"""A Google Sheets spreadsheet."""
|
|
85
|
+
|
|
86
|
+
title: str
|
|
87
|
+
"""The title of this spreadsheet."""
|
|
88
|
+
|
|
89
|
+
id: str
|
|
90
|
+
"""The ID of this spreadsheet in Google Drive."""
|
|
91
|
+
|
|
92
|
+
worksheets: list[Worksheet]
|
|
93
|
+
"""The worksheets in this spreadsheet."""
|
|
94
|
+
|
|
95
|
+
def list_worksheets(self) -> list[Worksheet]:
|
|
96
|
+
"""Get a list of all worksheets in this spreadsheet."""
|
|
97
|
+
...
|
|
98
|
+
def __iter__(self) -> Iterator[Worksheet]: ...
|
|
@@ -0,0 +1,66 @@
|
|
|
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.http module
|
|
6
|
+
# Generated files: client/anvil/http.pyi, server/anvil/http.pyi
|
|
7
|
+
|
|
8
|
+
from typing import Any
|
|
9
|
+
|
|
10
|
+
from anvil import Media
|
|
11
|
+
|
|
12
|
+
class HttpError(Exception):
|
|
13
|
+
"""HTTP error with status code and content.
|
|
14
|
+
|
|
15
|
+
[Anvil Docs](https://anvil.works/docs/http-apis/making-http-requests)"""
|
|
16
|
+
|
|
17
|
+
status: int
|
|
18
|
+
"""The numeric HTTP status error (eg 404 for "not found").
|
|
19
|
+
|
|
20
|
+
Status will be 0 for errors that prevent the request completing at all
|
|
21
|
+
(eg cross-origin policy in the browser)."""
|
|
22
|
+
|
|
23
|
+
content: Media
|
|
24
|
+
"""The content returned by the request (eg the body of a 404 response)."""
|
|
25
|
+
|
|
26
|
+
class UrlEncodingError(Exception):
|
|
27
|
+
"""URL encoding/decoding error."""
|
|
28
|
+
...
|
|
29
|
+
|
|
30
|
+
def request(
|
|
31
|
+
url: str,
|
|
32
|
+
*,
|
|
33
|
+
method: str = "GET",
|
|
34
|
+
data: Any = None,
|
|
35
|
+
json: bool = False,
|
|
36
|
+
headers: dict[str, str] | None = None,
|
|
37
|
+
username: str | None = None,
|
|
38
|
+
password: str | None = None,
|
|
39
|
+
timeout: int | float | None = None,
|
|
40
|
+
) -> Media | Any:
|
|
41
|
+
"""Make an HTTP request to the specified URL.
|
|
42
|
+
|
|
43
|
+
Args:
|
|
44
|
+
url: The request will be made to this URL.
|
|
45
|
+
method: The HTTP method. Defaults to 'GET'.
|
|
46
|
+
data: The data to send in the request body.
|
|
47
|
+
json: If set to True, the response is parsed into Python objects (dicts/lists/etc),
|
|
48
|
+
and 'data' is JSON-encoded before sending. If False, the response will be a Media object.
|
|
49
|
+
headers: A dict of strings to set HTTP headers.
|
|
50
|
+
username: If specified, used to perform HTTP Basic authentication.
|
|
51
|
+
password: If specified, used to perform HTTP Basic authentication.
|
|
52
|
+
timeout: An int or float representing the amount of time, in seconds, to wait for a response.
|
|
53
|
+
Default is 60 seconds.
|
|
54
|
+
|
|
55
|
+
[Anvil Docs](https://anvil.works/docs/http-apis/making-http-requests)"""
|
|
56
|
+
...
|
|
57
|
+
|
|
58
|
+
def url_encode(string_to_encode: str, /) -> str:
|
|
59
|
+
"""URL-encode a string."""
|
|
60
|
+
...
|
|
61
|
+
|
|
62
|
+
def url_decode(string_to_decode: str, /) -> str:
|
|
63
|
+
"""URL-decode a string.
|
|
64
|
+
|
|
65
|
+
Raises UrlEncodingError on failure."""
|
|
66
|
+
...
|
|
@@ -0,0 +1,30 @@
|
|
|
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.image module
|
|
6
|
+
# Generated files: client/anvil/image.pyi, server/anvil/image.pyi
|
|
7
|
+
|
|
8
|
+
from anvil import Media
|
|
9
|
+
|
|
10
|
+
class ImageException(Exception):
|
|
11
|
+
"""Image processing exception."""
|
|
12
|
+
...
|
|
13
|
+
|
|
14
|
+
def get_dimensions(image_media: Media, /) -> tuple[int, int]:
|
|
15
|
+
"""Get the dimensions of an image (width, height).
|
|
16
|
+
|
|
17
|
+
Pass in an anvil.Media object representing the image."""
|
|
18
|
+
...
|
|
19
|
+
|
|
20
|
+
def generate_thumbnail(image_media: Media, max_size: int, /) -> Media:
|
|
21
|
+
"""Resize the supplied image so that neither width nor height exceeds max_size (in pixels).
|
|
22
|
+
|
|
23
|
+
Pass in an anvil.Media object representing the image."""
|
|
24
|
+
...
|
|
25
|
+
|
|
26
|
+
def rotate(image_media: Media, angle: float, /) -> Media:
|
|
27
|
+
"""Rotate the supplied image clockwise by the given number of degrees.
|
|
28
|
+
|
|
29
|
+
Pass in an anvil.Media object representing the image."""
|
|
30
|
+
...
|
|
@@ -0,0 +1,32 @@
|
|
|
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.media module
|
|
6
|
+
# Generated files: client/anvil/media.pyi, server/anvil/media.pyi
|
|
7
|
+
|
|
8
|
+
from typing import IO, Any
|
|
9
|
+
|
|
10
|
+
from anvil import Media
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class TempFile:
|
|
14
|
+
"""Create a temporary file initialised with the contents of the provided media, if any."""
|
|
15
|
+
|
|
16
|
+
def __init__(self, media: Media | None = None) -> None: ...
|
|
17
|
+
def __enter__(self) -> str:
|
|
18
|
+
"""Returns the path to the temporary file."""
|
|
19
|
+
...
|
|
20
|
+
def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None: ...
|
|
21
|
+
|
|
22
|
+
def from_file(filename: str, mime_type: str | None = None, name: str | None = None) -> Media:
|
|
23
|
+
"""Creates a Media object from the given file."""
|
|
24
|
+
...
|
|
25
|
+
|
|
26
|
+
def open(media: Media) -> IO[bytes]:
|
|
27
|
+
"""Open a media file as Python BytesIO object."""
|
|
28
|
+
...
|
|
29
|
+
|
|
30
|
+
def write_to_file(media: Media, filename: str) -> None:
|
|
31
|
+
"""Write a Media object to the given file."""
|
|
32
|
+
...
|
|
@@ -0,0 +1,8 @@
|
|
|
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.microsoft module
|
|
6
|
+
# Generated files: client/anvil/microsoft/__init__.pyi, server/anvil/microsoft/__init__.pyi
|
|
7
|
+
|
|
8
|
+
from anvil.microsoft import auth as auth
|
|
@@ -0,0 +1,31 @@
|
|
|
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.microsoft.auth module
|
|
6
|
+
# Generated files: client/anvil/microsoft/auth.pyi, server/anvil/microsoft/auth.pyi
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def get_user_email() -> str | None:
|
|
10
|
+
"""Get the email address of the currently-logged-in Microsoft user.
|
|
11
|
+
|
|
12
|
+
To log in with Microsoft, call anvil_microsoft.auth.login() from form code."""
|
|
13
|
+
...
|
|
14
|
+
|
|
15
|
+
def get_user_access_token() -> str | None:
|
|
16
|
+
"""Get the secret access token of the currently-logged-in Microsoft user, for use with the Microsoft REST API.
|
|
17
|
+
|
|
18
|
+
Requires this app to have its own Microsoft client ID and secret."""
|
|
19
|
+
...
|
|
20
|
+
|
|
21
|
+
def get_user_refresh_token() -> str | None:
|
|
22
|
+
"""Get the secret refresh token of the currently-logged-in Microsoft user, for use with the Microsoft REST API.
|
|
23
|
+
|
|
24
|
+
Requires this app to have its own Microsoft client ID and secret."""
|
|
25
|
+
...
|
|
26
|
+
|
|
27
|
+
def refresh_access_token(refresh_token: str, /) -> str:
|
|
28
|
+
"""Get a new access token from a refresh token you have saved, for use with the Microsoft REST API.
|
|
29
|
+
|
|
30
|
+
Requires this app to have its own Microsoft client ID and secret."""
|
|
31
|
+
...
|
|
@@ -0,0 +1,29 @@
|
|
|
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.mpl_util module
|
|
6
|
+
# Generated files: client/anvil/mpl_util.pyi, server/anvil/mpl_util.pyi
|
|
7
|
+
|
|
8
|
+
from typing import Any
|
|
9
|
+
|
|
10
|
+
from anvil import Media
|
|
11
|
+
|
|
12
|
+
def plot_image(
|
|
13
|
+
*,
|
|
14
|
+
dpi: int | None = None,
|
|
15
|
+
facecolor: Any | None = None,
|
|
16
|
+
edgecolor: Any | None = None,
|
|
17
|
+
format: str | None = None,
|
|
18
|
+
transparent: bool | None = None,
|
|
19
|
+
frameon: bool | None = None,
|
|
20
|
+
bbox_inches: str | Any | None = None,
|
|
21
|
+
pad_inches: float | None = None,
|
|
22
|
+
filename: str | None = None,
|
|
23
|
+
) -> Media:
|
|
24
|
+
"""Return the current Matplotlib figure as a PNG image.
|
|
25
|
+
|
|
26
|
+
Returns an Anvil Media object that can be displayed in Image components.
|
|
27
|
+
|
|
28
|
+
Optional arguments have the same meaning as for 'savefig()'."""
|
|
29
|
+
...
|
|
@@ -0,0 +1,61 @@
|
|
|
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.pdf module
|
|
6
|
+
# Generated files: server/anvil/pdf.pyi
|
|
7
|
+
|
|
8
|
+
from typing import Any, Literal
|
|
9
|
+
|
|
10
|
+
from anvil import Media
|
|
11
|
+
|
|
12
|
+
class PDFRenderer:
|
|
13
|
+
"""Configure options for PDF rendering. Returns an object with a render_form() method.
|
|
14
|
+
|
|
15
|
+
[Anvil Docs](https://anvil.works/docs/media/creating_pdfs)"""
|
|
16
|
+
|
|
17
|
+
def __init__(
|
|
18
|
+
self,
|
|
19
|
+
*,
|
|
20
|
+
filename: str = "print.pdf",
|
|
21
|
+
landscape: bool = False,
|
|
22
|
+
margins: dict[str, float] | float | None = None,
|
|
23
|
+
page_size: str | tuple[float, float] = "letter",
|
|
24
|
+
quality: Literal["original", "screen", "printer", "prepress", "default"] = "default",
|
|
25
|
+
scale: float = 1.0,
|
|
26
|
+
) -> None:
|
|
27
|
+
"""Create a PDF renderer with specified options.
|
|
28
|
+
|
|
29
|
+
Args:
|
|
30
|
+
filename: The name of the generated PDF file.
|
|
31
|
+
landscape: Generate a PDF in landscape orientation.
|
|
32
|
+
margins: Page margins (in centimetres), as a dictionary specifying margins on each side
|
|
33
|
+
(eg {'top': 1.0, 'bottom': 1.0, 'left': 1.0, 'right': 1.0}) or as a number specifying
|
|
34
|
+
a global margin. The default value is 1.0.
|
|
35
|
+
page_size: Can be the name of a standard page size ('letter' or 'A0'-'A10'),
|
|
36
|
+
or a tuple of (width, height) in centimetres.
|
|
37
|
+
quality: The quality of the generated PDF, which has a large impact on file size.
|
|
38
|
+
Available values are: 'original', 'screen', 'printer', 'prepress', 'default'.
|
|
39
|
+
scale: The scale (zoom level) at which you are printing. The default value is 1.0.
|
|
40
|
+
"""
|
|
41
|
+
...
|
|
42
|
+
|
|
43
|
+
def render_form(self, form_name: str, *args: Any, **kwargs: Any) -> Media:
|
|
44
|
+
"""Render an Anvil form to PDF.
|
|
45
|
+
|
|
46
|
+
Pass the name of the form you want to render, plus any arguments you want
|
|
47
|
+
to pass to its constructor.
|
|
48
|
+
|
|
49
|
+
Returns a PDF as an Anvil Media object."""
|
|
50
|
+
...
|
|
51
|
+
|
|
52
|
+
def render_form(form_name: str, *args: Any, **kwargs: Any) -> Media:
|
|
53
|
+
"""Render an Anvil form to PDF.
|
|
54
|
+
|
|
55
|
+
Pass the name of the form you want to render, plus any arguments you want
|
|
56
|
+
to pass to its constructor.
|
|
57
|
+
|
|
58
|
+
Returns a PDF as an Anvil Media object.
|
|
59
|
+
|
|
60
|
+
[Anvil Docs](https://anvil.works/docs/working-with-files/creating-pdf-files)"""
|
|
61
|
+
...
|
|
@@ -0,0 +1,15 @@
|
|
|
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.plotly_templates module
|
|
6
|
+
# Generated files: client/anvil/plotly_templates.pyi, server/anvil/plotly_templates.pyi
|
|
7
|
+
|
|
8
|
+
from typing import Any
|
|
9
|
+
|
|
10
|
+
templates: dict[str, Any]
|
|
11
|
+
"""A dictionary of custom templates for anvil themes."""
|
|
12
|
+
|
|
13
|
+
def set_default(template: str | Any) -> None:
|
|
14
|
+
"""Sets the default plotly template."""
|
|
15
|
+
...
|
|
@@ -0,0 +1,8 @@
|
|
|
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.saml module
|
|
6
|
+
# Generated files: client/anvil/saml/__init__.pyi, server/anvil/saml/__init__.pyi
|
|
7
|
+
|
|
8
|
+
from anvil.saml import auth as auth
|
|
@@ -0,0 +1,21 @@
|
|
|
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.saml.auth module
|
|
6
|
+
# Generated files: client/anvil/saml/auth.pyi, server/anvil/saml/auth.pyi
|
|
7
|
+
|
|
8
|
+
from typing import Any
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def get_user_email() -> str | None:
|
|
12
|
+
"""Get the email address of the currently-logged-in SAML user.
|
|
13
|
+
|
|
14
|
+
To log in with SAML, call anvil.saml.auth.login() from form code."""
|
|
15
|
+
...
|
|
16
|
+
|
|
17
|
+
def get_user_attributes() -> dict[str, Any] | None:
|
|
18
|
+
"""Get the user attributes of the currently-logged-in SAML user.
|
|
19
|
+
|
|
20
|
+
The exact attributes available will depend on your SAML Identity Provider."""
|
|
21
|
+
...
|
|
@@ -0,0 +1,22 @@
|
|
|
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.secrets module
|
|
6
|
+
# Generated files: client/anvil/secrets.pyi, server/anvil/secrets.pyi
|
|
7
|
+
|
|
8
|
+
class SecretError(Exception):
|
|
9
|
+
"""Secret access or encryption error."""
|
|
10
|
+
...
|
|
11
|
+
|
|
12
|
+
def get_secret(secret_name: str) -> str:
|
|
13
|
+
"""Retrieve the named secret."""
|
|
14
|
+
...
|
|
15
|
+
|
|
16
|
+
def encrypt_with_key(key_name: str, value: str) -> str:
|
|
17
|
+
"""Encrypt a string with a cryptographic key derived from the named secret."""
|
|
18
|
+
...
|
|
19
|
+
|
|
20
|
+
def decrypt_with_key(key_name: str, value: str) -> str:
|
|
21
|
+
"""Decrypt a string with a cryptographic key derived from the named secret."""
|
|
22
|
+
...
|