|
20 | 20 | from mimetypes import guess_type |
21 | 21 | from pathlib import Path |
22 | 22 | from copy import deepcopy |
23 | | -from typing import Optional, Any |
| 23 | +from typing import Optional, Any, Sequence |
24 | 24 | import click |
25 | 25 |
|
26 | 26 | from os.path import basename, dirname, exists, isdir, join, relpath, splitext, isfile, abspath |
@@ -844,12 +844,12 @@ def make_api_manifest( |
844 | 844 | entry_point: str, |
845 | 845 | app_mode: AppMode, |
846 | 846 | environment: Environment, |
847 | | - extra_files: list[str], |
848 | | - excludes: list[str], |
| 847 | + extra_files: Sequence[str], |
| 848 | + excludes: Sequence[str], |
849 | 849 | image: Optional[str] = None, |
850 | 850 | env_management_py: Optional[bool] = None, |
851 | 851 | env_management_r: Optional[bool] = None, |
852 | | -) -> typing.Tuple[typing.Dict[str, typing.Any], typing.List[str]]: |
| 852 | +) -> tuple[dict[str, Any], list[str]]: |
853 | 853 | """ |
854 | 854 | Makes a manifest for an API. |
855 | 855 |
|
@@ -1237,8 +1237,8 @@ def make_api_bundle( |
1237 | 1237 |
|
1238 | 1238 | def _create_quarto_file_list( |
1239 | 1239 | directory: str, |
1240 | | - extra_files: typing.List[str], |
1241 | | - excludes: typing.List[str], |
| 1240 | + extra_files: Sequence[str], |
| 1241 | + excludes: Sequence[str], |
1242 | 1242 | ) -> typing.List[str]: |
1243 | 1243 | """ |
1244 | 1244 | Builds a full list of files under the given directory that should be included |
@@ -1269,8 +1269,8 @@ def make_quarto_manifest( |
1269 | 1269 | quarto_inspection: typing.Dict[str, typing.Any], |
1270 | 1270 | app_mode: AppMode, |
1271 | 1271 | environment: Environment, |
1272 | | - extra_files: typing.List[str], |
1273 | | - excludes: typing.List[str], |
| 1272 | + extra_files: Sequence[str], |
| 1273 | + excludes: Sequence[str], |
1274 | 1274 | image: str = None, |
1275 | 1275 | env_management_py: bool = None, |
1276 | 1276 | env_management_r: bool = None, |
@@ -1406,7 +1406,7 @@ def validate_extra_files(directory: str, extra_files: typing.Sequence[str], use_ |
1406 | 1406 | return result |
1407 | 1407 |
|
1408 | 1408 |
|
1409 | | -def validate_manifest_file(file_or_directory): |
| 1409 | +def validate_manifest_file(file_or_directory: str) -> str: |
1410 | 1410 | """ |
1411 | 1411 | Validates that the name given represents either an existing manifest.json file or |
1412 | 1412 | a directory that contains one. If not, an exception is raised. |
@@ -1674,12 +1674,12 @@ def write_notebook_manifest_json( |
1674 | 1674 | entry_point_file: str, |
1675 | 1675 | environment: Environment, |
1676 | 1676 | app_mode: AppMode, |
1677 | | - extra_files: typing.List[str], |
1678 | | - hide_all_input: bool, |
1679 | | - hide_tagged_input: bool, |
1680 | | - image: str = None, |
1681 | | - env_management_py: bool = None, |
1682 | | - env_management_r: bool = None, |
| 1677 | + extra_files: Sequence[str], |
| 1678 | + hide_all_input: Optional[bool], |
| 1679 | + hide_tagged_input: Optional[bool], |
| 1680 | + image: Optional[str] = None, |
| 1681 | + env_management_py: Optional[bool] = None, |
| 1682 | + env_management_r: Optional[bool] = None, |
1683 | 1683 | ) -> bool: |
1684 | 1684 | """ |
1685 | 1685 | Creates and writes a manifest.json file for the given entry point file. If |
@@ -1840,8 +1840,8 @@ def write_voila_manifest_json( |
1840 | 1840 | entrypoint: str, |
1841 | 1841 | environment: Environment, |
1842 | 1842 | app_mode: AppMode = AppModes.JUPYTER_VOILA, |
1843 | | - extra_files: typing.List[str] = None, |
1844 | | - excludes: typing.List[str] = None, |
| 1843 | + extra_files: Sequence[str] = None, |
| 1844 | + excludes: Sequence[str] = None, |
1845 | 1845 | force_generate: bool = True, |
1846 | 1846 | image: str = None, |
1847 | 1847 | env_management_py: bool = None, |
@@ -1932,11 +1932,11 @@ def write_api_manifest_json( |
1932 | 1932 | entry_point: str, |
1933 | 1933 | environment: Environment, |
1934 | 1934 | app_mode: AppMode, |
1935 | | - extra_files: typing.List[str], |
1936 | | - excludes: typing.List[str], |
1937 | | - image: str = None, |
1938 | | - env_management_py: bool = None, |
1939 | | - env_management_r: bool = None, |
| 1935 | + extra_files: Sequence[str], |
| 1936 | + excludes: Sequence[str], |
| 1937 | + image: Optional[str] = None, |
| 1938 | + env_management_py: Optional[bool] = None, |
| 1939 | + env_management_r: Optional[bool] = None, |
1940 | 1940 | ) -> bool: |
1941 | 1941 | """ |
1942 | 1942 | Creates and writes a manifest.json file for the given entry point file. If |
@@ -2015,8 +2015,8 @@ def write_quarto_manifest_json( |
2015 | 2015 | inspect: typing.Any, |
2016 | 2016 | app_mode: AppMode, |
2017 | 2017 | environment: Environment, |
2018 | | - extra_files: typing.List[str], |
2019 | | - excludes: typing.List[str], |
| 2018 | + extra_files: Sequence[str], |
| 2019 | + excludes: Sequence[str], |
2020 | 2020 | image: str = None, |
2021 | 2021 | env_management_py: bool = None, |
2022 | 2022 | env_management_r: bool = None, |
|
0 commit comments