mirror of
https://github.com/thegeeklab/ansible-doctor.git
synced 2024-11-23 13:20:41 +00:00
refactor: rename modules to reflect pep8 recommendations (#27)
This commit is contained in:
parent
31fa79d8f7
commit
801498570e
@ -7,8 +7,8 @@ from collections import defaultdict
|
|||||||
|
|
||||||
import anyconfig
|
import anyconfig
|
||||||
|
|
||||||
from ansibledoctor.Config import SingleConfig
|
from ansibledoctor.config import SingleConfig
|
||||||
from ansibledoctor.Utils import SingleLog
|
from ansibledoctor.utils import SingleLog
|
||||||
|
|
||||||
|
|
||||||
class AnnotationItem:
|
class AnnotationItem:
|
@ -3,12 +3,12 @@
|
|||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
import ansibledoctor.Exception
|
import ansibledoctor.exception
|
||||||
from ansibledoctor import __version__
|
from ansibledoctor import __version__
|
||||||
from ansibledoctor.Config import SingleConfig
|
from ansibledoctor.config import SingleConfig
|
||||||
from ansibledoctor.DocumentationGenerator import Generator
|
from ansibledoctor.doc_generator import Generator
|
||||||
from ansibledoctor.DocumentationParser import Parser
|
from ansibledoctor.doc_parser import Parser
|
||||||
from ansibledoctor.Utils import SingleLog
|
from ansibledoctor.utils import SingleLog
|
||||||
|
|
||||||
|
|
||||||
class AnsibleDoctor:
|
class AnsibleDoctor:
|
||||||
@ -74,7 +74,7 @@ class AnsibleDoctor:
|
|||||||
def _get_config(self):
|
def _get_config(self):
|
||||||
try:
|
try:
|
||||||
config = SingleConfig(args=self.args)
|
config = SingleConfig(args=self.args)
|
||||||
except ansibledoctor.Exception.ConfigError as e:
|
except ansibledoctor.exception.ConfigError as e:
|
||||||
self.log.sysexit_with_message(e)
|
self.log.sysexit_with_message(e)
|
||||||
|
|
||||||
try:
|
try:
|
@ -10,8 +10,8 @@ import ruamel.yaml
|
|||||||
from appdirs import AppDirs
|
from appdirs import AppDirs
|
||||||
from jsonschema._utils import format_as_index
|
from jsonschema._utils import format_as_index
|
||||||
|
|
||||||
import ansibledoctor.Exception
|
import ansibledoctor.exception
|
||||||
from ansibledoctor.Utils import Singleton
|
from ansibledoctor.utils import Singleton
|
||||||
|
|
||||||
config_dir = AppDirs("ansible-doctor").user_config_dir
|
config_dir = AppDirs("ansible-doctor").user_config_dir
|
||||||
default_config_file = os.path.join(config_dir, "config.yml")
|
default_config_file = os.path.join(config_dir, "config.yml")
|
||||||
@ -185,7 +185,7 @@ class Config():
|
|||||||
if '"{}" not set'.format(envname) in str(e):
|
if '"{}" not set'.format(envname) in str(e):
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
raise ansibledoctor.Exception.ConfigError(
|
raise ansibledoctor.exception.ConfigError(
|
||||||
"Unable to read environment variable", str(e)
|
"Unable to read environment variable", str(e)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -223,7 +223,7 @@ class Config():
|
|||||||
ruamel.yaml.composer.ComposerError, ruamel.yaml.scanner.ScannerError
|
ruamel.yaml.composer.ComposerError, ruamel.yaml.scanner.ScannerError
|
||||||
) as e:
|
) as e:
|
||||||
message = "{} {}".format(e.context, e.problem)
|
message = "{} {}".format(e.context, e.problem)
|
||||||
raise ansibledoctor.Exception.ConfigError(
|
raise ansibledoctor.exception.ConfigError(
|
||||||
"Unable to read config file {}".format(config), message
|
"Unable to read config file {}".format(config), message
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -271,7 +271,7 @@ class Config():
|
|||||||
schema=format_as_index(list(e.relative_schema_path)[:-1]),
|
schema=format_as_index(list(e.relative_schema_path)[:-1]),
|
||||||
message=e.message
|
message=e.message
|
||||||
)
|
)
|
||||||
raise ansibledoctor.Exception.ConfigError("Configuration error", schema_error)
|
raise ansibledoctor.exception.ConfigError("Configuration error", schema_error)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
@ -12,10 +12,10 @@ from jinja2 import Environment
|
|||||||
from jinja2 import FileSystemLoader
|
from jinja2 import FileSystemLoader
|
||||||
from jinja2.filters import evalcontextfilter
|
from jinja2.filters import evalcontextfilter
|
||||||
|
|
||||||
import ansibledoctor.Exception
|
import ansibledoctor.exception
|
||||||
from ansibledoctor.Config import SingleConfig
|
from ansibledoctor.config import SingleConfig
|
||||||
from ansibledoctor.Utils import FileUtils
|
from ansibledoctor.utils import FileUtils
|
||||||
from ansibledoctor.Utils import SingleLog
|
from ansibledoctor.utils import SingleLog
|
||||||
|
|
||||||
|
|
||||||
class Generator:
|
class Generator:
|
||||||
@ -89,7 +89,7 @@ class Generator:
|
|||||||
try:
|
try:
|
||||||
if not FileUtils.query_yes_no("Do you want to continue?"):
|
if not FileUtils.query_yes_no("Do you want to continue?"):
|
||||||
self.log.sysexit_with_message("Aborted...")
|
self.log.sysexit_with_message("Aborted...")
|
||||||
except ansibledoctor.Exception.InputError as e:
|
except ansibledoctor.exception.InputError as e:
|
||||||
self.logger.debug(str(e))
|
self.logger.debug(str(e))
|
||||||
self.log.sysexit_with_message("Aborted...")
|
self.log.sysexit_with_message("Aborted...")
|
||||||
|
|
@ -8,12 +8,12 @@ import anyconfig
|
|||||||
import ruamel.yaml
|
import ruamel.yaml
|
||||||
from nested_lookup import nested_lookup
|
from nested_lookup import nested_lookup
|
||||||
|
|
||||||
from ansibledoctor.Annotation import Annotation
|
from ansibledoctor.annotation import Annotation
|
||||||
from ansibledoctor.Config import SingleConfig
|
from ansibledoctor.config import SingleConfig
|
||||||
from ansibledoctor.Contstants import YAML_EXTENSIONS
|
from ansibledoctor.contstants import YAML_EXTENSIONS
|
||||||
from ansibledoctor.FileRegistry import Registry
|
from ansibledoctor.file_registry import Registry
|
||||||
from ansibledoctor.Utils import SingleLog
|
from ansibledoctor.utils import SingleLog
|
||||||
from ansibledoctor.Utils import UnsafeTag
|
from ansibledoctor.utils import UnsafeTag
|
||||||
|
|
||||||
|
|
||||||
class Parser:
|
class Parser:
|
@ -6,9 +6,9 @@ import os
|
|||||||
|
|
||||||
import pathspec
|
import pathspec
|
||||||
|
|
||||||
from ansibledoctor.Config import SingleConfig
|
from ansibledoctor.config import SingleConfig
|
||||||
from ansibledoctor.Contstants import YAML_EXTENSIONS
|
from ansibledoctor.contstants import YAML_EXTENSIONS
|
||||||
from ansibledoctor.Utils import SingleLog
|
from ansibledoctor.utils import SingleLog
|
||||||
|
|
||||||
|
|
||||||
class Registry:
|
class Registry:
|
@ -9,7 +9,7 @@ from distutils.util import strtobool
|
|||||||
import colorama
|
import colorama
|
||||||
from pythonjsonlogger import jsonlogger
|
from pythonjsonlogger import jsonlogger
|
||||||
|
|
||||||
import ansibledoctor.Exception
|
import ansibledoctor.exception
|
||||||
|
|
||||||
CONSOLE_FORMAT = "{}{}[%(levelname)s]{} %(message)s"
|
CONSOLE_FORMAT = "{}{}[%(levelname)s]{} %(message)s"
|
||||||
JSON_FORMAT = "(asctime) (levelname) (message)"
|
JSON_FORMAT = "(asctime) (levelname) (message)"
|
||||||
@ -272,4 +272,4 @@ class FileUtils:
|
|||||||
choice = input("{} {} ".format(question, prompt)) or default # nosec
|
choice = input("{} {} ".format(question, prompt)) or default # nosec
|
||||||
return to_bool(choice)
|
return to_bool(choice)
|
||||||
except (KeyboardInterrupt, ValueError) as e:
|
except (KeyboardInterrupt, ValueError) as e:
|
||||||
raise ansibledoctor.Exception.InputError("Error while reading input", e)
|
raise ansibledoctor.exception.InputError("Error while reading input", e)
|
@ -68,7 +68,7 @@ pytest-mock = "^3.4.0"
|
|||||||
yapf = "^0.30.0"
|
yapf = "^0.30.0"
|
||||||
|
|
||||||
[tool.poetry.scripts]
|
[tool.poetry.scripts]
|
||||||
ansible-doctor = "ansibledoctor.Cli:main"
|
ansible-doctor = "ansibledoctor.cli:main"
|
||||||
|
|
||||||
[tool.poetry-dynamic-versioning]
|
[tool.poetry-dynamic-versioning]
|
||||||
enable = true
|
enable = true
|
||||||
|
Loading…
Reference in New Issue
Block a user