mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-12-18 23:03:30 +00:00
Ruff autofix
This commit is contained in:
@@ -104,7 +104,6 @@ def topological_sort(graph, in_degree, roles=None):
|
||||
Perform topological sort on the dependency graph.
|
||||
If a cycle is detected, raise an Exception with detailed debug info.
|
||||
"""
|
||||
from collections import deque
|
||||
|
||||
queue = deque([r for r, d in in_degree.items() if d == 0])
|
||||
sorted_roles = []
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
import argparse
|
||||
import shutil
|
||||
import ipaddress
|
||||
import difflib
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
from ruamel.yaml import YAML
|
||||
|
||||
import sys, os
|
||||
import sys
|
||||
import os
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
||||
from module_utils.entity_name_utils import get_entity_name
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import argparse
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
import yaml
|
||||
from typing import Dict, Any
|
||||
from typing import Any
|
||||
from module_utils.handler.vault import VaultHandler, VaultScalar
|
||||
from module_utils.handler.yaml import YamlHandler
|
||||
from yaml.dumper import SafeDumper
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
import argparse
|
||||
import yaml
|
||||
import sys
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
# Ensure project root on PYTHONPATH so module_utils is importable
|
||||
|
||||
@@ -13,7 +13,7 @@ Returns an integer. If ensure_min_one=True, returns at least 1.
|
||||
"""
|
||||
|
||||
import re
|
||||
from typing import Any, Dict, Mapping, Iterable
|
||||
from typing import Any, Mapping, Iterable
|
||||
|
||||
|
||||
def _is_mapping(x: Any) -> bool:
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from ansible.errors import AnsibleFilterError
|
||||
import sys, os
|
||||
import sys
|
||||
import os
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
||||
from module_utils.entity_name_utils import get_entity_name
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import sys, os
|
||||
import sys
|
||||
import os
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
||||
from module_utils.config_utils import get_app_conf, AppConfigKeyError,ConfigEntryNotSetError
|
||||
from module_utils.config_utils import get_app_conf
|
||||
|
||||
class FilterModule(object):
|
||||
''' Infinito.Nexus application config extraction filters '''
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import sys, os
|
||||
import sys
|
||||
import os
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
||||
from module_utils.entity_name_utils import get_entity_name
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import sys, os
|
||||
import sys
|
||||
import os
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
||||
from module_utils.entity_name_utils import get_entity_name
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/python
|
||||
import sys, os
|
||||
import sys
|
||||
import os
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
||||
from module_utils.get_url import get_url
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import sys, os, re
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
||||
|
||||
from ansible.errors import AnsibleFilterError
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
# filter_plugins/resource_filter.py
|
||||
from __future__ import annotations
|
||||
|
||||
import sys, os
|
||||
import sys
|
||||
import os
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
||||
|
||||
from module_utils.config_utils import get_app_conf, AppConfigKeyError, ConfigEntryNotSetError # noqa: F401
|
||||
|
||||
@@ -5,7 +5,6 @@ __metaclass__ = type
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import time
|
||||
from datetime import datetime
|
||||
|
||||
class CertUtils:
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from ansible.errors import AnsibleFilterError
|
||||
import sys, os
|
||||
import sys
|
||||
import os
|
||||
|
||||
def get_url(domains, application_id, protocol):
|
||||
plugin_dir = os.path.dirname(__file__)
|
||||
|
||||
@@ -4,8 +4,6 @@ Utility for validating deployment application IDs against defined roles and inve
|
||||
"""
|
||||
import os
|
||||
import yaml
|
||||
import glob
|
||||
import configparser
|
||||
|
||||
from filter_plugins.get_all_application_ids import get_all_application_ids
|
||||
|
||||
|
||||
@@ -104,7 +104,6 @@ def topological_sort(graph, in_degree, roles=None):
|
||||
Perform topological sort on the dependency graph.
|
||||
If a cycle is detected, raise an Exception with detailed debug info.
|
||||
"""
|
||||
from collections import deque
|
||||
|
||||
queue = deque([r for r, d in in_degree.items() if d == 0])
|
||||
sorted_roles = []
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
import argparse
|
||||
import shutil
|
||||
import ipaddress
|
||||
import difflib
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
from ruamel.yaml import YAML
|
||||
|
||||
import sys, os
|
||||
import sys
|
||||
import os
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
||||
from module_utils.entity_name_utils import get_entity_name
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import argparse
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
import yaml
|
||||
from typing import Dict, Any
|
||||
from typing import Any
|
||||
from module_utils.handler.vault import VaultHandler, VaultScalar
|
||||
from module_utils.handler.yaml import YamlHandler
|
||||
from yaml.dumper import SafeDumper
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
import argparse
|
||||
import yaml
|
||||
import sys
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
# Ensure project root on PYTHONPATH so module_utils is importable
|
||||
|
||||
@@ -13,7 +13,7 @@ Returns an integer. If ensure_min_one=True, returns at least 1.
|
||||
"""
|
||||
|
||||
import re
|
||||
from typing import Any, Dict, Mapping, Iterable
|
||||
from typing import Any, Mapping, Iterable
|
||||
|
||||
|
||||
def _is_mapping(x: Any) -> bool:
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from ansible.errors import AnsibleFilterError
|
||||
import sys, os
|
||||
import sys
|
||||
import os
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
||||
from module_utils.entity_name_utils import get_entity_name
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import sys, os
|
||||
import sys
|
||||
import os
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
||||
from module_utils.config_utils import get_app_conf, AppConfigKeyError,ConfigEntryNotSetError
|
||||
from module_utils.config_utils import get_app_conf
|
||||
|
||||
class FilterModule(object):
|
||||
''' Infinito.Nexus application config extraction filters '''
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import sys, os
|
||||
import sys
|
||||
import os
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
||||
from module_utils.entity_name_utils import get_entity_name
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import sys, os
|
||||
import sys
|
||||
import os
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
||||
from module_utils.entity_name_utils import get_entity_name
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/python
|
||||
import sys, os
|
||||
import sys
|
||||
import os
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
||||
from module_utils.get_url import get_url
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import sys, os, re
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
||||
|
||||
from ansible.errors import AnsibleFilterError
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
# filter_plugins/resource_filter.py
|
||||
from __future__ import annotations
|
||||
|
||||
import sys, os
|
||||
import sys
|
||||
import os
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
||||
|
||||
from module_utils.config_utils import get_app_conf, AppConfigKeyError, ConfigEntryNotSetError # noqa: F401
|
||||
|
||||
2
main.py
2
main.py
@@ -5,7 +5,6 @@ import subprocess
|
||||
import sys
|
||||
import textwrap
|
||||
import threading
|
||||
import signal
|
||||
from datetime import datetime
|
||||
import pty
|
||||
from module_utils.sounds import Sound
|
||||
@@ -236,7 +235,6 @@ def play_start_intro():
|
||||
|
||||
|
||||
from multiprocessing import Process, get_start_method, set_start_method
|
||||
import time
|
||||
|
||||
def _call_sound(method_name: str):
|
||||
# Re-import inside child to (re)init audio backend cleanly under 'spawn'
|
||||
|
||||
@@ -5,7 +5,6 @@ __metaclass__ = type
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import time
|
||||
from datetime import datetime
|
||||
|
||||
class CertUtils:
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from ansible.errors import AnsibleFilterError
|
||||
import sys, os
|
||||
import sys
|
||||
import os
|
||||
|
||||
def get_url(domains, application_id, protocol):
|
||||
plugin_dir = os.path.dirname(__file__)
|
||||
|
||||
@@ -4,8 +4,6 @@ Utility for validating deployment application IDs against defined roles and inve
|
||||
"""
|
||||
import os
|
||||
import yaml
|
||||
import glob
|
||||
import configparser
|
||||
|
||||
from filter_plugins.get_all_application_ids import get_all_application_ids
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import sys
|
||||
import subprocess
|
||||
import shutil
|
||||
import os
|
||||
import glob
|
||||
import datetime
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import subprocess
|
||||
import os
|
||||
import time
|
||||
import sys
|
||||
import shutil
|
||||
import argparse
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import argparse
|
||||
import subprocess
|
||||
import time
|
||||
import os
|
||||
from datetime import datetime
|
||||
|
||||
# Global variable definition
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import datetime
|
||||
import os
|
||||
|
||||
def cdn_paths(cdn_root, application_id, version):
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# roles/web-app-keycloak/filter_plugins/redirect_uris.py
|
||||
from __future__ import annotations
|
||||
import os, sys
|
||||
import os
|
||||
import sys
|
||||
from typing import Iterable, Sequence
|
||||
from ansible.errors import AnsibleFilterError
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
from typing import Any, Dict, Optional, Iterable
|
||||
from typing import Any, Iterable
|
||||
try:
|
||||
# Ansible provides this; don't hard-depend at import time for unit tests
|
||||
from ansible.errors import AnsibleFilterError
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
# roles/web-svc-logout/filter_plugins/domain_filters.py
|
||||
|
||||
from ansible.errors import AnsibleFilterError
|
||||
import sys, os
|
||||
import sys
|
||||
import os
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..')))
|
||||
from module_utils.config_utils import get_app_conf
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import yaml
|
||||
import os
|
||||
import glob
|
||||
|
||||
from filter_plugins.invokable_paths import get_invokable_paths, get_non_invokable_paths
|
||||
from filter_plugins.invokable_paths import get_invokable_paths
|
||||
|
||||
class TestSysRolesApplicationId(unittest.TestCase):
|
||||
"""
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import os
|
||||
import yaml
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import unittest
|
||||
import yaml
|
||||
from pathlib import Path
|
||||
import re
|
||||
|
||||
class TestDockerRoleServicesConfiguration(unittest.TestCase):
|
||||
def test_services_keys_and_templates(self):
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import glob
|
||||
import os
|
||||
import re
|
||||
import unittest
|
||||
|
||||
@@ -2,7 +2,7 @@ import unittest
|
||||
import yaml
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
from collections import Counter, defaultdict
|
||||
from collections import defaultdict
|
||||
|
||||
class TestDomainUniqueness(unittest.TestCase):
|
||||
def test_no_duplicate_domains(self):
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import os
|
||||
import yaml
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
@@ -247,7 +247,7 @@ class TestAllUsedFiltersAreDefined(unittest.TestCase):
|
||||
"(and are not in BUILTIN_FILTERS):"
|
||||
]
|
||||
for f in unknown:
|
||||
lines.append(f"- " + f)
|
||||
lines.append("- " + f)
|
||||
self.fail("\n".join(lines))
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
|
||||
# Ensure your project root is on PYTHONPATH so filter_plugins can be imported
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import os
|
||||
import yaml
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import unittest
|
||||
import yaml
|
||||
from pathlib import Path
|
||||
|
||||
@@ -16,7 +16,6 @@ def is_under_root_tasks(fpath):
|
||||
|
||||
|
||||
import os
|
||||
import re
|
||||
|
||||
def find_role_includes(roles_dir):
|
||||
"""
|
||||
|
||||
@@ -4,7 +4,7 @@ import re
|
||||
import glob
|
||||
import yaml
|
||||
import unittest
|
||||
from typing import Dict, Set, List, Tuple, Optional
|
||||
from typing import Dict, Set, List, Optional
|
||||
|
||||
# ---------------- Utilities ----------------
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# tests/integration/test_when_condition_duplication.py
|
||||
import os
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict, Iterable, List, Tuple
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
import yaml
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import unittest
|
||||
import sys
|
||||
import os
|
||||
import importlib.util
|
||||
PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../../../../'))
|
||||
|
||||
@@ -11,7 +11,7 @@ sys.path.insert(0, dir_path)
|
||||
|
||||
# Import functions and classes to test
|
||||
from cli.create.credentials import ask_for_confirmation, main
|
||||
from module_utils.handler.vault import VaultHandler, VaultScalar
|
||||
from module_utils.handler.vault import VaultHandler
|
||||
import subprocess
|
||||
import tempfile
|
||||
import yaml
|
||||
|
||||
@@ -17,7 +17,6 @@ from cli.create.inventory import ( # type: ignore
|
||||
ensure_become_password,
|
||||
parse_roles_list,
|
||||
filter_inventory_by_include,
|
||||
filter_inventory_by_ignore,
|
||||
get_path_administrator_home_from_group_vars,
|
||||
ensure_administrator_authorized_keys,
|
||||
apply_vars_overrides,
|
||||
|
||||
@@ -2,7 +2,6 @@ import unittest
|
||||
import tempfile
|
||||
import shutil
|
||||
import os
|
||||
import json
|
||||
from cli.build import tree
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import os
|
||||
import unittest
|
||||
import tempfile
|
||||
import shutil
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# tests/unit/filter_plugins/test_active_docker.py
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
# Unit tests for the get_category_entries Ansible filter plugin (unittest version).
|
||||
|
||||
import os
|
||||
import unittest
|
||||
import tempfile
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
|
||||
from filter_plugins.get_category_entries import get_category_entries
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import unittest
|
||||
import sys
|
||||
import os
|
||||
from filter_plugins.get_domain import FilterModule
|
||||
from ansible.errors import AnsibleFilterError
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import unittest
|
||||
import sys
|
||||
import types
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch, MagicMock
|
||||
from unittest.mock import patch
|
||||
import subprocess
|
||||
import time
|
||||
import os
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import unittest
|
||||
import sys
|
||||
import os
|
||||
import importlib.util
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
import io
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
import pathlib
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import unittest
|
||||
import types
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from importlib.util import spec_from_file_location, module_from_spec
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ Unit tests for roles/sys-front-inj-all/filter_plugins/inj_snippets.py
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
import tempfile
|
||||
import importlib.util
|
||||
|
||||
Reference in New Issue
Block a user