Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Apr 12, 2023
1 parent 8da6f7b commit f26313a
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 28 deletions.
1 change: 0 additions & 1 deletion pymock_api/_utils/importing.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def ensure_importing(import_callback: Callable, import_err_callback: Callable =

def _import(function) -> Callable:
def _(*args, **kwargs) -> None:

try:
import_callback()
except (ImportError, ModuleNotFoundError) as e:
Expand Down
14 changes: 0 additions & 14 deletions pymock_api/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ def __new__(cls, name: str, bases: Tuple[type], attrs: dict):


class CommandOption:

sub_cmd: SubCommandAttr = None
sub_parser: SubParserAttr = None
cli_option: str = None
Expand Down Expand Up @@ -209,14 +208,12 @@ def _dispatch_parser(self, parser: argparse.ArgumentParser) -> argparse.Argument

@dataclass
class SubCommand:

Base: str = "subcommand"
Run: str = "run"
Config: str = "config"


class BaseSubCommand(CommandOption):

sub_cmd: SubCommandAttr = SubCommandAttr(
title="Subcommands",
dest=SubCommand.Base,
Expand All @@ -226,7 +223,6 @@ class BaseSubCommand(CommandOption):


class SubCommandRunOption(BaseSubCommand):

sub_parser: SubParserAttr = SubParserAttr(
name=SubCommand.Run,
help="Set up APIs with configuration and run a web application to mock them.",
Expand All @@ -235,7 +231,6 @@ class SubCommandRunOption(BaseSubCommand):


class SubCommandConfigOption(BaseSubCommand):

sub_parser: SubParserAttr = SubParserAttr(
name=SubCommand.Config,
help="Something processing about configuration, i.e., generate a sample configuration or validate configuration"
Expand All @@ -249,7 +244,6 @@ class SubCommandConfigOption(BaseSubCommand):


class Version(CommandOption):

cli_option: str = "-v, --version"
name: str = "version"
help_description: str = "The version info of PyMock-API."
Expand All @@ -270,7 +264,6 @@ def add_option(self, parser: argparse.ArgumentParser) -> None:


class WebAppType(SubCommandRunOption):

cli_option: str = "--app-type"
name: str = "app_type"
help_description: str = "Which Python web framework it should use to set up web server for mocking APIs."
Expand All @@ -279,31 +272,27 @@ class WebAppType(SubCommandRunOption):


class Config(SubCommandRunOption):

cli_option: str = "-c, --config"
name: str = "config"
help_description: str = "The configuration of tool PyMock-API."
default_value: str = "api.yaml"


class Bind(SubCommandRunOption):

cli_option: str = "-b, --bind"
name: str = "bind"
help_description: str = "The socket to bind."
default_value: str = "127.0.0.1:9672"


class Workers(SubCommandRunOption):

cli_option: str = "-w, --workers"
name: str = "workers"
help_description: str = "The workers amount."
default_value: int = 1


class LegLevel(SubCommandRunOption):

cli_option: str = "--log-level"
name: str = "log_level"
help_description: str = "The log level."
Expand All @@ -312,7 +301,6 @@ class LegLevel(SubCommandRunOption):


class PrintSample(SubCommandConfigOption):

cli_option: str = "-p, --print-sample"
name: str = "print_sample"
help_description: str = "Print the sample configuration content."
Expand All @@ -322,7 +310,6 @@ class PrintSample(SubCommandConfigOption):


class GenerateSample(SubCommandConfigOption):

cli_option: str = "-g, --generate-sample"
name: str = "generate_sample"
help_description: str = "Create a sample configuration file."
Expand All @@ -332,7 +319,6 @@ class GenerateSample(SubCommandConfigOption):


class Output(SubCommandConfigOption):

cli_option: str = "-o, --output"
name: str = "file_path"
help_description: str = (
Expand Down
4 changes: 0 additions & 4 deletions pymock_api/cmd_ps.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def __new__(cls, name: str, bases: Tuple[type], attrs: dict):


class BaseCommandProcessor:

responsible_subcommand: str = None

def __init__(self):
Expand Down Expand Up @@ -109,7 +108,6 @@ def _parse_cmd_arguments(self, parser: ArgumentParser, cmd_args: Optional[List[s


class NoSubCmd(BaseCommandProcessor):

responsible_subcommand: str = None

def _parse_process(self, parser: ArgumentParser, cmd_args: Optional[List[str]] = None) -> ParserArguments:
Expand All @@ -120,7 +118,6 @@ def _run(self, args: ParserArguments) -> None:


class SubCmdRun(BaseCommandProcessor):

responsible_subcommand = SubCommand.Run

def __init__(self):
Expand Down Expand Up @@ -150,7 +147,6 @@ def _process_option(self, parser_options: SubcmdRunArguments) -> None:


class SubCmdConfig(BaseCommandProcessor):

responsible_subcommand = SubCommand.Config

def _parse_process(self, parser: ArgumentParser, cmd_args: Optional[List[str]] = None) -> SubcmdConfigArguments:
Expand Down
2 changes: 0 additions & 2 deletions pymock_api/model/cmd_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class ParserArguments:

@dataclass(frozen=True)
class SubcmdRunArguments(ParserArguments):

config: str = None
app_type: str = None
bind: str = None
Expand All @@ -21,7 +20,6 @@ class SubcmdRunArguments(ParserArguments):

@dataclass(frozen=True)
class SubcmdConfigArguments(ParserArguments):

generate_sample: bool = None
print_sample: bool = None
sample_output_path: str = ""
Expand Down
1 change: 0 additions & 1 deletion pymock_api/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,4 @@ def run() -> None:


if __name__ == "__main__":

run()
1 change: 0 additions & 1 deletion test/integration_test/_utils/file_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@


class TestYAML:

_Test_File: str = "pytest-yaml-write.yaml"

@pytest.fixture(scope="function")
Expand Down
5 changes: 0 additions & 5 deletions test/integration_test/run_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@


class CommandTestSpec(metaclass=ABCMeta):

Server_Running_Entry_Point: str = "pymock_api/runner.py"
Terminate_Command_Running_When_Sniff_IP_Info: bool = True

Expand Down Expand Up @@ -79,7 +78,6 @@ def _should_contains_chars_in_result(cls, target: str, expected_char, translate:


class TestSubCommandRun(CommandTestSpec):

Terminate_Command_Running_When_Sniff_IP_Info: bool = False

@property
Expand All @@ -97,7 +95,6 @@ def _verify_running_output(self, cmd_running_result: str) -> None:


class TestSubCommandConfig(CommandTestSpec):

Terminate_Command_Running_When_Sniff_IP_Info: bool = False

@property
Expand All @@ -112,7 +109,6 @@ def _verify_running_output(self, cmd_running_result: str) -> None:


class TestShowSampleConfiguration(CommandTestSpec):

Terminate_Command_Running_When_Sniff_IP_Info: bool = False

@property
Expand All @@ -129,7 +125,6 @@ def _verify_running_output(self, cmd_running_result: str) -> None:


class TestGenerateSampleConfiguration(CommandTestSpec):

Terminate_Command_Running_When_Sniff_IP_Info: bool = False
_Default_Path: str = "sample-api.yaml"
_Under_Test_Path: str = None
Expand Down

0 comments on commit f26313a

Please sign in to comment.