From 47ee48f762c8e6960ba90c78290048c18a0a80cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Sun, 20 Oct 2024 17:25:30 +0200 Subject: [PATCH] Sort imports --- setup.py | 2 +- tests/test_fix_manifest_website.py | 4 ++-- tests/test_gen_addon_icon.py | 2 +- tests/test_gen_addon_readme.py | 2 +- tests/test_hash.py | 4 ++-- tests/test_manifest.py | 1 - tests/test_towncrier.py | 1 + tests/test_update_pre_commit_excluded_addons.py | 1 + tools/add-badges.py | 8 ++++---- tools/clone_everything.py | 2 +- tools/configure_travis.py | 1 - tools/copier_update.py | 2 +- tools/copy_maintainers.py | 8 +++----- tools/create_migration_issue.py | 7 ++++--- tools/fix_manifest_website.py | 1 - tools/gen_addon_icon.py | 4 ++-- tools/gen_addon_readme.py | 6 +++--- tools/gen_addons_table.py | 1 + tools/gen_metapackage.py | 7 ++++--- tools/github_login.py | 2 ++ tools/migrate_branch.py | 8 +++++--- tools/migrate_branch_empty.py | 8 +++++--- tools/oca_projects.py | 4 +++- tools/oca_sync_users.py | 2 +- tools/odoo_login.py | 5 +++-- tools/publish_modules.py | 8 +++++--- tools/set_repo_labels.py | 1 + 27 files changed, 57 insertions(+), 45 deletions(-) diff --git a/setup.py b/setup.py index 9cd6efa7f..8c3749a09 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ # License AGPLv3 (https://www.gnu.org/licenses/agpl-3.0-standalone.html) import os -import setuptools +import setuptools here = os.path.dirname(os.path.abspath(__file__)) with open(os.path.join(here, "README.md")) as f: diff --git a/tests/test_fix_manifest_website.py b/tests/test_fix_manifest_website.py index afe5d6796..f0869f741 100644 --- a/tests/test_fix_manifest_website.py +++ b/tests/test_fix_manifest_website.py @@ -1,7 +1,7 @@ -from tools.fix_manifest_website import main - from click.testing import CliRunner +from tools.fix_manifest_website import main + def test_fix_manifest_website(tmp_path): (tmp_path / "a1").mkdir() diff --git a/tests/test_gen_addon_icon.py b/tests/test_gen_addon_icon.py index 9c8cd136a..c675f71de 100644 --- a/tests/test_gen_addon_icon.py +++ b/tests/test_gen_addon_icon.py @@ -6,7 +6,7 @@ import subprocess import sys -from tools.gen_addon_icon import ICONS_DIR, ICON_TYPE +from tools.gen_addon_icon import ICON_TYPE, ICONS_DIR def test_gen_addon_icon(tmp_path): diff --git a/tests/test_gen_addon_readme.py b/tests/test_gen_addon_readme.py index f244f2a93..37555205f 100644 --- a/tests/test_gen_addon_readme.py +++ b/tests/test_gen_addon_readme.py @@ -10,10 +10,10 @@ import pytest from tools.gen_addon_readme import ( + _get_source_digest, get_fragment_format, get_fragments_format, safe_remove, - _get_source_digest, ) diff --git a/tests/test_hash.py b/tests/test_hash.py index 315e5476e..c303b849a 100644 --- a/tests/test_hash.py +++ b/tests/test_hash.py @@ -1,7 +1,7 @@ -from tools._hash import hash, _walk - import pytest +from tools._hash import _walk, hash + def test_hash(tmp_path): def populate(top): diff --git a/tests/test_manifest.py b/tests/test_manifest.py index 2469059cf..57cec819a 100644 --- a/tests/test_manifest.py +++ b/tests/test_manifest.py @@ -4,7 +4,6 @@ from tools import manifest - HERE = os.path.dirname(__file__) TEST_REPO_DIR = os.path.join(HERE, "test_repo") diff --git a/tests/test_towncrier.py b/tests/test_towncrier.py index df93bcd02..3f407a75d 100644 --- a/tests/test_towncrier.py +++ b/tests/test_towncrier.py @@ -6,6 +6,7 @@ import pytest import toml from click.testing import CliRunner + from tools.oca_towncrier import _make_issue_format, _prepare_config, oca_towncrier diff --git a/tests/test_update_pre_commit_excluded_addons.py b/tests/test_update_pre_commit_excluded_addons.py index 364e477e1..1a6960453 100644 --- a/tests/test_update_pre_commit_excluded_addons.py +++ b/tests/test_update_pre_commit_excluded_addons.py @@ -1,4 +1,5 @@ from __future__ import unicode_literals + import subprocess import textwrap diff --git a/tools/add-badges.py b/tools/add-badges.py index 3e4eaf7a3..275fe9b39 100644 --- a/tools/add-badges.py +++ b/tools/add-badges.py @@ -1,10 +1,10 @@ -import re +import fileinput import os +import pdb +import re +import shutil import subprocess -import fileinput import sys -import shutil -import pdb # Runbot urls need the repo id from the table in the runbot server. # This file is the output of a select id, name from there. diff --git a/tools/clone_everything.py b/tools/clone_everything.py index fd5ddc0ac..c9e518257 100644 --- a/tools/clone_everything.py +++ b/tools/clone_everything.py @@ -2,10 +2,10 @@ # License AGPLv3 (https://www.gnu.org/licenses/agpl-3.0-standalone.html) import argparse +import os import subprocess from .oca_projects import OCA_REPOSITORY_NAMES, url -import os def clone(organization_remotes=None, remove_old_repos=False, target_branch=False): diff --git a/tools/configure_travis.py b/tools/configure_travis.py index d89897c8b..575f6a6bd 100644 --- a/tools/configure_travis.py +++ b/tools/configure_travis.py @@ -2,7 +2,6 @@ import click import requests - OCA_TRAVIS_GITHUB_USER = "oca-travis" OCA_TRAVIS_GITHUB_EMAIL = "oca+oca-travis@odoo-community.org" diff --git a/tools/copier_update.py b/tools/copier_update.py index 6ca98e6e7..3acf5135b 100644 --- a/tools/copier_update.py +++ b/tools/copier_update.py @@ -9,7 +9,7 @@ import requests from .gitutils import commit_if_needed -from .oca_projects import BranchNotFoundError, temporary_clone, get_repositories +from .oca_projects import BranchNotFoundError, get_repositories, temporary_clone IGNORED_REJ_FILES = ["oca_dependencies.txt.rej"] diff --git a/tools/copy_maintainers.py b/tools/copy_maintainers.py index 57ad69ea9..45a5199b6 100644 --- a/tools/copy_maintainers.py +++ b/tools/copy_maintainers.py @@ -1,7 +1,5 @@ # -*- coding: utf-8 -*- # License AGPLv3 (https://www.gnu.org/licenses/agpl-3.0-standalone.html) -from __future__ import absolute_import, print_function - """ oca-copy-maintainers @@ -10,15 +8,15 @@ """ +from __future__ import absolute_import, print_function + import argparse import errno import os import sys from operator import attrgetter -from . import github_login -from . import odoo_login -from . import colors +from . import colors, github_login, odoo_login COPY_USERS_BLACKLIST = os.environ.get( "COPY_USERS_BLACKLIST", "~/.config/oca-copy-maintainers/copy_users_blacklist.txt" diff --git a/tools/create_migration_issue.py b/tools/create_migration_issue.py index 63bcc7ef8..b9e739f55 100644 --- a/tools/create_migration_issue.py +++ b/tools/create_migration_issue.py @@ -81,13 +81,14 @@ """ from __future__ import print_function + import argparse -from . import github_login -from . import oca_projects -from .config import read_config import github3 +from . import github_login, oca_projects +from .config import read_config + MANIFESTS = ("__openerp__.py", "__manifest__.py") diff --git a/tools/fix_manifest_website.py b/tools/fix_manifest_website.py index 616164956..740a71eb7 100644 --- a/tools/fix_manifest_website.py +++ b/tools/fix_manifest_website.py @@ -7,7 +7,6 @@ from .manifest import get_manifest_path, parse_manifest - WEBSITE_KEY_RE = re.compile(r"""(["']website["']\s*:\s*["'])([^"']*)(["'])""") diff --git a/tools/gen_addon_icon.py b/tools/gen_addon_icon.py index 05d409c68..e76596ee4 100644 --- a/tools/gen_addon_icon.py +++ b/tools/gen_addon_icon.py @@ -4,11 +4,11 @@ import os import shutil + import click from .gitutils import commit_if_needed -from .manifest import read_manifest, find_addons, NoManifestFound - +from .manifest import NoManifestFound, find_addons, read_manifest ICONS_DIR = os.path.join("static", "description") diff --git a/tools/gen_addon_readme.py b/tools/gen_addon_readme.py index 5624244b9..cb8831ea5 100644 --- a/tools/gen_addon_readme.py +++ b/tools/gen_addon_readme.py @@ -13,13 +13,13 @@ from urllib.parse import urljoin import click +import pypandoc from docutils.core import publish_file from jinja2 import Template -import pypandoc -from .gitutils import commit_if_needed -from .manifest import get_manifest_path, read_manifest, find_addons, NoManifestFound from ._hash import hash +from .gitutils import commit_if_needed +from .manifest import NoManifestFound, find_addons, get_manifest_path, read_manifest if sys.version_info >= (3, 8): from typing import Literal diff --git a/tools/gen_addons_table.py b/tools/gen_addons_table.py index bd87eb7b9..81f338d79 100755 --- a/tools/gen_addons_table.py +++ b/tools/gen_addons_table.py @@ -18,6 +18,7 @@ """ from __future__ import print_function + import ast import io import logging diff --git a/tools/gen_metapackage.py b/tools/gen_metapackage.py index ff1e43a7a..864c3a01f 100644 --- a/tools/gen_metapackage.py +++ b/tools/gen_metapackage.py @@ -7,13 +7,14 @@ from pathlib import Path from typing import Any, List, Optional - +from manifestoo_core.addon import Addon, is_addon_dir +from manifestoo_core.metadata import addon_name_to_requirement from manifestoo_core.odoo_series import ( OdooSeries, +) +from manifestoo_core.odoo_series import ( detect_from_addon_version as detect_odoo_series_from_addon_version, ) -from manifestoo_core.addon import is_addon_dir, Addon -from manifestoo_core.metadata import addon_name_to_requirement from .compat import tomllib diff --git a/tools/github_login.py b/tools/github_login.py index e253f6203..f17a67678 100644 --- a/tools/github_login.py +++ b/tools/github_login.py @@ -6,7 +6,9 @@ import os import subprocess from getpass import getpass + import github3 + from .config import read_config, write_config diff --git a/tools/migrate_branch.py b/tools/migrate_branch.py index bd28313a6..036970b0b 100644 --- a/tools/migrate_branch.py +++ b/tools/migrate_branch.py @@ -87,13 +87,15 @@ """ from __future__ import print_function + import argparse import re -from . import github_login -from . import oca_projects -from .config import read_config + from github3.exceptions import NotFoundError +from . import github_login, oca_projects +from .config import read_config + MANIFESTS = ("__openerp__.py", "__manifest__.py") diff --git a/tools/migrate_branch_empty.py b/tools/migrate_branch_empty.py index 3fcaa81e3..9b066ad6d 100644 --- a/tools/migrate_branch_empty.py +++ b/tools/migrate_branch_empty.py @@ -89,13 +89,15 @@ """ from __future__ import print_function + import argparse import re -from . import github_login -from . import oca_projects -from .config import read_config + from github3.exceptions import NotFoundError +from . import github_login, oca_projects +from .config import read_config + MANIFESTS = ("__openerp__.py", "__manifest__.py") diff --git a/tools/oca_projects.py b/tools/oca_projects.py index 7699c48a5..5511ee6d6 100644 --- a/tools/oca_projects.py +++ b/tools/oca_projects.py @@ -8,13 +8,15 @@ """ from __future__ import print_function -from contextlib import contextmanager + import os import shutil import subprocess import tempfile +from contextlib import contextmanager import appdirs + from .config import NOT_ADDONS, is_main_branch from .github_login import login diff --git a/tools/oca_sync_users.py b/tools/oca_sync_users.py index a789ff50c..4b0e088e0 100644 --- a/tools/oca_sync_users.py +++ b/tools/oca_sync_users.py @@ -11,7 +11,7 @@ import xmlrpclib -from .odoo_login import login, get_parser +from .odoo_login import get_parser, login def main(): diff --git a/tools/odoo_login.py b/tools/odoo_login.py index 5fe761ccf..bdc6b1cc8 100644 --- a/tools/odoo_login.py +++ b/tools/odoo_login.py @@ -5,10 +5,11 @@ import argparse import os import sys -import erppeek from getpass import getpass -from .config import read_config, write_config +import erppeek + +from .config import read_config, write_config ODOO_URL = os.environ.get("ODOO_URL", "https://odoo-community.org") ODOO_DB = os.environ.get("ODOO_DB", "odoo_community_prod") diff --git a/tools/publish_modules.py b/tools/publish_modules.py index ac52e6175..089e015d8 100755 --- a/tools/publish_modules.py +++ b/tools/publish_modules.py @@ -61,16 +61,18 @@ """ from __future__ import print_function + import logging from getpass import getpass + import click -from selenium.common.exceptions import NoSuchElementException from selenium import webdriver -from selenium.webdriver.support.ui import WebDriverWait +from selenium.common.exceptions import NoSuchElementException from selenium.webdriver.chrome.options import Options +from selenium.webdriver.support.ui import WebDriverWait -from .oca_projects import get_repositories_and_branches, url from .config import read_config +from .oca_projects import get_repositories_and_branches, url _logger = logging.getLogger(__name__) diff --git a/tools/set_repo_labels.py b/tools/set_repo_labels.py index 1e0abb817..55db000a2 100644 --- a/tools/set_repo_labels.py +++ b/tools/set_repo_labels.py @@ -6,6 +6,7 @@ """ from __future__ import print_function + import click from .github_login import login