chore: drop yapf and favor of the ruff formatter (#716)

This commit is contained in:
Robert Kaussow 2023-11-10 14:50:48 +01:00 committed by GitHub
parent 511728afdf
commit 8266f92b47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
48 changed files with 160 additions and 279 deletions

View File

@ -12,7 +12,7 @@ steps:
- git fetch --depth=2147483647
- pip install poetry poetry-dynamic-versioning -qq
- poetry install
- poetry run yapf -dr ./${CI_REPO_NAME//-/}
- poetry run ruff format --check --diff ./${CI_REPO_NAME//-/}
environment:
PY_COLORS: "1"

View File

@ -25,14 +25,14 @@ def main():
dest="rules.standards",
metavar="RULES",
action="append",
help="directory of standard rules"
help="directory of standard rules",
)
parser.add_argument(
"-B",
"--no-buildin",
dest="rules.buildin",
action="store_false",
help="disables build-in standard rules"
help="disables build-in standard rules",
)
parser.add_argument(
"-s",
@ -40,7 +40,7 @@ def main():
dest="rules.filter",
metavar="FILTER",
action="append",
help="limit standards to given ID's"
help="limit standards to given ID's",
)
parser.add_argument(
"-x",
@ -48,7 +48,7 @@ def main():
dest="rules.exclude_filter",
metavar="EXCLUDE_FILTER",
action="append",
help="exclude standards by given ID's"
help="exclude standards by given ID's",
)
parser.add_argument(
"-v", dest="logging.level", action="append_const", const=-1, help="increase log level"
@ -85,7 +85,7 @@ def main():
else:
LOG.info(f"Couldn't classify file {filename}")
errors = (sum(p.map(_review_wrapper, tasks)))
errors = sum(p.map(_review_wrapper, tasks))
p.close()
p.join()

View File

@ -107,7 +107,7 @@ class Candidate:
"tag": "review",
"standard": standard.description,
"file": self.path,
"passed": True
"passed": True,
}
if standard.sid and standard.sid.strip():
@ -127,12 +127,12 @@ class Candidate:
if not standard.version:
LOG.warning(
f"{sid}Best practice '{description}' not met:\n{path}:{err}",
extra=flag_extra(err_labels)
extra=flag_extra(err_labels),
)
elif Version(standard.version) > Version(self.version):
LOG.warning(
f"{sid}Future standard '{description}' not met:\n{path}:{err}",
extra=flag_extra(err_labels)
extra=flag_extra(err_labels),
)
else:
msg = f"{sid}Standard '{description}' not met:\n{path}:{err}"
@ -165,14 +165,16 @@ class Candidate:
return Meta(filename, settings, standards)
if parentdir in ["meta"] and "argument_specs" in basename:
return ArgumentSpecs(filename, settings, standards)
if (
parentdir in ["library", "lookup_plugins", "callback_plugins", "filter_plugins"]
or filename.endswith(".py")
):
if parentdir in [
"library",
"lookup_plugins",
"callback_plugins",
"filter_plugins",
] or filename.endswith(".py"):
return Code(filename, settings, standards)
if basename == "inventory" or basename == "hosts" or parentdir in ["inventories"]:
return Inventory(filename, settings, standards)
if ("rolesfile" in basename or ("requirements" in basename and ext in ["yaml", "yml"])):
if "rolesfile" in basename or ("requirements" in basename and ext in ["yaml", "yml"]):
return Rolesfile(filename, settings, standards)
if "Makefile" in basename:
return Makefile(filename, settings, standards)

View File

@ -26,7 +26,7 @@ def strtobool(value):
"f": False,
"false": False,
"off": False,
"0": False
"0": False,
}
try:
@ -40,7 +40,6 @@ def to_bool(string):
def _should_do_markup():
py_colors = os.environ.get("PY_COLORS", None)
if py_colors is not None:
return to_bool(py_colors)

View File

@ -2,7 +2,6 @@ from ansiblelater.standard import StandardBase
class CheckBecomeUser(StandardBase):
sid = "ANSIBLE0015"
description = "Become should be combined with become_user"
helptext = "the task has `become` enabled but `become_user` is missing"

View File

@ -5,7 +5,6 @@ from ansiblelater.utils import count_spaces
class CheckBracesSpaces(StandardBase):
sid = "ANSIBLE0004"
description = "YAML should use consistent number of spaces around variables"
helptext = "no suitable numbers of spaces (min: {min} max: {max})"
@ -41,7 +40,7 @@ class CheckBracesSpaces(StandardBase):
i,
self.helptext.format(
min=conf["min-spaces-inside"], max=conf["max-spaces-inside"]
)
),
)
)
return self.Result(candidate.path, errors)

View File

