-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add type stubs for package console-menu. #8820
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 2 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
7ff61b6
Add type stubs for package console-menu.
bastisawesome 9436c99
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 99c79d9
Merge branch 'python:master' into master
bastisawesome 6ba1038
Update stubs/console-menu/consolemenu/console_menu.pyi
bastisawesome 9d9e9f5
Update stubs/console-menu/consolemenu/console_menu.pyi
bastisawesome 5d78ecf
Update stubs/console-menu/consolemenu/console_menu.pyi
bastisawesome 66428d3
Update stubs/console-menu/consolemenu/console_menu.pyi
bastisawesome f51cc31
Update stubs/console-menu/consolemenu/format/menu_borders.pyi
bastisawesome 8be7aad
Update stubs/console-menu/consolemenu/format/menu_borders.pyi
bastisawesome 138fa50
Update stubs/console-menu/consolemenu/items/external_item.pyi
bastisawesome 946474d
Update stubs/console-menu/consolemenu/items/function_item.pyi
bastisawesome 18c345c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] c14000a
Apply suggestions from code review
bastisawesome 3706e68
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 33c28bf
Fix mistakes in initial PR
bastisawesome 72dd2a0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 4d5dd08
Remove re-exports
bastisawesome 6d75634
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 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,4 @@ | ||
version = "0.7.*" | ||
|
||
[tool.stubtest] | ||
ignore_missing_stub = false |
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 . import items as items | ||
from .console_menu import ConsoleMenu as ConsoleMenu, Screen as Screen, clear_terminal as clear_terminal | ||
from .menu_formatter import MenuFormatBuilder as MenuFormatBuilder | ||
from .multiselect_menu import MultiSelectMenu as MultiSelectMenu | ||
from .prompt_utils import PromptUtils as PromptUtils | ||
from .selection_menu import SelectionMenu as SelectionMenu |
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,86 @@ | ||
from consolemenu.menu_formatter import MenuFormatBuilder as MenuFormatBuilder | ||
from consolemenu.screen import Screen as Screen | ||
|
||
class ConsoleMenu: | ||
currently_active_menu: ConsoleMenu | None | ||
screen: Screen | ||
clear_screen_before_render: bool | ||
formatter: MenuFormatBuilder | ||
title: str | None | ||
subtitle: str | None | ||
prologue_text: str | None | ||
epilogue_text: str | None | ||
highlight: None | ||
normal: None | ||
show_exit_option: bool | ||
items: list[MenuItem] | ||
parent: ConsoleMenu | ||
exit_item: ExitItem | ||
current_option: int | ||
selected_option: int | ||
returned_value: object | ||
should_exit: bool | ||
previous_active_menu: ConsoleMenu | ||
bastisawesome marked this conversation as resolved.
Show resolved
Hide resolved
|
||
def __init__( | ||
self, | ||
title: str | None = ..., | ||
bastisawesome marked this conversation as resolved.
Show resolved
Hide resolved
|
||
subtitle: str | None = ..., | ||
screen: Screen | None = ..., | ||
formatter: MenuFormatBuilder | None = ..., | ||
prologue_text: str | None = ..., | ||
epilogue_text: str | None = ..., | ||
clear_screen: bool = ..., | ||
show_exit_option: bool = ..., | ||
exit_option_text: str = ..., | ||
) -> None: ... | ||
@property | ||
def current_item(self) -> MenuItem: ... | ||
bastisawesome marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@property | ||
def selected_item(self) -> MenuItem: ... | ||
bastisawesome marked this conversation as resolved.
Show resolved
Hide resolved
|
||
def append_item(self, item: MenuItem) -> None: ... | ||
def remove_item(self, item: MenuItem) -> bool: ... | ||
def add_exit(self) -> bool: ... | ||
def remove_exit(self) -> bool: ... | ||
def is_selected_item_exit(self) -> bool: ... | ||
def start(self, show_exit_option: bool | None = ...) -> None: ... | ||
def show(self, show_exit_option: bool | None = ...) -> None: ... | ||
def draw(self) -> None: ... | ||
def is_running(self) -> bool: ... | ||
def wait_for_start(self, timeout: float | None = ...) -> bool: ... | ||
def is_alive(self) -> bool: ... | ||
def pause(self) -> None: ... | ||
def resume(self) -> None: ... | ||
def join(self, timeout: float | None = ...) -> None: ... | ||
def get_input(self) -> int: ... | ||
def process_user_input(self) -> int | None: ... | ||
def go_to(self, option: int) -> None: ... | ||
def go_down(self) -> None: ... | ||
def go_up(self) -> None: ... | ||
def select(self) -> None: ... | ||
def exit(self) -> None: ... | ||
def clear_screen(self) -> None: ... | ||
def get_title(self) -> str: ... | ||
def get_subtitle(self) -> str: ... | ||
def get_prologue_text(self) -> str: ... | ||
def get_epilogue_text(self) -> str: ... | ||
|
||
class MenuItem: | ||
text: str | ||
menu: ConsoleMenu | ||
bastisawesome marked this conversation as resolved.
Show resolved
Hide resolved
|
||
should_exit: bool | ||
index_item_separator: str | ||
def __init__(self, text: str, menu: ConsoleMenu | None = ..., should_exit: bool = ...) -> None: ... | ||
bastisawesome marked this conversation as resolved.
Show resolved
Hide resolved
|
||
def show(self, index: int) -> str: ... | ||
def set_up(self) -> None: ... | ||
def action(self) -> None: ... | ||
def clean_up(self) -> None: ... | ||
def get_return(self) -> object: ... | ||
def __eq__(self, o: MenuItem) -> bool: ... # type: ignore[override] | ||
def get_text(self) -> str: ... | ||
|
||
class ExitItem(MenuItem): | ||
def __init__(self, text: str = ..., menu: ConsoleMenu | None = ...) -> None: ... | ||
bastisawesome marked this conversation as resolved.
Show resolved
Hide resolved
|
||
text: str | ||
bastisawesome marked this conversation as resolved.
Show resolved
Hide resolved
|
||
def show(self, index: int, available_width: None = ...): ... | ||
|
||
def clear_terminal() -> None: ... |
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,14 @@ | ||
from .menu_borders import ( | ||
AsciiBorderStyle as AsciiBorderStyle, | ||
DoubleLineBorderStyle as DoubleLineBorderStyle, | ||
DoubleLineOuterLightInnerBorderStyle as DoubleLineOuterLightInnerBorderStyle, | ||
HeavyBorderStyle as HeavyBorderStyle, | ||
HeavyOuterLightInnerBorderStyle as HeavyOuterLightInnerBorderStyle, | ||
LightBorderStyle as LightBorderStyle, | ||
MenuBorderStyle as MenuBorderStyle, | ||
MenuBorderStyleFactory as MenuBorderStyleFactory, | ||
MenuBorderStyleType as MenuBorderStyleType, | ||
) | ||
from .menu_margins import MenuMargins as MenuMargins | ||
from .menu_padding import MenuPadding as MenuPadding | ||
from .menu_style import MenuStyle as MenuStyle |
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,194 @@ | ||
from _typeshed import Incomplete | ||
|
||
class MenuBorderStyle: | ||
@property | ||
def bottom_left_corner(self) -> str: ... | ||
@property | ||
def bottom_right_corner(self) -> str: ... | ||
@property | ||
def inner_horizontal(self) -> str: ... | ||
@property | ||
def inner_vertical(self) -> str: ... | ||
@property | ||
def intersection(self) -> str: ... | ||
@property | ||
def outer_horizontal(self) -> str: ... | ||
@property | ||
def outer_horizontal_inner_down(self) -> str: ... | ||
@property | ||
def outer_horizontal_inner_up(self) -> str: ... | ||
@property | ||
def outer_vertical(self) -> str: ... | ||
@property | ||
def outer_vertical_inner_left(self) -> str: ... | ||
@property | ||
def outer_vertical_inner_right(self) -> str: ... | ||
@property | ||
def top_left_corner(self) -> str: ... | ||
@property | ||
def top_right_corner(self) -> str: ... | ||
|
||
class AsciiBorderStyle(MenuBorderStyle): | ||
@property | ||
def bottom_left_corner(self) -> str: ... | ||
@property | ||
def bottom_right_corner(self) -> str: ... | ||
@property | ||
def inner_horizontal(self) -> str: ... | ||
@property | ||
def inner_vertical(self) -> str: ... | ||
@property | ||
def intersection(self) -> str: ... | ||
@property | ||
def outer_horizontal(self) -> str: ... | ||
@property | ||
def outer_horizontal_inner_down(self) -> str: ... | ||
@property | ||
def outer_horizontal_inner_up(self) -> str: ... | ||
@property | ||
def outer_vertical(self) -> str: ... | ||
@property | ||
def outer_vertical_inner_left(self) -> str: ... | ||
@property | ||
def outer_vertical_inner_right(self) -> str: ... | ||
@property | ||
def top_left_corner(self) -> str: ... | ||
@property | ||
def top_right_corner(self) -> str: ... | ||
|
||
class LightBorderStyle(MenuBorderStyle): | ||
@property | ||
def bottom_left_corner(self) -> str: ... | ||
@property | ||
def bottom_right_corner(self) -> str: ... | ||
@property | ||
def inner_horizontal(self) -> str: ... | ||
@property | ||
def inner_vertical(self) -> str: ... | ||
@property | ||
def intersection(self) -> str: ... | ||
@property | ||
def outer_horizontal(self) -> str: ... | ||
@property | ||
def outer_horizontal_inner_down(self) -> str: ... | ||
@property | ||
def outer_horizontal_inner_up(self) -> str: ... | ||
@property | ||
def outer_vertical(self) -> str: ... | ||
@property | ||
def outer_vertical_inner_left(self) -> str: ... | ||
@property | ||
def outer_vertical_inner_right(self) -> str: ... | ||
@property | ||
def top_left_corner(self) -> str: ... | ||
@property | ||
def top_right_corner(self) -> str: ... | ||
|
||
class HeavyBorderStyle(MenuBorderStyle): | ||
@property | ||
def bottom_left_corner(self) -> str: ... | ||
@property | ||
def bottom_right_corner(self) -> str: ... | ||
@property | ||
def inner_horizontal(self) -> str: ... | ||
@property | ||
def inner_vertical(self) -> str: ... | ||
@property | ||
def intersection(self) -> str: ... | ||
@property | ||
def outer_horizontal(self) -> str: ... | ||
@property | ||
def outer_horizontal_inner_down(self) -> str: ... | ||
@property | ||
def outer_horizontal_inner_up(self) -> str: ... | ||
@property | ||
def outer_vertical(self) -> str: ... | ||
@property | ||
def outer_vertical_inner_left(self) -> str: ... | ||
@property | ||
def outer_vertical_inner_right(self) -> str: ... | ||
@property | ||
def top_left_corner(self) -> str: ... | ||
@property | ||
def top_right_corner(self) -> str: ... | ||
|
||
class HeavyOuterLightInnerBorderStyle(HeavyBorderStyle): | ||
@property | ||
def inner_horizontal(self) -> str: ... | ||
@property | ||
def inner_vertical(self) -> str: ... | ||
@property | ||
def intersection(self) -> str: ... | ||
@property | ||
def outer_horizontal_inner_down(self) -> str: ... | ||
@property | ||
def outer_horizontal_inner_up(self) -> str: ... | ||
@property | ||
def outer_vertical_inner_left(self) -> str: ... | ||
@property | ||
def outer_vertical_inner_right(self) -> str: ... | ||
|
||
class DoubleLineBorderStyle(MenuBorderStyle): | ||
@property | ||
def bottom_left_corner(self) -> str: ... | ||
@property | ||
def bottom_right_corner(self) -> str: ... | ||
@property | ||
def inner_horizontal(self) -> str: ... | ||
@property | ||
def inner_vertical(self) -> str: ... | ||
@property | ||
def intersection(self) -> str: ... | ||
@property | ||
def outer_horizontal(self) -> str: ... | ||
@property | ||
def outer_horizontal_inner_down(self) -> str: ... | ||
@property | ||
def outer_horizontal_inner_up(self) -> str: ... | ||
@property | ||
def outer_vertical(self) -> str: ... | ||
@property | ||
def outer_vertical_inner_left(self) -> str: ... | ||
@property | ||
def outer_vertical_inner_right(self) -> str: ... | ||
@property | ||
def top_left_corner(self) -> str: ... | ||
@property | ||
def top_right_corner(self) -> str: ... | ||
|
||
class DoubleLineOuterLightInnerBorderStyle(DoubleLineBorderStyle): | ||
@property | ||
def inner_horizontal(self) -> str: ... | ||
@property | ||
def inner_vertical(self) -> str: ... | ||
@property | ||
def intersection(self) -> str: ... | ||
@property | ||
def outer_horizontal_inner_down(self) -> str: ... | ||
@property | ||
def outer_horizontal_inner_up(self) -> str: ... | ||
@property | ||
def outer_vertical_inner_left(self) -> str: ... | ||
@property | ||
def outer_vertical_inner_right(self) -> str: ... | ||
|
||
class MenuBorderStyleType: | ||
ASCII_BORDER: int | ||
LIGHT_BORDER: int | ||
HEAVY_BORDER: int | ||
DOUBLE_LINE_BORDER: int | ||
HEAVY_OUTER_LIGHT_INNER_BORDER: int | ||
DOUBLE_LINE_OUTER_LIGHT_INNER_BORDER: int | ||
|
||
class MenuBorderStyleFactory: | ||
logger: Incomplete | ||
bastisawesome marked this conversation as resolved.
Show resolved
Hide resolved
|
||
def __init__(self) -> None: ... | ||
def create_border(self, border_style_type: MenuBorderStyleType): ... | ||
bastisawesome marked this conversation as resolved.
Show resolved
Hide resolved
|
||
def create_ascii_border(self) -> AsciiBorderStyle: ... | ||
def create_light_border(self) -> LightBorderStyle: ... | ||
def create_heavy_border(self) -> HeavyBorderStyle: ... | ||
bastisawesome marked this conversation as resolved.
Show resolved
Hide resolved
|
||
def create_heavy_outer_light_inner_border(self) -> HeavyOuterLightInnerBorderStyle: ... | ||
def create_doubleline_border(self) -> DoubleLineBorderStyle: ... | ||
def create_doubleline_outer_light_inner_border(self) -> DoubleLineOuterLightInnerBorderStyle: ... | ||
@staticmethod | ||
def is_win_python35_or_earlier() -> bool: ... |
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 @@ | ||
class MenuMargins: | ||
def __init__(self, top: int = ..., left: int = ..., bottom: int = ..., right: int = ...) -> None: ... | ||
@property | ||
def left(self) -> int: ... | ||
@left.setter | ||
def left(self, left: int) -> None: ... | ||
@property | ||
def right(self) -> int: ... | ||
@right.setter | ||
def right(self, right: int) -> None: ... | ||
@property | ||
def top(self) -> int: ... | ||
@top.setter | ||
def top(self, top: int) -> None: ... | ||
@property | ||
def bottom(self) -> int: ... | ||
@bottom.setter | ||
def bottom(self, bottom: int) -> None: ... |
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 @@ | ||
class MenuPadding: | ||
def __init__(self, top: int = ..., left: int = ..., bottom: int = ..., right: int = ...) -> None: ... | ||
@property | ||
def left(self) -> int: ... | ||
@left.setter | ||
def left(self, left: int) -> None: ... | ||
@property | ||
def right(self) -> int: ... | ||
@right.setter | ||
def right(self, right: int) -> None: ... | ||
@property | ||
def top(self) -> int: ... | ||
@top.setter | ||
def top(self, top: int) -> None: ... | ||
@property | ||
def bottom(self) -> int: ... | ||
@bottom.setter | ||
def bottom(self, bottom: int) -> None: ... |
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,29 @@ | ||
from consolemenu.format.menu_borders import MenuBorderStyle as MenuBorderStyle, MenuBorderStyleFactory as MenuBorderStyleFactory | ||
from consolemenu.format.menu_margins import MenuMargins as MenuMargins | ||
from consolemenu.format.menu_padding import MenuPadding as MenuPadding | ||
|
||
class MenuStyle: | ||
def __init__( | ||
self, | ||
margins: MenuMargins | None = ..., | ||
padding: MenuPadding | None = ..., | ||
border_style: MenuBorderStyle | None = ..., | ||
border_style_type: int | None = ..., | ||
border_style_factory: MenuBorderStyleFactory | None = ..., | ||
) -> None: ... | ||
@property | ||
def margins(self) -> MenuMargins: ... | ||
@margins.setter | ||
def margins(self, margins: MenuMargins) -> None: ... | ||
@property | ||
def padding(self) -> MenuPadding: ... | ||
@padding.setter | ||
def padding(self, padding: MenuPadding) -> None: ... | ||
@property | ||
def border_style(self) -> MenuBorderStyle: ... | ||
@border_style.setter | ||
def border_style(self, border_style: MenuBorderStyle) -> None: ... | ||
@property | ||
def border_style_factory(self) -> MenuBorderStyleFactory: ... | ||
@border_style_factory.setter | ||
def border_style_factory(self, border_style_factory: MenuBorderStyleFactory) -> None: ... |
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 ..console_menu import ExitItem as ExitItem, MenuItem as MenuItem | ||
from .command_item import CommandItem as CommandItem | ||
from .external_item import ExternalItem as ExternalItem | ||
from .function_item import FunctionItem as FunctionItem | ||
from .selection_item import SelectionItem as SelectionItem | ||
from .submenu_item import SubmenuItem as SubmenuItem |
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.