-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
98f070a
commit 4326bea
Showing
9 changed files
with
178 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 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 @@ | ||
version = "0.8.*" | ||
upstream_repository = "https://github.com/fredrik-corneliusson/click-web" |
This file contains 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,15 @@ | ||
import logging | ||
import types | ||
|
||
import click | ||
import flask | ||
import jinja2 | ||
|
||
jinja_env: jinja2.Environment | ||
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 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 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 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 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 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 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 |