@ -22,7 +22,6 @@ from ansiblelater.standard import StandardBase
class CheckChangedInWhen(StandardBase):
sid = "ANSIBLE0026"
description = "Use handlers instead of `when: changed`"
helptext = "tasks using `when: result.changed` setting are effectively acting as a handler"
@ -58,7 +57,8 @@ class CheckChangedInWhen(StandardBase):
return False
return any(
changed in item for changed in [
changed in item
for changed in [
".changed",
"|changed",
'["changed"]',

View File

@ -2,7 +2,6 @@ from ansiblelater.standard import StandardBase
class CheckCommandHasChanges(StandardBase):
sid = "ANSIBLE0011"
description = "Commands should be idempotent"
helptext = (
@ -19,9 +18,11 @@ class CheckCommandHasChanges(StandardBase):
if not errors:
for task in tasks:
if task["action"]["__ansible_module__"] in commands and (
"changed_when" not in task and "when" not in task
"changed_when" not in task
and "when" not in task
and "when" not in task.get("__ansible_action_meta__", [])
and "creates" not in task["action"] and "removes" not in task["action"]
and "creates" not in task["action"]
and "removes" not in task["action"]
):
errors.append(self.Error(task["__line__"], self.helptext))

View File

@ -24,7 +24,6 @@ from ansiblelater.standard import StandardBase
class CheckCommandInsteadOfArgument(StandardBase):
sid = "ANSIBLE0017"
description = "Commands should not be used in place of module arguments"
helptext = "{exec} used in place of file modules argument {arg}"
@ -41,7 +40,7 @@ class CheckCommandInsteadOfArgument(StandardBase):
"ln": "state=link",
"mkdir": "state=directory",
"rmdir": "state=absent",
"rm": "state=absent"
"rm": "state=absent",
}
if not errors:
@ -51,13 +50,14 @@ class CheckCommandInsteadOfArgument(StandardBase):
executable = os.path.basename(first_cmd_arg)
if (
first_cmd_arg and executable in arguments
first_cmd_arg
and executable in arguments
and task["action"].get("warn", True)
):
errors.append(
self.Error(
task["__line__"],
self.helptext.format(exec=executable, arg=arguments[executable])
self.helptext.format(exec=executable, arg=arguments[executable]),
)
)

View File

@ -4,7 +4,6 @@ from ansiblelater.standard import StandardBase
class CheckCommandInsteadOfModule(StandardBase):
sid = "ANSIBLE0008"
description = "Commands should not be used in place of modules"
helptext = "{exec} command used in place of {module} module"
@ -31,7 +30,7 @@ class CheckCommandInsteadOfModule(StandardBase):
"rsync": "synchronize",
"supervisorctl": "supervisorctl",
"systemctl": "systemd",
"sed": "template or lineinfile"
"sed": "template or lineinfile",
}
if not errors:
@ -42,14 +41,16 @@ class CheckCommandInsteadOfModule(StandardBase):
cmd = cmd = self.get_safe_cmd(task)
if (
first_cmd_arg and executable in modules
and task["action"].get("warn", True) and "register" not in task
first_cmd_arg
and executable in modules
and task["action"].get("warn", True)
and "register" not in task
and not any(ch in cmd for ch in self.SHELL_PIPE_CHARS)
):
errors.append(
self.Error(
task["__line__"],
self.helptext.format(exec=executable, module=modules[executable])
self.helptext.format(exec=executable, module=modules[executable]),
)
)

View File

@ -5,10 +5,9 @@ from ansiblelater.standard import StandardBase
class CheckCompareToEmptyString(StandardBase):
sid = "ANSIBLE0012"
description = "Don't compare to empty string \"\""
helptext = ("use `when: var` rather than `when: var !=` (or conversely `when: not var`)")
description = 'Don\'t compare to empty string ""'
helptext = "use `when: var` rather than `when: var !=` (or conversely `when: not var`)"
version = "0.1"
types = ["playbook", "task", "handler", "template"]

View File

@ -5,10 +5,9 @@ from ansiblelater.standard import StandardBase
class CheckCompareToLiteralBool(StandardBase):
sid = "ANSIBLE0013"
description = "Don't compare to True or False"
helptext = ("use `when: var` rather than `when: var == True` (or conversely `when: not var`)")
helptext = "use `when: var` rather than `when: var == True` (or conversely `when: not var`)"
version = "0.1"
types = ["playbook", "task", "handler"]

View File

@ -2,7 +2,6 @@ from ansiblelater.standard import StandardBase
class CheckDeprecated(StandardBase):
sid = "ANSIBLE9999"
description = "Deprecated features should not be used"
helptext = "'{old}' is deprecated and should not be used anymore. Use '{new}' instead."
@ -20,7 +19,7 @@ class CheckDeprecated(StandardBase):
task["__line__"],
self.helptext.format(
old="skip_ansible_lint", new="skip_ansible_later"
)
),
)
)
return self.Result(candidate.path, errors)

View File

