Skip to content

Commit

Permalink
Fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonardo Gama committed Jul 7, 2023
1 parent 0534d70 commit 05fdd56
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions schema/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@


import importlib
from typing import Dict, List, Union
from typing import Dict, List, Optional, Union

import click

from samcli.cli.command import _SAM_CLI_COMMAND_PACKAGES
from samcli.lib.config.samconfig import SamConfig


def format_param(param: click.core.Option) -> Dict[str, Union[str, List[str]]]:
def format_param(param: click.core.Option) -> Dict[str, Union[Optional[str], List[str]]]:
"""Format a click Option parameter to a dictionary object.
A parameter object should contain the following information that will be
Expand All @@ -22,7 +22,7 @@ def format_param(param: click.core.Option) -> Dict[str, Union[str, List[str]]]:
a list of those allowed options
* default - The default option for that parameter
"""
formatted_param = {"name": param.name, "help": param.help}
formatted_param: Dict[str, Union[Optional[str], List[str]]] = {"name": param.name, "help": param.help}

# NOTE: Params do not have explicit "string" type; either "text" or "path".
# All choice options are from a set of strings.
Expand All @@ -32,10 +32,10 @@ def format_param(param: click.core.Option) -> Dict[str, Union[str, List[str]]]:
formatted_param["type"] = param.type.name

if param.default:
formatted_param["default"] = param.default
formatted_param["default"] = str(param.default)

if param.type.name == "choice":
formatted_param["choices"] = param.type.choices
if param.type.name == "choice" and isinstance(param.type, click.Choice):
formatted_param["choices"] = list(param.type.choices)

return formatted_param

Expand Down Expand Up @@ -88,7 +88,7 @@ def generate_schema() -> dict:
dict
A dictionary representation of the JSON schema.
"""
schema = {}
schema: dict = {}
commands = {}
params = set() # NOTE(leogama): Currently unused due to some params having different help values
# TODO: Populate schema with relevant attributes
Expand Down

0 comments on commit 05fdd56

Please sign in to comment.