@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,62 @@
1
+ # Type stubs for anvil.media module
2
+ # Generated files: client/anvil/media.pyi, server/anvil/media.pyi
3
+
4
+ from typing import IO, Any
5
+
6
+ from anvil import Media
7
+
8
+ # @client-only
9
+ def print_media(media: Media, /) -> None:
10
+ """Print the given Media Object immediately in the user's browser."""
11
+ ...
12
+
13
+ def download(media: Media, /) -> None:
14
+ """Download the given Media Object immediately in the user's browser."""
15
+ ...
16
+
17
+ class TempUrl:
18
+ """Creates a temporary client-side URL for a Media object, even if the media has no permanent URL.
19
+
20
+ This URL should be revoked when you are finished with it. If you use TempUrl as a context
21
+ manager ('with TempUrl(media) as url:'), this happens automatically; if you instantiate it
22
+ manually you must call 'revoke()' on the instance.
23
+
24
+ The download argument only affects LazyMedia objects."""
25
+
26
+ url: str
27
+ """The temporary URL."""
28
+
29
+ def __init__(self, media: Media, *, download: bool = True) -> None: ...
30
+ def __enter__(self) -> str:
31
+ """Get the url using a 'with' block."""
32
+ ...
33
+ def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None:
34
+ """Revoke a url when exiting a 'with' block."""
35
+ ...
36
+ def revoke(self) -> None:
37
+ """Revoke a url from a media object."""
38
+ ...
39
+ # @end-client-only
40
+
41
+ # @server-only
42
+ class TempFile:
43
+ """Create a temporary file initialised with the contents of the provided media, if any."""
44
+
45
+ def __init__(self, media: Media | None = None) -> None: ...
46
+ def __enter__(self) -> str:
47
+ """Returns the path to the temporary file."""
48
+ ...
49
+ def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None: ...
50
+
51
+ def from_file(filename: str, mime_type: str | None = None, name: str | None = None) -> Media:
52
+ """Creates a Media object from the given file."""
53
+ ...
54
+
55
+ def open(media: Media) -> IO[bytes]:
56
+ """Open a media file as Python BytesIO object."""
57
+ ...
58
+ # @end-server-only
59
+
60
+ def write_to_file(media: Media, filename: str) -> None:
61
+ """Write a Media object to the given file."""
62
+ ...
@@ -0,0 +1,4 @@
1
+ # Type stubs for anvil.microsoft module
2
+ # Generated files: client/anvil/microsoft/__init__.pyi, server/anvil/microsoft/__init__.pyi
3
+
4
+ from anvil.microsoft import auth as auth
@@ -0,0 +1,32 @@
1
+ # Type stubs for anvil.microsoft.auth module
2
+ # Generated files: client/anvil/microsoft/auth.pyi, server/anvil/microsoft/auth.pyi
3
+
4
+ # @client-only
5
+ def login() -> None:
6
+ """Prompt the user to log in with their Microsoft account."""
7
+ ...
8
+ # @end-client-only
9
+
10
+ def get_user_email() -> str | None:
11
+ """Get the email address of the currently-logged-in Microsoft user.
12
+
13
+ To log in with Microsoft, call anvil_microsoft.auth.login() from form code."""
14
+ ...
15
+
16
+ def get_user_access_token() -> str | None:
17
+ """Get the secret access token of the currently-logged-in Microsoft user, for use with the Microsoft REST API.
18
+
19
+ Requires this app to have its own Microsoft client ID and secret."""
20
+ ...
21
+
22
+ def get_user_refresh_token() -> str | None:
23
+ """Get the secret refresh token of the currently-logged-in Microsoft user, for use with the Microsoft REST API.
24
+
25
+ Requires this app to have its own Microsoft client ID and secret."""
26
+ ...
27
+
28
+ def refresh_access_token(refresh_token: str, /) -> str:
29
+ """Get a new access token from a refresh token you have saved, for use with the Microsoft REST API.
30
+
31
+ Requires this app to have its own Microsoft client ID and secret."""
32
+ ...
@@ -0,0 +1,25 @@
1
+ # Type stubs for anvil.mpl_util module
2
+ # Generated files: client/anvil/mpl_util.pyi, server/anvil/mpl_util.pyi
3
+
4
+ from typing import Any
5
+
6
+ from anvil import Media
7
+
8
+ def plot_image(
9
+ *,
10
+ dpi: int | None = None,
11
+ facecolor: Any | None = None,
12
+ edgecolor: Any | None = None,
13
+ format: str | None = None,
14
+ transparent: bool | None = None,
15
+ frameon: bool | None = None,
16
+ bbox_inches: str | Any | None = None,
17
+ pad_inches: float | None = None,
18
+ filename: str | None = None,
19
+ ) -> Media:
20
+ """Return the current Matplotlib figure as a PNG image.
21
+
22
+ Returns an Anvil Media object that can be displayed in Image components.
23
+
24
+ Optional arguments have the same meaning as for 'savefig()'."""
25
+ ...
@@ -0,0 +1,58 @@
1
+ # @server-only-file
2
+ # Type stubs for anvil.pdf module
3
+ # Generated files: server/anvil/pdf.pyi
4
+
5
+ from typing import Any, Literal
6
+
7
+ from anvil import Media
8
+
9
+ class PDFRenderer:
10
+ """Configure options for PDF rendering. Returns an object with a render_form() method.
11
+
12
+ [Anvil Docs](https://anvil.works/docs/media/creating_pdfs)"""
13
+
14
+ def __init__(
15
+ self,
16
+ *,
17
+ filename: str = "print.pdf",
18
+ landscape: bool = False,
19
+ margins: dict[str, float] | float | None = None,
20
+ page_size: str | tuple[float, float] = "letter",
21
+ quality: Literal["original", "screen", "printer", "prepress", "default"] = "default",
22
+ scale: float = 1.0,
23
+ ) -> None:
24
+ """Create a PDF renderer with specified options.
25
+
26
+ Args:
27
+ filename: The name of the generated PDF file.
28
+ landscape: Generate a PDF in landscape orientation.
29
+ margins: Page margins (in centimetres), as a dictionary specifying margins on each side
30
+ (eg {'top': 1.0, 'bottom': 1.0, 'left': 1.0, 'right': 1.0}) or as a number specifying
31
+ a global margin. The default value is 1.0.
32
+ page_size: Can be the name of a standard page size ('letter' or 'A0'-'A10'),
33
+ or a tuple of (width, height) in centimetres.
34
+ quality: The quality of the generated PDF, which has a large impact on file size.
35
+ Available values are: 'original', 'screen', 'printer', 'prepress', 'default'.
36
+ scale: The scale (zoom level) at which you are printing. The default value is 1.0.
37
+ """
38
+ ...
39
+
40
+ def render_form(self, form_name: str, *args: Any, **kwargs: Any) -> Media:
41
+ """Render an Anvil form to PDF.
42
+
43
+ Pass the name of the form you want to render, plus any arguments you want
44
+ to pass to its constructor.
45
+
46
+ Returns a PDF as an Anvil Media object."""
47
+ ...
48
+
49
+ def render_form(form_name: str, *args: Any, **kwargs: Any) -> Media:
50
+ """Render an Anvil form to PDF.
51
+
52
+ Pass the name of the form you want to render, plus any arguments you want
53
+ to pass to its constructor.
54
+
55
+ Returns a PDF as an Anvil Media object.
56
+
57
+ [Anvil Docs](https://anvil.works/docs/working-with-files/creating-pdf-files)"""
58
+ ...
@@ -0,0 +1,11 @@
1
+ # Type stubs for anvil.plotly_templates module
2
+ # Generated files: client/anvil/plotly_templates.pyi, server/anvil/plotly_templates.pyi
3
+
4
+ from typing import Any
5
+
6
+ templates: dict[str, Any]
7
+ """A dictionary of custom templates for anvil themes."""
8
+
9
+ def set_default(template: str | Any) -> None:
10
+ """Sets the default plotly template."""
11
+ ...
@@ -0,0 +1,4 @@
1
+ # Type stubs for anvil.saml module
2
+ # Generated files: client/anvil/saml/__init__.pyi, server/anvil/saml/__init__.pyi
3
+
4
+ from anvil.saml import auth as auth
@@ -0,0 +1,22 @@
1
+ # Type stubs for anvil.saml.auth module
2
+ # Generated files: client/anvil/saml/auth.pyi, server/anvil/saml/auth.pyi
3
+
4
+ from typing import Any
5
+
6
+ # @client-only
7
+ def login() -> None:
8
+ """Prompt the user to log in via SAML."""
9
+ ...
10
+ # @end-client-only
11
+
12
+ def get_user_email() -> str | None:
13
+ """Get the email address of the currently-logged-in SAML user.
14
+
15
+ To log in with SAML, call anvil.saml.auth.login() from form code."""
16
+ ...
17
+
18
+ def get_user_attributes() -> dict[str, Any] | None:
19
+ """Get the user attributes of the currently-logged-in SAML user.
20
+
21
+ The exact attributes available will depend on your SAML Identity Provider."""
22
+ ...
@@ -0,0 +1,18 @@
1
+ # Type stubs for anvil.secrets module
2
+ # Generated files: client/anvil/secrets.pyi, server/anvil/secrets.pyi
3
+
4
+ class SecretError(Exception):
5
+ """Secret access or encryption error."""
6
+ ...
7
+
8
+ def get_secret(secret_name: str) -> str:
9
+ """Retrieve the named secret."""
10
+ ...
11
+
12
+ def encrypt_with_key(key_name: str, value: str) -> str:
13
+ """Encrypt a string with a cryptographic key derived from the named secret."""
14
+ ...
15
+
16
+ def decrypt_with_key(key_name: str, value: str) -> str:
17
+ """Decrypt a string with a cryptographic key derived from the named secret."""
18
+ ...