@ -25,7 +25,6 @@ from ansiblelater.utils import has_glob, has_jinja
class CheckDeprecatedBareVars(StandardBase):
sid = "ANSIBLE0027"
description = "Deprecated bare variables in loops must not be used"
helptext = (
@ -84,6 +83,6 @@ class CheckDeprecatedBareVars(StandardBase):
self.errors.append(
self.Error(
task["__line__"],
self.helptext.format(barevar=varstring, loop_type=loop_type)
self.helptext.format(barevar=varstring, loop_type=loop_type),
)
)

View File

@ -23,7 +23,6 @@ from ansiblelater.standard import StandardBase
class CheckFilePermissionMissing(StandardBase):
sid = "ANSIBLE0018"
description = "File permissions unset or incorrect"
helptext = (
@ -67,8 +66,7 @@ class CheckFilePermissionMissing(StandardBase):
mode = task["action"].get("mode", None)
state = task["action"].get("state", "file")
if module not in self._modules and \
module not in self._create_modules:
if module not in self._modules and module not in self._create_modules:
return False
if mode == "preserve" and module not in self._preserve_modules:

View File

@ -22,7 +22,6 @@ from ansiblelater.standard import StandardBase
class CheckFilePermissionOctal(StandardBase):
sid = "ANSIBLE0019"
description = "Octal file permissions must contain leading zero or be a string"
helptext = "numeric file permissions without leading zero can behave in unexpected ways"
@ -32,8 +31,15 @@ class CheckFilePermissionOctal(StandardBase):
def check(self, candidate, settings):
tasks, errors = self.get_normalized_tasks(candidate, settings)
modules = [
"assemble", "copy", "file", "ini_file", "lineinfile", "replace", "synchronize",
"template", "unarchive"
"assemble",
"copy",
"file",
"ini_file",
"lineinfile",
"replace",
"synchronize",
"template",
"unarchive",
]
if not errors:
@ -48,20 +54,24 @@ class CheckFilePermissionOctal(StandardBase):
@staticmethod
def _is_invalid_permission(mode):
other_write_without_read = (
mode % 8 and mode % 8 < 4 and not (mode % 8 == 1 and (mode >> 6) % 2 == 1)
)
group_write_without_read = ((mode >> 3) % 8 and (mode >> 3) % 8 < 4
and not ((mode >> 3) % 8 == 1 and (mode >> 6) % 2 == 1))
user_write_without_read = ((mode >> 6) % 8 and (mode >> 6) % 8 < 4
and (mode >> 6) % 8 != 1)
group_write_without_read = (
(mode >> 3) % 8
and (mode >> 3) % 8 < 4
and not ((mode >> 3) % 8 == 1 and (mode >> 6) % 2 == 1)
)
user_write_without_read = (mode >> 6) % 8 and (mode >> 6) % 8 < 4 and (mode >> 6) % 8 != 1
other_more_generous_than_group = mode % 8 > (mode >> 3) % 8
other_more_generous_than_user = mode % 8 > (mode >> 6) % 8
group_more_generous_than_user = (mode >> 3) % 8 > (mode >> 6) % 8
return bool(
other_write_without_read or group_write_without_read or user_write_without_read
or other_more_generous_than_group or other_more_generous_than_user
other_write_without_read
or group_write_without_read
or user_write_without_read
or other_more_generous_than_group
or other_more_generous_than_user
or group_more_generous_than_user
)

View File

@ -4,7 +4,6 @@ from ansiblelater.standard import StandardBase
class CheckFilterSeparation(StandardBase):
sid = "ANSIBLE0016"
description = "Jinja2 filters should be separated with spaces"
helptext = "no suitable numbers of spaces (required: 1)"

View File

@ -22,7 +22,6 @@ from ansiblelater.standard import StandardBase
class CheckGitHasVersion(StandardBase):
sid = "ANSIBLE0020"
description = "Git checkouts should use explicit version"
helptext = "git checkouts should point to an explicit commit or tag, not `latest`"

View File

@ -2,7 +2,6 @@ from ansiblelater.standard import StandardBase
class CheckInstallUseLatest(StandardBase):
sid = "ANSIBLE0009"
description = "Package installs should use present, not latest"
helptext = "package installs should use `state=present` with or without a version"
@ -12,10 +11,32 @@ class CheckInstallUseLatest(StandardBase):
def check(self, candidate, settings):
tasks, errors = self.get_normalized_tasks(candidate, settings)
package_managers = [
"yum", "apt", "dnf", "homebrew", "pacman", "openbsd_package", "pkg5", "portage",
"pkgutil", "slackpkg", "swdepot", "zypper", "bundler", "pip", "pear", "npm", "yarn",
"gem", "easy_install", "bower", "package", "apk", "openbsd_pkg", "pkgng", "sorcery",
"xbps"
"yum",
"apt",
"dnf",
"homebrew",
"pacman",
"openbsd_package",
"pkg5",
"portage",
"pkgutil",
"slackpkg",
"swdepot",
"zypper",
"bundler",
"pip",
"pear",
"npm",
"yarn",
"gem",
"easy_install",
"bower",
"package",
"apk",
"openbsd_pkg",
"pkgng",
"sorcery",
"xbps",
]
if not errors:

View File

@ -4,7 +4,6 @@ from ansiblelater.standard import StandardBase
class CheckLiteralBoolFormat(StandardBase):
sid = "ANSIBLE0014"
description = "Literal bools should be consistent"
helptext = "literal bools should be written as `{bools}`"

View File

@ -4,10 +4,9 @@ from ansiblelater.standard import StandardBase
class CheckLocalAction(StandardBase):
sid = "ANSIBLE0024"
description = "Don't use local_action"
helptext = ("`delegate_to: localhost` should be used instead of `local_action`")
helptext = "`delegate_to: localhost` should be used instead of `local_action`"
version = "0.2"
types = ["playbook", "task", "handler"]

View File

@ -5,7 +5,6 @@ from ansiblelater.standard import StandardBase
class CheckMetaChangeFromDefault(StandardBase):
sid = "ANSIBLE0021"
description = "Roles meta/main.yml default values should be changed"
helptext = "meta/main.yml default values should be changed for: `{field}`"

View File

@ -4,7 +4,6 @@ from ansiblelater.standard import StandardBase
class CheckMetaMain(StandardBase):
sid = "ANSIBLE0002"
description = "Roles must contain suitable meta/main.yml"
helptext = "file should contain `{key}` key"
@ -16,8 +15,8 @@ class CheckMetaMain(StandardBase):
keys = ["author", "description", "min_ansible_version", "platforms"]
if not errors:
has_galaxy_info = (isinstance(content, dict) and "galaxy_info" in content)
has_dependencies = (isinstance(content, dict) and "dependencies" in content)
has_galaxy_info = isinstance(content, dict) and "galaxy_info" in content
has_dependencies = isinstance(content, dict) and "dependencies" in content
if not has_galaxy_info:
errors.append(self.Error(None, self.helptext.format(key="galaxy_info")))

View File

@ -4,7 +4,6 @@ from ansiblelater.standard import StandardBase
class CheckNameFormat(StandardBase):
sid = "ANSIBLE0007"
description = "Name of tasks and handlers must be formatted"
helptext = "name '{name}' should start with uppercase"
@ -19,7 +18,7 @@ class CheckNameFormat(StandardBase):
for task in tasks:
if "name" in task:
namelines[task["name"]].append(task["__line__"])
for (name, lines) in namelines.items():
for name, lines in namelines.items():
if name and not name[0].isupper():
errors.append(self.Error(lines[-1], self.helptext.format(name=name)))

View File

@ -2,7 +2,6 @@ from ansiblelater.standard import StandardBase
class CheckNamedTask(StandardBase):
sid = "ANSIBLE0006"
description = "Tasks and handlers must be named"
helptext = "module '{module}' used without or empty `name` attribute"

View File

@ -2,7 +2,6 @@ from ansiblelater.standard import StandardBase
class CheckNativeYaml(StandardBase):
sid = "LINT0008"
description = "Use YAML format for tasks and handlers rather than key=value"
helptext = "task arguments appear to be in key value rather than YAML format"

View File

@ -25,7 +25,6 @@ from ansiblelater.standard import StandardBase
class CheckNestedJinja(StandardBase):
sid = "ANSIBLE0023"
description = "Don't use nested Jinja2 pattern"
helptext = (

View File

@ -4,7 +4,6 @@ from ansiblelater.standard import StandardBase
class CheckRelativeRolePaths(StandardBase):
sid = "ANSIBLE0025"
description = "Don't use a relative path in a role"
helptext = "`copy` and `template` modules don't need relative path for `src`"

View File

@ -4,7 +4,6 @@ from ansiblelater.standard import StandardBase
class CheckScmInSrc(StandardBase):
sid = "ANSIBLE0005"
description = "Use `scm:` key rather than `src: scm+url`"
helptext = "usage of `src: scm+url` not recommended"
@ -17,7 +16,8 @@ class CheckScmInSrc(StandardBase):
if not errors:
for role in roles:
if (
isinstance(role, AnsibleMapping) and bool(role.get("src"))
isinstance(role, AnsibleMapping)
and bool(role.get("src"))
and "+" in role.get("src")
):
errors.append(self.Error(role["__line__"], self.helptext))

View File

@ -2,7 +2,6 @@ from ansiblelater.standard import StandardBase
class CheckShellInsteadCommand(StandardBase):
sid = "ANSIBLE0010"
description = "Shell should only be used when essential"
helptext = "shell should only be used when piping, redirecting or chaining commands"

View File

@ -5,7 +5,6 @@ from ansiblelater.standard import StandardBase
class CheckTaskSeparation(StandardBase):
sid = "ANSIBLE0001"
description = "Single tasks should be separated by empty line"
helptext = "missing task separation (required: 1 empty line)"

View File

@ -4,7 +4,6 @@ from ansiblelater.standard import StandardBase
class CheckUniqueNamedTask(StandardBase):
sid = "ANSIBLE0003"
description = "Tasks and handlers must be uniquely named within a single file"
helptext = "name '{name}' appears multiple times"
@ -20,7 +19,7 @@ class CheckUniqueNamedTask(StandardBase):
for task in tasks:
if "name" in task:
namelines[task["name"]].append(task["__line__"])
for (name, lines) in namelines.items():
for name, lines in namelines.items():
if name and len(lines) > 1:
errors.append(self.Error(lines[-1], self.helptext.format(name=name)))

View File

@ -2,7 +2,6 @@ from ansiblelater.standard import StandardBase
class CheckVersion(StandardBase):
sid = "ANSIBLE9998"
description = "Standards version should be pinned"
helptext = "Standards version not set. Using latest standards version {version}"

View File

@ -2,12 +2,10 @@ from ansiblelater.standard import StandardBase
class CheckWhenFormat(StandardBase):
sid = "ANSIBLE0022"
description = "Don't use Jinja2 in when"
helptext = (
"`when` is a raw Jinja2 expression, redundant {{ }} "
"should be removed from variable(s)"
"`when` is a raw Jinja2 expression, redundant {{ }} " "should be removed from variable(s)"
)
version = "0.2"
types = ["playbook", "task", "handler"]

View File

@ -2,7 +2,6 @@ from ansiblelater.standard import StandardBase
class CheckYamlColons(StandardBase):
sid = "LINT0005"
description = "YAML should use consistent number of spaces around colons"
version = "0.1"

View File

@ -2,7 +2,6 @@ from ansiblelater.standard import StandardBase
class CheckYamlDocumentEnd(StandardBase):
sid = "LINT0009"
description = "YAML should contain document end marker"
version = "0.1"

View File

@ -2,7 +2,6 @@ from ansiblelater.standard import StandardBase
class CheckYamlDocumentStart(StandardBase):
sid = "LINT0004"
description = "YAML should contain document start marker"
version = "0.1"

View File

@ -2,7 +2,6 @@ from ansiblelater.standard import StandardBase
class CheckYamlEmptyLines(StandardBase):
sid = "LINT0001"
description = "YAML should not contain unnecessarily empty lines"
version = "0.1"

View File

@ -4,7 +4,6 @@ from ansiblelater.standard import StandardBase
class CheckYamlFile(StandardBase):
sid = "LINT0006"
description = "Roles file should be in yaml format"
helptext = "file does not have a .yml extension"

View File

@ -2,7 +2,6 @@ from ansiblelater.standard import StandardBase
class CheckYamlHasContent(StandardBase):
sid = "LINT0007"
description = "Files should contain useful content"
helptext = "the file appears to have no useful content"

View File

@ -2,7 +2,6 @@ from ansiblelater.standard import StandardBase
class CheckYamlHyphens(StandardBase):
sid = "LINT0003"
description = "YAML should use consistent number of spaces after hyphens"
version = "0.1"

View File

@ -2,7 +2,6 @@ from ansiblelater.standard import StandardBase
class CheckYamlIndent(StandardBase):
sid = "LINT0002"
description = "YAML should not contain unnecessarily empty lines"
version = "0.1"

View File

@ -128,11 +128,11 @@ class Settings:
],
"ignore_dotfiles": True,
"exclude_files": [],
"version": ""
"version": "",
},
"logging": {
"level": "WARNING",
"json": False
"json": False,
},
"ansible": {
"custom_modules": [],
@ -169,17 +169,17 @@ class Settings:
"indent-sequences": True,
},
"hyphens": {
"max-spaces-after": 1
"max-spaces-after": 1,
},
"document-start": {
"present": True
"present": True,
},
"document-end": {
"present": True
"present": True,
},
"colons": {
"max-spaces-before": 0,
"max-spaces-after": 1
"max-spaces-after": 1,
},
},
}

