Fix linting issues

parent 6cfe0c0a
Pipeline #54900909 failed with stages
in 1 minute and 2 seconds
......@@ -24,7 +24,12 @@ class Cache():
if not os.path.exists(self.cache_dir):
os.mkdir(self.cache_dir)
def ensure_cache_entry(self, cache_path: str, provider: Callable[[], Response], mode: int) -> str:
def ensure_cache_entry(
self,
cache_path: str,
provider: Callable[[], Response],
mode: int
) -> str:
"""
Ensures that a given cache path exists and optionally invokes the `provider`
which returns an iterable object (i.e. a response from `requests`) and its content
......
......@@ -2,13 +2,11 @@
CLI Application parses `argv` and decides what to do.
"""
import argparse
from typing import List, Any, Dict
from typing import List
import sys
import os
from urllib.parse import urlparse
from hydra_cli.cache import Cache
from hydra_cli.commands.project import ProjectParser
from hydra_cli.api import transform_host_name
from hydra_cli.commands.project import ProjectParser
from hydra_cli.commands.reproduce_build import ReproduceBuildParser
......@@ -44,22 +42,22 @@ class Application():
reproduce_build = ReproduceBuildParser(self.cache)
reproduce_build_parser = reproduce_build.create_subcli(subparsers)
for x in [project_parser, reproduce_build_parser]:
x.add_argument(
for subcmd in [project_parser, reproduce_build_parser]:
subcmd.add_argument(
'-H',
'--host',
help='The host for Hydra',
default='https://hydra.nixos.org',
type=transform_host_name
)
x.add_argument(
subcmd.add_argument(
'-p',
'--plain',
help='Whether to use a plain table output easily parseable. Useful with scripts.',
default=False,
action='store_true'
)
x.add_argument(
subcmd.add_argument(
'-d',
'--dev',
help='Development mode: show full traces in case of errors thrown',
......
"""
CLI parser and handler for the `project` sub-command
"""
from typing import Dict, Any, List
from typing import List
from argparse import _SubParsersAction, ArgumentParser, Namespace
from hydra_cli.api import perform_api_call_json
from hydra_cli.tables import render_table
......@@ -14,7 +14,6 @@ class ProjectParser():
def __init__(self, project_choices: List[str]) -> None:
self.project_choices = project_choices
def create_subcli(self, subparse: _SubParsersAction) -> ArgumentParser:
project = subparse.add_parser('project')
project.add_argument(
......@@ -41,7 +40,6 @@ class ProjectParser():
return project
def run_command(self, argv: Namespace):
"""
Show available build projects from Hydra (mainly list projects or show details).
......
......@@ -8,6 +8,7 @@ from urllib.parse import urlparse
from hydra_cli.cache import Cache
from hydra_cli.api import perform_api_call
class ReproduceBuildParser():
"""
Helper class for the `reproduce-build` sub-command.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment