-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add stubs for "click-web" package #13208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| version = "0.8.*" | ||
| requires = ["click>=8.0.0", "Flask>=2.3.2"] | ||
| upstream_repository = "https://github.com/fredrik-corneliusson/click-web" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import logging | ||
| import types | ||
| from _typeshed import Incomplete | ||
|
|
||
| import click | ||
| import flask | ||
|
|
||
| # This should be jinja2.Environment, but it does not have stubs and forbidden for requires in METADATA.toml | ||
| jinja_env: Incomplete | ||
| script_file: str | None | ||
| click_root_cmd: str | None | ||
| OUTPUT_FOLDER: str | ||
| _flask_app: flask.Flask | None | ||
| logger: logging.Logger | None | ||
|
|
||
| def create_click_web_app(module: types.ModuleType, command: click.BaseCommand, root: str = "/") -> flask.Flask: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| class ClickWebException(Exception): ... | ||
| class CommandNotFound(ClickWebException): ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| import logging | ||
|
|
||
| from flask import Response | ||
|
|
||
| from .input_fields import FieldId | ||
|
|
||
| logger: logging.Logger | None | ||
|
|
||
| HTML_HEAD: str | ||
| HTML_TAIL: str | ||
|
|
||
| class Executor: | ||
| RAW_CMD_PATH: str | ||
|
|
||
| def __init__(self) -> None: ... | ||
| def exec(self, command_path: str) -> Response: ... | ||
| def _exec_raw(self, command: list[str]) -> Response: ... # undocumented | ||
| def _exec_html(self, command_path: str) -> Response: ... # undocumented | ||
| def _run_script_and_generate_stream(self) -> None: ... # undocumented | ||
| def _create_cmd_header(self, commands: list[CmdPart]) -> str: ... # undocumented | ||
| def _create_result_footer(self) -> str: ... # undocumented | ||
|
|
||
| def _get_download_link(field_info: FieldFileInfo) -> str: ... # undocumented | ||
|
|
||
| class CommandLineRaw: | ||
| def __init__(self, script_file_path: str, command: str) -> None: ... | ||
| def append(self, part: str, secret: bool = False) -> None: ... | ||
| def get_commandline(self, obfuscate: bool = False) -> list[str]: ... | ||
| def get_download_field_infos(self) -> list[FieldInfo]: ... | ||
| def after_script_executed(self) -> None: ... | ||
|
|
||
| class CommandLineForm: | ||
| def __init__(self, script_file_path: str, commands: list[str]) -> None: ... | ||
| def append(self, part: str, secret: bool = False) -> None: ... | ||
| def get_commandline(self, obfuscate: bool = False) -> list[str]: ... | ||
| def get_download_field_infos(self) -> list[FieldInfo]: ... | ||
| def after_script_executed(self) -> None: ... | ||
|
|
||
| def _get_python_interpreter() -> str: ... | ||
|
|
||
| class CmdPart: | ||
| def __init__(self, part: str, secret: bool = False) -> None: ... | ||
|
|
||
| class FormToCommandLineBuilder: | ||
| def __init__(self, command_line: CommandLineForm) -> None: ... | ||
| def add_command_args(self, command_index: int) -> None: ... | ||
| @staticmethod | ||
| def _is_option(cmd_option: str) -> bool: ... | ||
| def _process_option(self, field_info: FieldInfo) -> None: ... | ||
|
|
||
| class FieldInfo: | ||
| @staticmethod | ||
| def factory(key: str) -> FieldInfo: ... | ||
| def __init__(self, param: FieldId) -> None: ... | ||
| def before_script_execute(self) -> None: ... | ||
| def after_script_executed(self) -> None: ... | ||
| def __lt__(self, other: object) -> bool: ... | ||
| def __eq__(self, other: object) -> bool: ... | ||
|
|
||
| class FieldFileInfo(FieldInfo): | ||
| def __init__(self, fimeta: FieldId) -> None: ... | ||
| def before_script_execute(self) -> None: ... | ||
| @classmethod | ||
| def temp_dir(cls) -> str: ... | ||
| def save(self) -> None: ... | ||
|
|
||
| class FieldOutFileInfo(FieldFileInfo): | ||
| def __init__(self, fimeta: FieldId) -> None: ... | ||
| def save(self) -> None: ... | ||
|
|
||
| class FieldPathInfo(FieldFileInfo): | ||
| def save(self) -> None: ... | ||
| def after_script_executed(self) -> None: ... | ||
|
|
||
| class FieldPathOutInfo(FieldOutFileInfo): | ||
| def save(self) -> None: ... | ||
| def after_script_executed(self) -> None: ... | ||
|
|
||
| def zip_folder(folder_path: str, out_folder: str, out_prefix: str) -> str: ... | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import click | ||
|
|
||
| def get_form_for(command_path: str) -> str: ... | ||
| def _get_commands_by_path(command_path: str) -> list[tuple[click.Context, click.Command]]: ... | ||
| def _generate_form_data(ctx_and_commands: list[tuple[click.Context, click.Command]]): ... | ||
| def _process_help(help_text: bool) -> str: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| from typing import Any | ||
|
|
||
| import click | ||
|
|
||
| def index() -> str: ... | ||
| def _click_to_tree(ctx: click.Context, node: click.Command, ancestors: list[click.Command] | None = None) -> dict[str, Any]: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| from typing import Any | ||
|
|
||
| import click | ||
|
|
||
| class FieldId: | ||
| SEPARATOR: str | ||
|
|
||
| def __init__( | ||
| self, | ||
| command_index: int, | ||
| param_index: int, | ||
| param_type: str, | ||
| click_type: str, | ||
| nargs: int, | ||
| form_type: str, | ||
| name: str, | ||
| key: str | None = None, | ||
| ): ... | ||
| @classmethod | ||
| def from_string(cls, field_info_as_string: str) -> FieldId: ... | ||
|
|
||
| class NotSupported(ValueError): ... | ||
|
|
||
| class BaseInput: | ||
| param_type_cls: type | None | ||
| def __init__(self, ctx: click.Context, param: click.Parameter, command_index: int, param_index: int) -> None: ... | ||
| def is_supported(self) -> bool: ... | ||
| @property | ||
| def fields(self) -> dict[str, Any]: ... | ||
| @property | ||
| def type_attrs(self) -> dict[str, Any]: ... | ||
| def _to_cmd_line_name(self, name: str) -> str: ... | ||
| def _build_name(self, name: str): ... | ||
|
|
||
| class ChoiceInput(BaseInput): ... | ||
| class FlagInput(BaseInput): ... | ||
| class IntInput(BaseInput): ... | ||
| class FloatInput(BaseInput): ... | ||
| class FolderInput(BaseInput): ... | ||
| class FileInput(BaseInput): ... | ||
| class EmailInput(BaseInput): ... | ||
| class PasswordInput(BaseInput): ... | ||
| class TextAreaInput(BaseInput): ... | ||
| class DefaultInput(BaseInput): ... | ||
|
|
||
| INPUT_TYPES: list[type] | ||
| _DEFAULT_INPUT: list[type] | ||
|
|
||
| def get_input_field(ctx: click.Context, param: click.Parameter, command_index, param_index) -> dict[str, Any]: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import re | ||
| import typing as t | ||
|
|
||
| import click | ||
|
|
||
| class EmailParamType(click.ParamType): | ||
| EMAIL_REGEX: re.Pattern[str] | ||
| def convert(self, value: t.Any, param: click.Parameter | None, ctx: click.Context | None) -> t.Any: ... | ||
|
|
||
| class PasswordParamType(click.ParamType): | ||
| def convert(self, value: t.Any, param: click.Parameter | None, ctx: click.Context | None) -> t.Any: ... | ||
|
|
||
| class TextAreaParamType(click.ParamType): | ||
| def convert(self, value: t.Any, param: click.Parameter | None, ctx: click.Context | None) -> t.Any: ... | ||
|
|
||
| EMAIL_TYPE: EmailParamType | ||
| PASSWORD_TYPE: PasswordParamType | ||
| TEXTAREA_TYPE: TextAreaParamType |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.