View File

@ -28,7 +28,6 @@ from ansiblelater.utils.yamlhelper import (
class StandardMeta(type):
def __call__(cls, *args):
mcls = type.__call__(cls, *args)
mcls.sid = cls.sid
@ -44,7 +43,6 @@ class StandardExtendedMeta(StandardMeta, ABCMeta):
class StandardBase(metaclass=StandardExtendedMeta):
SHELL_PIPE_CHARS = "&|<>;$\n*[]{}?"
@property
@ -279,7 +277,7 @@ class StandardBase(metaclass=StandardExtendedMeta):
self.lineno = lineno
self.message = message
self.kwargs = kwargs
for (key, value) in kwargs.items():
for key, value in kwargs.items():
setattr(self, key, value)
def __repr__(self):
@ -289,7 +287,7 @@ class StandardBase(metaclass=StandardExtendedMeta):
def to_dict(self):
result = {"lineno": self.lineno, "message": self.message}
for (key, value) in self.kwargs.items():
for key, value in self.kwargs.items():
result[key] = value
return result
@ -305,7 +303,6 @@ class StandardBase(metaclass=StandardExtendedMeta):
class StandardLoader:
def __init__(self, source):
self.rules = []
@ -333,12 +330,15 @@ class StandardLoader:
self.validate()
def _is_plugin(self, obj):
return inspect.isclass(obj) and issubclass(
obj, StandardBase
) and obj is not StandardBase and not None
return (
inspect.isclass(obj)
and issubclass(obj, StandardBase)
and obj is not StandardBase
and not None
)
def validate(self):
normalized_std = (list(toolz.remove(lambda x: x.sid == "", self.rules)))
normalized_std = list(toolz.remove(lambda x: x.sid == "", self.rules))
unique_std = len(list(toolz.unique(normalized_std, key=lambda x: x.sid)))
all_std = len(normalized_std)
if all_std != unique_std:

View File

@ -32,12 +32,13 @@ def count_spaces(c_string):
break
trailing_spaces += 1
return ((leading_spaces, trailing_spaces))
return (leading_spaces, trailing_spaces)
def standards_latest(standards):
return max([standard.version for standard in standards if standard.version] or ["0.1"],
key=Version)
return max(
[standard.version for standard in standards if standard.version] or ["0.1"], key=Version
)
def lines_ranges(lines_spec):
@ -82,11 +83,11 @@ def open_file(filename, mode="r"):
def add_dict_branch(tree, vector, value):
key = vector[0]
tree[key] = value \
if len(vector) == 1 \
else add_dict_branch(tree[key] if key in tree else {},
vector[1:],
value)
tree[key] = (
value
if len(vector) == 1
else add_dict_branch(tree[key] if key in tree else {}, vector[1:], value)
)
return tree

View File

@ -68,6 +68,7 @@ try:
from ansible.plugins import module_loader
except ImportError:
from ansible.plugins.loader import init_plugin_loader, module_loader
init_plugin_loader()
LINE_NUMBER_KEY = "__line__"
@ -190,8 +191,10 @@ def template(basedir, value, variables, fail_on_undefined=False, **kwargs):
# I guess the filter doesn't like empty vars...
with suppress(AnsibleError, ValueError):
return ansible_template(
os.path.abspath(basedir), value, variables,
**dict(kwargs, fail_on_undefined=fail_on_undefined)
os.path.abspath(basedir),
value,
variables,
**dict(kwargs, fail_on_undefined=fail_on_undefined),
)
@ -214,8 +217,9 @@ def play_children(basedir, item, parent_type):
if k in delegate_map and v:
v = template(
os.path.abspath(basedir),
v, {"playbook_dir": os.path.abspath(basedir)},
fail_on_undefined=False
v,
{"playbook_dir": os.path.abspath(basedir)},
fail_on_undefined=False,
)
return delegate_map[k](basedir, k, v, parent_type)
return []
@ -246,18 +250,20 @@ def _taskshandlers_children(basedir, k, v, parent_type):
results.extend(
_roles_children(
basedir,
k, [th["import_role"].get("name")],
k,
[th["import_role"].get("name")],
parent_type,
main=th["import_role"].get("tasks_from", "main")
main=th["import_role"].get("tasks_from", "main"),
)
)
elif "include_role" in th:
results.extend(
_roles_children(
basedir,
k, [th["include_role"].get("name")],
k,
[th["include_role"].get("name")],
parent_type,
main=th["include_role"].get("tasks_from", "main")
main=th["include_role"].get("tasks_from", "main"),
)
)
elif "block" in th:
@ -309,7 +315,7 @@ def _rolepath(basedir, role):
path_dwim(basedir, role),
# if included from roles/[role]/meta/main.yml
path_dwim(basedir, os.path.join("..", "..", "..", "roles", role)),
path_dwim(basedir, os.path.join("..", "..", role))
path_dwim(basedir, os.path.join("..", "..", role)),
]
if constants.DEFAULT_ROLES_PATH:
@ -351,13 +357,13 @@ def rolename(filepath):
idx = filepath.find("roles/")
if idx < 0:
return ""
role = filepath[idx + 6:]
return role[:role.find("/")]
role = filepath[idx + 6 :]
return role[: role.find("/")]
def _kv_to_dict(v):
(command, args, kwargs) = tokenize(v)
return (dict(__ansible_module__=command, __ansible_arguments__=args, **kwargs))
return dict(__ansible_module__=command, __ansible_arguments__=args, **kwargs)
def normalize_task(task, filename, custom_modules=None):
@ -368,7 +374,7 @@ def normalize_task(task, filename, custom_modules=None):
ansible_action_type = task.get("__ansible_action_type__", "task")
if "__ansible_action_type__" in task:
del (task["__ansible_action_type__"])
del task["__ansible_action_type__"]
# temp. extract metadata
ansible_meta = {}
@ -395,9 +401,9 @@ def normalize_task(task, filename, custom_modules=None):
# denormalize shell -> command conversion
if "_uses_shell" in arguments:
action = "shell"
del (arguments["_uses_shell"])
del arguments["_uses_shell"]
for (k, v) in list(task.items()):
for k, v in list(task.items()):
if k in ("action", "local_action", "args", "delegate_to") or k == action:
# we don"t want to re-assign these values, which were
# determined by the ModuleArgsParser() above
@ -409,7 +415,7 @@ def normalize_task(task, filename, custom_modules=None):
if "_raw_params" in arguments:
normalized["action"]["__ansible_arguments__"] = arguments["_raw_params"].strip().split()
del (arguments["_raw_params"])
del arguments["_raw_params"]
else:
normalized["action"]["__ansible_arguments__"] = []
normalized["action"].update(arguments)
@ -418,7 +424,7 @@ def normalize_task(task, filename, custom_modules=None):
normalized["__ansible_action_type__"] = ansible_action_type
# add back extracted metadata
for (k, v) in ansible_meta.items():
for k, v in ansible_meta.items():
if v:
normalized[k] = v
@ -448,10 +454,14 @@ def task_to_str(task):
if name:
return name
action = task.get("action")
args = " ".join([
f"{k}={v}" for (k, v) in action.items()
args = " ".join(
[
f"{k}={v}"
for (k, v) in action.items()
if k not in ["__ansible_module__", "__ansible_arguments__"]
] + action.get("__ansible_arguments__"))
]
+ action.get("__ansible_arguments__")
)
return "{} {}".format(action["__ansible_module__"], args)
@ -523,7 +533,7 @@ def parse_yaml_linenumbers(data, filename):
yaml.constructor.ConstructorError,
) as e:
raise LaterError("syntax error", e) from e
except (yaml.composer.ComposerError) as e:
except yaml.composer.ComposerError as e:
e.problem = f"{e.context} {e.problem}"
raise LaterError("syntax error", e) from e
return data

