Skip to content

Commit

Permalink
tree-wide: sort import statements
Browse files Browse the repository at this point in the history
  • Loading branch information
liushuyu committed Feb 7, 2024
1 parent d0f1baa commit e62c063
Show file tree
Hide file tree
Showing 16 changed files with 60 additions and 41 deletions.
5 changes: 3 additions & 2 deletions acbs/ab4cfg.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import os

from acbs.const import AUTOBUILD_CONF_DIR
from pyparsing import ParseException # type: ignore

from acbs import bashvar
from pyparsing import ParseException # type: ignore
from acbs.const import AUTOBUILD_CONF_DIR


def is_in_stage2_file(abcfg_path: str) -> bool:
Expand Down
3 changes: 1 addition & 2 deletions acbs/base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import re

from typing import List, Optional, Tuple, Dict
from typing import Dict, List, Optional, Tuple

from acbs import __version__

Expand Down
7 changes: 4 additions & 3 deletions acbs/bashvar.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import re
import collections
import logging
import re
import subprocess
import tempfile
import warnings
import subprocess
import collections

import pyparsing as pp # type: ignore

pp.ParserElement.enablePackrat()
Expand Down
2 changes: 1 addition & 1 deletion acbs/crypto.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import hashlib
from typing import Tuple, Optional
from typing import Optional, Tuple


def check_hash_hashlib_inner(chksum_type: str, target_file: str) -> Optional[str]:
Expand Down
2 changes: 1 addition & 1 deletion acbs/deps.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections import OrderedDict, defaultdict, deque
from typing import List, Dict, Deque
from typing import Deque, Dict, List

from acbs.find import find_package
from acbs.parser import ACBSPackageInfo, check_buildability
Expand Down
2 changes: 1 addition & 1 deletion acbs/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
import shutil
import subprocess
from typing import Callable, Dict, Optional, Tuple, List
from typing import Callable, Dict, List, Optional, Tuple

from acbs.base import ACBSPackageInfo, ACBSSourceInfo
from acbs.crypto import check_hash_hashlib, hash_url
Expand Down
6 changes: 3 additions & 3 deletions acbs/find.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import os
import logging
from typing import List, Dict, Optional
import os
from typing import Dict, List, Optional

from acbs.const import TMP_DIR
from acbs.parser import parse_package, ACBSPackageInfo, ACBSSourceInfo
from acbs.parser import ACBSPackageInfo, ACBSSourceInfo, parse_package
from acbs.utils import make_build_dir


Expand Down
29 changes: 20 additions & 9 deletions acbs/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,32 @@

import acbs.fetch
import acbs.parser

from acbs import __version__
from acbs.ab4cfg import is_in_stage2
from acbs.base import ACBSPackageInfo
from acbs.checkpoint import ACBSShrinkWrap, do_shrink_wrap, checkpoint_to_group
from acbs.const import CONF_DIR, DUMP_DIR, LOG_DIR, TMP_DIR, AUTOBUILD_CONF_DIR
from acbs.deps import tarjan_search, prepare_for_reorder
from acbs.checkpoint import ACBSShrinkWrap, checkpoint_to_group, do_shrink_wrap
from acbs.const import AUTOBUILD_CONF_DIR, CONF_DIR, DUMP_DIR, LOG_DIR, TMP_DIR
from acbs.deps import prepare_for_reorder, tarjan_search
from acbs.fetch import fetch_source, process_source
from acbs.find import check_package_groups, find_package
from acbs.parser import get_deps_graph, get_tree_by_name, check_buildability
from acbs.parser import check_buildability, get_deps_graph, get_tree_by_name
from acbs.pm import install_from_repo
from acbs.utils import (ACBSLogFormatter, ACBSLogPlainFormatter, full_line_banner, guess_subdir,
has_stamp, invoke_autobuild, make_build_dir,
print_build_timings, print_package_names, write_checksums,
generate_checksums, is_spec_legacy, check_artifact, validate_package_name)
from acbs.utils import (
ACBSLogFormatter,
ACBSLogPlainFormatter,
check_artifact,
full_line_banner,
generate_checksums,
guess_subdir,
has_stamp,
invoke_autobuild,
is_spec_legacy,
make_build_dir,
print_build_timings,
print_package_names,
validate_package_name,
write_checksums,
)


