Skip to content

Commit

Permalink
import order (#786)
Browse files Browse the repository at this point in the history
Change the order of relative imports

This modifies the order of relative import statements.
Fixes: #780
Prior to this change the order was
import .sibling
import ..parent
import ...grandparent

after this change
import ...grandparent
import ..parent
import .sibling

The resulting order is the default for isort which decreases the amount of custom configuration within the repo and results in a sorting order starting with "least local" to "most local".
This follow on work after #777, which was intended to minimize the changes in the repo related to the cleanup. #779 was also implemented to help detect any issues arising from a change in order.
Some conversation and history about the ordering can be found here: PyCQA/isort#417

Reviewed-by: Sviatoslav Sydorenko <webknjaz+github/profile@redhat.com>
Reviewed-by: None <None>
  • Loading branch information
cidrblock authored Jan 24, 2022
1 parent dfbf2d9 commit 90fa5db
Show file tree
Hide file tree
Showing 75 changed files with 142 additions and 143 deletions.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ lines_after_imports = 2 # Ensures consistency for cases when there's variable vs
lines_between_types = 1 # Separate import/from with 1 line, minimizing changes at time of implementation
no_lines_before = "LOCALFOLDER" # Keeps local imports bundled with first-party
profile = "black" # Avoid conflict with black
reverse_relative = true # Import local prior to parent
skip_glob = ["tests/fixtures/common/collections*"] # Skip ansible content due to ansible-test sanity ruleset

[tool.pylint]
Expand Down
2 changes: 1 addition & 1 deletion src/ansible_navigator/actions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
from typing import Callable
from typing import Union

from . import _actions as actions
from ..app_public import AppPublic
from ..configuration_subsystem import ApplicationConfiguration
from ..ui_framework import Interaction
from . import _actions as actions


get: Callable[[str], Any] = actions.get_factory(__package__)
Expand Down
2 changes: 1 addition & 1 deletion src/ansible_navigator/actions/back.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""ESC, (step back)"""
import logging

from . import _actions as actions
from ..app_public import AppPublic
from ..configuration_subsystem import ApplicationConfiguration
from ..steps import Step
from ..ui_framework import Interaction
from . import _actions as actions


@actions.register
Expand Down
4 changes: 2 additions & 2 deletions src/ansible_navigator/actions/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
from typing import Tuple
from typing import Union

from . import _actions as actions
from . import run_action
from ..app import App
from ..app_public import AppPublic
from ..configuration_subsystem import ApplicationConfiguration
Expand All @@ -25,6 +23,8 @@
from ..ui_framework import Interaction
from ..ui_framework import nonblocking_notification
from ..ui_framework import warning_notification
from . import _actions as actions
from . import run_action


def color_menu(colno: int, colname: str, entry: Dict[str, Any]) -> Tuple[int, int]:
Expand Down
4 changes: 2 additions & 2 deletions src/ansible_navigator/actions/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
from typing import Tuple
from typing import Union

from . import _actions as actions
from . import run_action
from .._yaml import Loader
from .._yaml import yaml
from ..app import App
Expand All @@ -27,6 +25,8 @@
from ..ui_framework import Interaction
from ..ui_framework import nonblocking_notification
from ..ui_framework import warning_notification
from . import _actions as actions
from . import run_action


def color_menu(colno: int, colname: str, entry: Dict[str, Any]) -> Tuple[int, int]:
Expand Down
2 changes: 1 addition & 1 deletion src/ansible_navigator/actions/doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from typing import Tuple
from typing import Union

from . import _actions as actions
from ..app import App
from ..app_public import AppPublic
from ..configuration_subsystem import ApplicationConfiguration
Expand All @@ -22,6 +21,7 @@
from ..ui_framework import CursesLinePart
from ..ui_framework import CursesLines
from ..ui_framework import Interaction
from . import _actions as actions


@actions.register
Expand Down
2 changes: 1 addition & 1 deletion src/ansible_navigator/actions/exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
from typing import Tuple
from typing import Union

from . import _actions as actions
from ..app import App
from ..configuration_subsystem import ApplicationConfiguration
from ..configuration_subsystem.definitions import Constants
from ..runner import Command
from . import _actions as actions


GeneratedCommand = Tuple[str, Optional[List[str]]]
Expand Down
2 changes: 1 addition & 1 deletion src/ansible_navigator/actions/filter.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
""":filter"""
import logging

from . import _actions as actions
from ..app_public import AppPublic
from ..configuration_subsystem import ApplicationConfiguration
from ..ui_framework import Interaction
from . import _actions as actions


@actions.register
Expand Down
2 changes: 1 addition & 1 deletion src/ansible_navigator/actions/help_doc.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
""":help"""
import os

from . import _actions as actions
from ..app import App
from ..app_public import AppPublic
from ..configuration_subsystem import ApplicationConfiguration
from ..ui_framework import Interaction
from . import _actions as actions


@actions.register
Expand Down
4 changes: 2 additions & 2 deletions src/ansible_navigator/actions/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
from typing import Tuple
from typing import Union

from . import _actions as actions
from . import run_action
from ..app import App
from ..app_public import AppPublic
from ..configuration_subsystem import ApplicationConfiguration
Expand All @@ -23,6 +21,8 @@
from ..ui_framework import Interaction
from ..ui_framework import nonblocking_notification
from ..ui_framework import warning_notification
from . import _actions as actions
from . import run_action


def filter_content_keys(obj: Dict[Any, Any]) -> Dict[Any, Any]:
Expand Down
4 changes: 2 additions & 2 deletions src/ansible_navigator/actions/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
from typing import Tuple
from typing import Union

from . import _actions as actions
from . import run_action
from ..app import App
from ..app_public import AppPublic
from ..configuration_subsystem import ApplicationConfiguration
Expand All @@ -25,6 +23,8 @@
from ..ui_framework import Interaction
from ..ui_framework import dict_to_form
from ..ui_framework import warning_notification
from . import _actions as actions
from . import run_action


def color_menu(colno: int, colname: str, entry: Dict[str, Any]) -> Tuple[int, int]:
Expand Down
2 changes: 1 addition & 1 deletion src/ansible_navigator/actions/log.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
""":log"""
from . import _actions as actions
from ..app import App
from ..app_public import AppPublic
from ..configuration_subsystem import ApplicationConfiguration
from ..ui_framework import Interaction
from . import _actions as actions


@actions.register
Expand Down
2 changes: 1 addition & 1 deletion src/ansible_navigator/actions/open_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
from typing import Dict
from typing import List

from . import _actions as actions
from .._yaml import human_dump
from ..app_public import AppPublic
from ..configuration_subsystem import ApplicationConfiguration
from ..ui_framework import Interaction
from ..ui_framework import Menu
from ..utils import remove_dbl_un
from . import _actions as actions


class SuspendCurses:
Expand Down
2 changes: 1 addition & 1 deletion src/ansible_navigator/actions/quit.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"""
import logging

from . import _actions as actions
from ..app_public import AppPublic
from ..configuration_subsystem import ApplicationConfiguration
from ..ui_framework import Interaction
from . import _actions as actions


@actions.register
Expand Down
2 changes: 1 addition & 1 deletion src/ansible_navigator/actions/refresh.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""refresh"""
import logging

from . import _actions as actions
from ..app_public import AppPublic
from ..configuration_subsystem import ApplicationConfiguration
from ..ui_framework import Interaction
from . import _actions as actions


@actions.register
Expand Down
2 changes: 1 addition & 1 deletion src/ansible_navigator/actions/rerun.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import copy
import logging

from . import _actions as actions
from ..app_public import AppPublic
from ..configuration_subsystem import ApplicationConfiguration
from ..ui_framework import Interaction
from . import _actions as actions


# pylint: disable=protected-access
Expand Down
4 changes: 2 additions & 2 deletions src/ansible_navigator/actions/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
from typing import Tuple
from typing import Union

from . import _actions as actions
from . import run_action
from ..app import App
from ..app_public import AppPublic
from ..configuration_subsystem import ApplicationConfiguration
Expand All @@ -37,6 +35,8 @@
from ..utils import human_time
from ..utils import remove_ansi
from ..utils import round_half_up
from . import _actions as actions
from . import run_action


RESULT_TO_COLOR = [
Expand Down
2 changes: 1 addition & 1 deletion src/ansible_navigator/actions/sample_form.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
""":quit
"""
from . import _actions as actions
from .._yaml import yaml
from ..app import App
from ..app_public import AppPublic
from ..configuration_subsystem import ApplicationConfiguration
from ..ui_framework import Interaction
from ..ui_framework import dict_to_form
from ..ui_framework import form_to_dict
from . import _actions as actions


FORM = """
Expand Down
2 changes: 1 addition & 1 deletion src/ansible_navigator/actions/sample_notification.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
""":sample_notification, this is a blocking form
"""
from . import _actions as actions
from .._yaml import yaml
from ..app import App
from ..app_public import AppPublic
from ..configuration_subsystem import ApplicationConfiguration
from ..ui_framework import Interaction
from ..ui_framework import dict_to_form
from ..ui_framework import form_to_dict
from . import _actions as actions


FORM = """
Expand Down
2 changes: 1 addition & 1 deletion src/ansible_navigator/actions/sample_working.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"""
import time

from . import _actions as actions
from ..app import App
from ..app_public import AppPublic
from ..configuration_subsystem import ApplicationConfiguration
from ..ui_framework import Interaction
from ..ui_framework import nonblocking_notification
from . import _actions as actions


@actions.register
Expand Down
2 changes: 1 addition & 1 deletion src/ansible_navigator/actions/save.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
""":save"""
import logging

from . import _actions as actions
from ..app_public import AppPublic
from ..configuration_subsystem import ApplicationConfiguration
from ..ui_framework import Interaction
from . import _actions as actions


@actions.register
Expand Down
2 changes: 1 addition & 1 deletion src/ansible_navigator/actions/select.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
r""":\d+[0-9] etc"""
import logging

from . import _actions as actions
from ..app_public import AppPublic
from ..configuration_subsystem import ApplicationConfiguration
from ..ui_framework import Interaction
from . import _actions as actions


# pylint: disable=protected-access
Expand Down
2 changes: 1 addition & 1 deletion src/ansible_navigator/actions/serialize_json.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
""":json"""
import logging

from . import _actions as actions
from ..app_public import AppPublic
from ..configuration_subsystem import ApplicationConfiguration
from ..ui_framework import Interaction
from . import _actions as actions


@actions.register
Expand Down
2 changes: 1 addition & 1 deletion src/ansible_navigator/actions/serialize_yaml.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
""":yaml"""
import logging

from . import _actions as actions
from ..app_public import AppPublic
from ..configuration_subsystem import ApplicationConfiguration
from ..ui_framework import Interaction
from . import _actions as actions


@actions.register
Expand Down
2 changes: 1 addition & 1 deletion src/ansible_navigator/actions/stdout.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
""":stdout"""

from . import _actions as actions
from ..app import App
from ..app_public import AppPublic
from ..configuration_subsystem import ApplicationConfiguration
from ..ui_framework import Interaction
from . import _actions as actions


@actions.register
Expand Down
2 changes: 1 addition & 1 deletion src/ansible_navigator/actions/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
from collections.abc import Mapping
from typing import Union

from . import _actions as actions
from ..app import App
from ..app_public import AppPublic
from ..configuration_subsystem import ApplicationConfiguration
from ..ui_framework import Interaction
from ..ui_framework import warning_notification
from ..utils import remove_dbl_un
from ..utils import templar
from . import _actions as actions


@actions.register
Expand Down
2 changes: 1 addition & 1 deletion src/ansible_navigator/actions/welcome.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
""":welcome"""
import os

from . import _actions as actions
from ..app import App
from ..app_public import AppPublic
from ..configuration_subsystem import ApplicationConfiguration
from ..ui_framework import Interaction
from . import _actions as actions


WELCOME = """
Expand Down
2 changes: 1 addition & 1 deletion src/ansible_navigator/actions/write_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
import os
import re

from . import _actions as actions
from .._yaml import human_dump
from ..app_public import AppPublic
from ..configuration_subsystem import ApplicationConfiguration
from ..ui_framework import Interaction
from ..utils import remove_dbl_un
from . import _actions as actions


@actions.register
Expand Down
Loading

0 comments on commit 90fa5db

Please sign in to comment.