130
poetry.lock generated
View File

@ -1,10 +1,9 @@
# This file is automatically @generated by Poetry 1.4.2 and should not be changed by hand.
# This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand.
[[package]]
name = "ansible"
version = "8.6.1"
description = "Radically simple IT automation"
category = "main"
optional = true
python-versions = ">=3.9"
files = [
@ -19,7 +18,6 @@ ansible-core = ">=2.15.6,<2.16.0"
name = "ansible-core"
version = "2.15.6"
description = "Radically simple IT automation"
category = "main"
optional = true
python-versions = ">=3.9"
files = [
@ -39,7 +37,6 @@ resolvelib = ">=0.5.3,<1.1.0"
name = "anyconfig"
version = "0.13.0"
description = "Library provides common APIs to load and dump configuration files in various formats"
category = "main"
optional = false
python-versions = "*"
files = [
@ -61,7 +58,6 @@ yaml = ["pyyaml"]
name = "appdirs"
version = "1.4.4"
description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"."
category = "main"
optional = false
python-versions = "*"
files = [
@ -73,7 +69,6 @@ files = [
name = "attrs"
version = "23.1.0"
description = "Classes Without Boilerplate"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@ -92,7 +87,6 @@ tests-no-zope = ["cloudpickle", "hypothesis", "mypy (>=1.1.1)", "pympler", "pyte
name = "cffi"
version = "1.16.0"
description = "Foreign Function Interface for Python calling C code."
category = "main"
optional = true
python-versions = ">=3.8"
files = [
@ -157,7 +151,6 @@ pycparser = "*"
name = "colorama"
version = "0.4.6"
description = "Cross-platform colored terminal text."
category = "main"
optional = false
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
files = [
@ -169,7 +162,6 @@ files = [
name = "coverage"
version = "7.3.2"
description = "Code coverage measurement for Python"
category = "dev"
optional = false
python-versions = ">=3.8"
files = [
@ -237,7 +229,6 @@ toml = ["tomli"]
name = "cryptography"
version = "41.0.5"
description = "cryptography is a package which provides cryptographic recipes and primitives to Python developers."
category = "main"
optional = true
python-versions = ">=3.7"
files = [
@ -283,7 +274,6 @@ test-randomorder = ["pytest-randomly"]
name = "exceptiongroup"
version = "1.1.3"
description = "Backport of PEP 654 (exception groups)"
category = "dev"
optional = false
python-versions = ">=3.7"
files = [
@ -294,31 +284,10 @@ files = [
[package.extras]
test = ["pytest (>=6)"]
[[package]]
name = "importlib-metadata"
version = "6.8.0"
description = "Read metadata from Python packages"
category = "dev"
optional = false
python-versions = ">=3.8"
files = [
{file = "importlib_metadata-6.8.0-py3-none-any.whl", hash = "sha256:3ebb78df84a805d7698245025b975d9d67053cd94c79245ba4b3eb694abe68bb"},
{file = "importlib_metadata-6.8.0.tar.gz", hash = "sha256:dbace7892d8c0c4ac1ad096662232f831d4e64f4c4545bd53016a3e9d4654743"},
]
[package.dependencies]
zipp = ">=0.5"
[package.extras]
docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"]
perf = ["ipython"]
testing = ["flufl.flake8", "importlib-resources (>=1.3)", "packaging", "pyfakefs", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy (>=0.9.1)", "pytest-perf (>=0.9.2)", "pytest-ruff"]
[[package]]
name = "importlib-resources"
version = "5.0.7"
description = "Read resources from Python packages"
category = "main"
optional = true
python-versions = ">=3.6"
files = [
@ -334,7 +303,6 @@ testing = ["pytest (>=3.5,!=3.7.3)", "pytest-black (>=0.3.7)", "pytest-checkdocs
name = "iniconfig"
version = "2.0.0"
description = "brain-dead simple config-ini parsing"
category = "dev"
optional = false
python-versions = ">=3.7"
files = [
@ -346,7 +314,6 @@ files = [
name = "jinja2"
version = "3.1.2"
description = "A very fast and expressive template engine."
category = "main"
optional = true
python-versions = ">=3.7"
files = [
@ -364,7 +331,6 @@ i18n = ["Babel (>=2.7)"]
name = "jsonschema"
version = "4.19.2"
description = "An implementation of JSON Schema validation for Python"
category = "main"
optional = false
python-versions = ">=3.8"
files = [
@ -386,7 +352,6 @@ format-nongpl = ["fqdn", "idna", "isoduration", "jsonpointer (>1.13)", "rfc3339-
name = "jsonschema-specifications"
version = "2023.7.1"
description = "The JSON Schema meta-schemas and vocabularies, exposed as a Registry"
category = "main"
optional = false
python-versions = ">=3.8"
files = [
@ -401,7 +366,6 @@ referencing = ">=0.28.0"
name = "markupsafe"
version = "2.1.3"
description = "Safely add untrusted strings to HTML/XML markup."
category = "main"
optional = true
python-versions = ">=3.7"
files = [
@ -425,16 +389,6 @@ files = [
{file = "MarkupSafe-2.1.3-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:5bbe06f8eeafd38e5d0a4894ffec89378b6c6a625ff57e3028921f8ff59318ac"},
{file = "MarkupSafe-2.1.3-cp311-cp311-win32.whl", hash = "sha256:dd15ff04ffd7e05ffcb7fe79f1b98041b8ea30ae9234aed2a9168b5797c3effb"},
{file = "MarkupSafe-2.1.3-cp311-cp311-win_amd64.whl", hash = "sha256:134da1eca9ec0ae528110ccc9e48041e0828d79f24121a1a146161103c76e686"},
{file = "MarkupSafe-2.1.3-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:f698de3fd0c4e6972b92290a45bd9b1536bffe8c6759c62471efaa8acb4c37bc"},
{file = "MarkupSafe-2.1.3-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:aa57bd9cf8ae831a362185ee444e15a93ecb2e344c8e52e4d721ea3ab6ef1823"},
{file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ffcc3f7c66b5f5b7931a5aa68fc9cecc51e685ef90282f4a82f0f5e9b704ad11"},
{file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:47d4f1c5f80fc62fdd7777d0d40a2e9dda0a05883ab11374334f6c4de38adffd"},
{file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1f67c7038d560d92149c060157d623c542173016c4babc0c1913cca0564b9939"},
{file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:9aad3c1755095ce347e26488214ef77e0485a3c34a50c5a5e2471dff60b9dd9c"},
{file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:14ff806850827afd6b07a5f32bd917fb7f45b046ba40c57abdb636674a8b559c"},
{file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8f9293864fe09b8149f0cc42ce56e3f0e54de883a9de90cd427f191c346eb2e1"},
{file = "MarkupSafe-2.1.3-cp312-cp312-win32.whl", hash = "sha256:715d3562f79d540f251b99ebd6d8baa547118974341db04f5ad06d5ea3eb8007"},
{file = "MarkupSafe-2.1.3-cp312-cp312-win_amd64.whl", hash = "sha256:1b8dd8c3fd14349433c79fa8abeb573a55fc0fdd769133baac1f5e07abf54aeb"},
{file = "MarkupSafe-2.1.3-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:8e254ae696c88d98da6555f5ace2279cf7cd5b3f52be2b5cf97feafe883b58d2"},
{file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cb0932dc158471523c9637e807d9bfb93e06a95cbf010f1a38b98623b929ef2b"},
{file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9402b03f1a1b4dc4c19845e5c749e3ab82d5078d16a2a4c2cd2df62d57bb0707"},
@ -471,7 +425,6 @@ files = [
name = "nested-lookup"
version = "0.2.25"
description = "Python functions for working with deeply nested documents (lists and dicts)"
category = "main"
optional = false
python-versions = "*"
files = [
@ -485,7 +438,6 @@ six = "*"
name = "packaging"
version = "23.2"
description = "Core utilities for Python packages"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@ -497,7 +449,6 @@ files = [
name = "pathspec"
version = "0.11.2"
description = "Utility library for gitignore style pattern matching of file paths."
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@ -505,27 +456,10 @@ files = [
{file = "pathspec-0.11.2.tar.gz", hash = "sha256:e0d8d0ac2f12da61956eb2306b69f9469b42f4deb0f3cb6ed47b9cce9996ced3"},
]
[[package]]
name = "platformdirs"
version = "3.11.0"
description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"."
category = "dev"
optional = false
python-versions = ">=3.7"
files = [
{file = "platformdirs-3.11.0-py3-none-any.whl", hash = "sha256:e9d171d00af68be50e9202731309c4e658fd8bc76f55c11c7dd760d023bda68e"},
{file = "platformdirs-3.11.0.tar.gz", hash = "sha256:cf8ee52a3afdb965072dcc652433e0c7e3e40cf5ea1477cd4b3b1d2eb75495b3"},
]
[package.extras]
docs = ["furo (>=2023.7.26)", "proselint (>=0.13)", "sphinx (>=7.1.1)", "sphinx-autodoc-typehints (>=1.24)"]
test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4)", "pytest-cov (>=4.1)", "pytest-mock (>=3.11.1)"]
[[package]]
name = "pluggy"
version = "1.3.0"
description = "plugin and hook calling mechanisms for python"
category = "dev"
optional = false
python-versions = ">=3.8"
files = [
@ -541,7 +475,6 @@ testing = ["pytest", "pytest-benchmark"]
name = "pycparser"
version = "2.21"
description = "C parser in Python"
category = "main"
optional = true
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
files = [
@ -553,7 +486,6 @@ files = [
name = "pytest"
version = "7.4.3"
description = "pytest: simple powerful testing with Python"
category = "dev"
optional = false
python-versions = ">=3.7"
files = [
@ -576,7 +508,6 @@ testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "no
name = "pytest-cov"
version = "4.1.0"
description = "Pytest plugin for measuring coverage."
category = "dev"
optional = false
python-versions = ">=3.7"
files = [
@ -595,7 +526,6 @@ testing = ["fields", "hunter", "process-tests", "pytest-xdist", "six", "virtuale
name = "pytest-mock"
version = "3.12.0"
description = "Thin-wrapper around the mock package for easier use with pytest"
category = "dev"
optional = false
python-versions = ">=3.8"
files = [
@ -613,7 +543,6 @@ dev = ["pre-commit", "pytest-asyncio", "tox"]
name = "python-json-logger"
version = "2.0.7"
description = "A python library adding a json log formatter"
category = "main"
optional = false
python-versions = ">=3.6"
files = [
@ -625,7 +554,6 @@ files = [
name = "pyyaml"
version = "6.0.1"
description = "YAML parser and emitter for Python"
category = "main"
optional = false
python-versions = ">=3.6"
files = [
@ -634,7 +562,6 @@ files = [
{file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:69b023b2b4daa7548bcfbd4aa3da05b3a74b772db9e23b982788168117739938"},
{file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:81e0b275a9ecc9c0c0c07b4b90ba548307583c125f54d5b6946cfee6360c733d"},
{file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ba336e390cd8e4d1739f42dfe9bb83a3cc2e80f567d8805e11b46f4a943f5515"},
{file = "PyYAML-6.0.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:326c013efe8048858a6d312ddd31d56e468118ad4cdeda36c719bf5bb6192290"},
{file = "PyYAML-6.0.1-cp310-cp310-win32.whl", hash = "sha256:bd4af7373a854424dabd882decdc5579653d7868b8fb26dc7d0e99f823aa5924"},
{file = "PyYAML-6.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:fd1592b3fdf65fff2ad0004b5e363300ef59ced41c2e6b3a99d4089fa8c5435d"},
{file = "PyYAML-6.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:6965a7bc3cf88e5a1c3bd2e0b5c22f8d677dc88a455344035f03399034eb3007"},
@ -642,15 +569,8 @@ files = [
{file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:42f8152b8dbc4fe7d96729ec2b99c7097d656dc1213a3229ca5383f973a5ed6d"},
{file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:062582fca9fabdd2c8b54a3ef1c978d786e0f6b3a1510e0ac93ef59e0ddae2bc"},
{file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d2b04aac4d386b172d5b9692e2d2da8de7bfb6c387fa4f801fbf6fb2e6ba4673"},
{file = "PyYAML-6.0.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:e7d73685e87afe9f3b36c799222440d6cf362062f78be1013661b00c5c6f678b"},
{file = "PyYAML-6.0.1-cp311-cp311-win32.whl", hash = "sha256:1635fd110e8d85d55237ab316b5b011de701ea0f29d07611174a1b42f1444741"},
{file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"},
{file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"},
{file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"},
{file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"},
{file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"},
{file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"},
{file = "PyYAML-6.0.1-cp312-cp312-win_amd64.whl", hash = "sha256:0d3304d8c0adc42be59c5f8a4d9e3d7379e6955ad754aa9d6ab7a398b59dd1df"},
{file = "PyYAML-6.0.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:50550eb667afee136e9a77d6dc71ae76a44df8b3e51e41b77f6de2932bfe0f47"},
{file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1fe35611261b29bd1de0070f0b2f47cb6ff71fa6595c077e42bd0c419fa27b98"},
{file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:704219a11b772aea0d8ecd7058d0082713c3562b4e271b849ad7dc4a5c90c13c"},
@ -667,7 +587,6 @@ files = [
{file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a0cd17c15d3bb3fa06978b4e8958dcdc6e0174ccea823003a106c7d4d7899ac5"},
{file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:28c119d996beec18c05208a8bd78cbe4007878c6dd15091efb73a30e90539696"},
{file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7e07cbde391ba96ab58e532ff4803f79c4129397514e1413a7dc761ccd755735"},
{file = "PyYAML-6.0.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:49a183be227561de579b4a36efbb21b3eab9651dd81b1858589f796549873dd6"},
{file = "PyYAML-6.0.1-cp38-cp38-win32.whl", hash = "sha256:184c5108a2aca3c5b3d3bf9395d50893a7ab82a38004c8f61c258d4428e80206"},
{file = "PyYAML-6.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:1e2722cc9fbb45d9b87631ac70924c11d3a401b2d7f410cc0e3bbf249f2dca62"},
{file = "PyYAML-6.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:9eb6caa9a297fc2c2fb8862bc5370d0303ddba53ba97e71f08023b6cd73d16a8"},
@ -675,7 +594,6 @@ files = [
{file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5773183b6446b2c99bb77e77595dd486303b4faab2b086e7b17bc6bef28865f6"},
{file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b786eecbdf8499b9ca1d697215862083bd6d2a99965554781d0d8d1ad31e13a0"},
{file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bc1bf2925a1ecd43da378f4db9e4f799775d6367bdb94671027b73b393a7c42c"},
{file = "PyYAML-6.0.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:04ac92ad1925b2cff1db0cfebffb6ffc43457495c9b3c39d3fcae417d7125dc5"},
{file = "PyYAML-6.0.1-cp39-cp39-win32.whl", hash = "sha256:faca3bdcf85b2fc05d06ff3fbc1f83e1391b3e724afa3feba7d13eeab355484c"},
{file = "PyYAML-6.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:510c9deebc5c0225e8c96813043e62b680ba2f9c50a08d3724c7f28a747d1486"},
{file = "PyYAML-6.0.1.tar.gz", hash = "sha256:bfdf460b1736c775f2ba9f6a92bca30bc2095067b8a9d77876d1fad6cc3b4a43"},
@ -685,7 +603,6 @@ files = [
name = "referencing"
version = "0.30.2"
description = "JSON Referencing + Python"
category = "main"
optional = false
python-versions = ">=3.8"
files = [
@ -701,7 +618,6 @@ rpds-py = ">=0.7.0"
name = "resolvelib"
version = "1.0.1"
description = "Resolve abstract dependencies into concrete ones"
category = "main"
optional = true
python-versions = "*"
files = [
@ -719,7 +635,6 @@ test = ["commentjson", "packaging", "pytest"]
name = "rpds-py"
version = "0.12.0"
description = "Python bindings to Rust's persistent data structures (rpds)"
category = "main"
optional = false
python-versions = ">=3.8"
files = [
@ -828,7 +743,6 @@ files = [
name = "ruff"
version = "0.1.4"
description = "An extremely fast Python linter and code formatter, written in Rust."
category = "dev"
optional = false
python-versions = ">=3.7"
files = [
@ -855,7 +769,6 @@ files = [
name = "setuptools"
version = "68.2.2"
description = "Easily download, build, install, upgrade, and uninstall Python packages"
category = "main"
optional = false
python-versions = ">=3.8"
files = [
@ -872,7 +785,6 @@ testing-integration = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "jar
name = "six"
version = "1.16.0"
description = "Python 2 and 3 compatibility utilities"
category = "main"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*"
files = [
@ -884,7 +796,6 @@ files = [
name = "toml"
version = "0.10.2"
description = "Python Library for Tom's Obvious, Minimal Language"
category = "dev"
optional = false
python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*"
files = [
@ -896,7 +807,6 @@ files = [
name = "tomli"
version = "2.0.1"
description = "A lil' TOML parser"
category = "dev"
optional = false
python-versions = ">=3.7"
files = [
@ -908,7 +818,6 @@ files = [
name = "toolz"
version = "0.12.0"
description = "List processing tools and functional utilities"
category = "main"
optional = false
python-versions = ">=3.5"
files = [
@ -920,7 +829,6 @@ files = [
name = "unidiff"
version = "0.7.5"
description = "Unified diff parsing/metadata extraction library."
category = "main"
optional = false
python-versions = "*"
files = [
@ -932,7 +840,6 @@ files = [
name = "yamllint"
version = "1.32.0"
description = "A linter for YAML files."
category = "main"
optional = false
python-versions = ">=3.7"
files = [
@ -947,39 +854,6 @@ pyyaml = "*"
[package.extras]
dev = ["doc8", "flake8", "flake8-import-order", "rstcheck[sphinx]", "sphinx"]
[[package]]
name = "yapf"
version = "0.40.2"
description = "A formatter for Python code"
category = "dev"
optional = false
python-versions = ">=3.7"
files = [
{file = "yapf-0.40.2-py3-none-any.whl", hash = "sha256:adc8b5dd02c0143108878c499284205adb258aad6db6634e5b869e7ee2bd548b"},
{file = "yapf-0.40.2.tar.gz", hash = "sha256:4dab8a5ed7134e26d57c1647c7483afb3f136878b579062b786c9ba16b94637b"},
]
[package.dependencies]
importlib-metadata = ">=6.6.0"
platformdirs = ">=3.5.1"
tomli = ">=2.0.1"
[[package]]
name = "zipp"
version = "3.17.0"
description = "Backport of pathlib-compatible object wrapper for zip files"
category = "dev"
optional = false
python-versions = ">=3.8"
files = [
{file = "zipp-3.17.0-py3-none-any.whl", hash = "sha256:0e923e726174922dce09c53c59ad483ff7bbb8e572e00c7f7c46b88556409f31"},
{file = "zipp-3.17.0.tar.gz", hash = "sha256:84e64a1c28cf7e91ed2078bb8cc8c259cb19b76942096c8d7b84947690cabaf0"},
]
[package.extras]
docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (<7.2.5)", "sphinx (>=3.5)", "sphinx-lint"]
testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-ignore-flaky", "pytest-mypy (>=0.9.1)", "pytest-ruff"]
[extras]
ansible = ["ansible"]
ansible-core = ["ansible-core"]
@ -987,4 +861,4 @@ ansible-core = ["ansible-core"]
[metadata]
lock-version = "2.0"
python-versions = "^3.9.0"
content-hash = "99bcf83eefed726262c88b008d7764f1008d1bebb9de08ccb83695d6ee78ec3c"
content-hash = "1057a6f30f9b26d870a62f5c915c38e4ac248a26ed85c456b69fea9bc182cc57"

View File

@ -62,7 +62,6 @@ pytest = "7.4.3"
pytest-mock = "3.12.0"
pytest-cov = "4.1.0"
toml = "0.10.2"
yapf = "0.40.2"
[tool.poetry-dynamic-versioning]
enable = true
@ -97,6 +96,10 @@ exclude = [
".eggs",
"env*",
]
line-length = 99
indent-width = 4
# Explanation of errors
#
# D100: Missing docstring in public module
@ -121,7 +124,6 @@ ignore = [
"UP038",
"RUF012",
]
line-length = 99
select = [
"D",
"E",
@ -144,14 +146,7 @@ select = [
"RUF",
]
[tool.ruff.flake8-quotes]
inline-quotes = "double"
[tool.yapf]
based_on_style = "google"
column_limit = 99
dedent_closing_brackets = true
coalesce_brackets = true
split_before_logical_operator = true
indent_dictionary_value = true
allow_split_before_dict_value = false
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
line-ending = "lf"