class BuildCore(object):
Expand Down
2 changes: 1 addition & 1 deletion acbs/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from acbs import bashvar
from acbs.base import ACBSPackageInfo, ACBSSourceInfo
from acbs.pm import filter_dependencies
from acbs.utils import get_arch_name, tarball_pattern, fail_arch_regex
from acbs.utils import fail_arch_regex, get_arch_name, tarball_pattern

generate_mode = False

Expand Down
5 changes: 3 additions & 2 deletions acbs/pm.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
import re
import subprocess
from typing import List, Dict
from typing import Dict, List

from acbs.base import ACBSPackageInfo

Expand All @@ -11,7 +11,8 @@
reorder_mode: bool = False

try:
from acbs.miniapt_query import apt_init_system, check_if_available as apt_check_if_available
from acbs.miniapt_query import apt_init_system
from acbs.miniapt_query import check_if_available as apt_check_if_available
if not apt_init_system():
raise ImportError('Initialization failure.')
except ImportError:
Expand Down
2 changes: 1 addition & 1 deletion acbs/query.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
from typing import Optional, Sequence

from acbs.const import CONF_DIR, DUMP_DIR, TMP_DIR, LOG_DIR
from acbs.const import CONF_DIR, DUMP_DIR, LOG_DIR, TMP_DIR
from acbs.parser import get_tree_by_name


Expand Down
14 changes: 7 additions & 7 deletions acbs/resume.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import pickle
import logging
import pickle
from typing import Dict, List

from acbs import __version__
from acbs.base import ACBSShrinkWrap, ACBSPackageInfo
from acbs.main import BuildCore
from acbs.find import find_package
from acbs.utils import print_package_names, print_build_timings, make_build_dir
from acbs.checkpoint import checkpoint_spec, checkpoint_dpkg, checkpoint_to_group
from acbs.base import ACBSPackageInfo, ACBSShrinkWrap
from acbs.checkpoint import checkpoint_dpkg, checkpoint_spec, checkpoint_to_group
from acbs.const import TMP_DIR
from acbs.find import find_package
from acbs.main import BuildCore
from acbs.pm import check_if_installed
from typing import List, Dict
from acbs.utils import make_build_dir, print_build_timings, print_package_names


def reassign_build_dir(packages: List[ACBSPackageInfo]):
Expand Down
14 changes: 10 additions & 4 deletions acbs/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,19 @@
import subprocess
import tempfile
import time
from typing import List, Optional, Sequence, Tuple, Dict
from typing import Dict, List, Optional, Sequence, Tuple

from acbs import __version__
from acbs.base import ACBSPackageInfo, ACBSSourceInfo
from acbs.const import (
ANSI_BROWN,
ANSI_GREEN,
ANSI_LT_CYAN,
ANSI_RED,
ANSI_RST,
ANSI_YELLOW,
)
from acbs.crypto import check_hash_hashlib_inner
from acbs.const import (ANSI_BROWN, ANSI_GREEN, ANSI_LT_CYAN, ANSI_RED,
ANSI_RST, ANSI_YELLOW)
from acbs import __version__

build_logging = False

Expand Down
1 change: 1 addition & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#
import os
import sys

sys.path.insert(0, os.path.abspath('../..'))

# -- General configuration ------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from setuptools import setup, find_packages, Extension
from setuptools import Extension, find_packages, setup
from setuptools.command.build_ext import build_ext

from acbs import __version__
Expand Down
5 changes: 2 additions & 3 deletions tests/test.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import unittest
import unittest.mock

import acbs.parser
import acbs.find
import acbs.parser
import acbs.pm

from acbs.utils import make_build_dir, guess_extension_name, fail_arch_regex
from acbs.const import TMP_DIR
from acbs.deps import tarjan_search
from acbs.parser import get_deps_graph, parse_url_schema
from acbs.utils import fail_arch_regex, guess_extension_name, make_build_dir


def fake_pm(package):
Expand Down

0 comments on commit e62c063

Please sign in to comment.