Skip to content

Commit

Permalink
Merge b0ccd31 into 1acb98f
Browse files Browse the repository at this point in the history
  • Loading branch information
tmbo committed Oct 4, 2020
2 parents 1acb98f + b0ccd31 commit c8e4f0d
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ jobs:
install: pip install -r requirements_dev.txt
script: black --check --diff .
after_success: skip
- stage: types
python: 3.7
install: pip install -r requirements_dev.txt
script: mypy questionary
after_success: skip
- stage: deploy
python: 3.6
install: skip
Expand Down
2 changes: 1 addition & 1 deletion questionary/prompts/autocomplete.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def autocomplete(
def get_prompt_tokens() -> List[Tuple[Text, Text]]:
return [("class:qmark", qmark), ("class:question", " {} ".format(message))]

def get_meta_style(meta: Dict[Text, Any]):
def get_meta_style(meta: Optional[Dict[Text, Any]]) -> Optional[Dict[Text, Any]]:
if meta:
for key in meta:
meta[key] = HTML("<text>{}</text>").format(meta[key])
Expand Down
9 changes: 7 additions & 2 deletions questionary/prompts/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@
class Choice(object):
"""One choice in a select, rawselect or checkbox."""

shortcut_key: Optional[Text]

def __init__(
self,
title: FormattedText,
value: Optional[Any] = None,
disabled: Optional[Text] = None,
checked: bool = False,
checked: Optional[bool] = False,
shortcut_key: Optional[Text] = None,
) -> None:
"""Create a new choice.
Expand All @@ -57,7 +59,7 @@ def __init__(

self.disabled = disabled
self.title = title
self.checked = checked
self.checked = checked if checked is not None else False

if value is not None:
self.value = value
Expand Down Expand Up @@ -145,6 +147,9 @@ class InquirerControl(FormattedTextControl):
"z",
]

choices: List[Choice]
selected_options: List[Any]

def __init__(
self,
choices: List[Union[Text, Choice, Dict[Text, Any]]],
Expand Down
1 change: 1 addition & 0 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ pytest-pycodestyle==2.0.0
pytest-cov==2.8.1
coveralls==1.10.0
black==20.8b1
mypy==0.782
5 changes: 5 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ ignore = W504,E251,W503,E121,E126,E211,E225,E501,E203,E402,F401,F811
[metadata]
description-file = README.md
license_file = LICENSE
[mypy]
ignore_missing_imports = True
show_error_codes = True
warn_redundant_casts = True
warn_unused_ignores = True

0 comments on commit c8e4f0d

Please sign in to comment.