Use __all__ in __init__.py files to fix unused-import warnings (#3252)
This commit allows ruff and flake8 ignores to be removed. It also allows mypy to be run in strict mode by default.
This commit is contained in:
parent
e7ca4f56d5
commit
f100e5110d
1
.flake8
1
.flake8
|
|
@ -6,5 +6,4 @@ max-line-length = 160
|
|||
show-source = True
|
||||
statistics = True
|
||||
builtins = _
|
||||
per-file-ignores = __init__.py:F401
|
||||
exclude = .git,__pycache__,build,docs,actions-runner
|
||||
|
|
|
|||
|
|
@ -119,3 +119,23 @@ def run_as_a_module() -> None:
|
|||
|
||||
warn(text)
|
||||
exit(1)
|
||||
|
||||
|
||||
__all__ = [
|
||||
'DeferredTranslation',
|
||||
'FormattedOutput',
|
||||
'Language',
|
||||
'Pacman',
|
||||
'SysInfo',
|
||||
'Tui',
|
||||
'arch_config_handler',
|
||||
'debug',
|
||||
'disk_layouts',
|
||||
'error',
|
||||
'info',
|
||||
'load_plugin',
|
||||
'log',
|
||||
'plugin',
|
||||
'translation_handler',
|
||||
'warn',
|
||||
]
|
||||
|
|
|
|||
|
|
@ -18,3 +18,28 @@ from .general_conf import (
|
|||
from .manage_users_conf import UserList, ask_for_additional_users
|
||||
from .network_menu import ManualNetworkConfig, ask_to_configure_network
|
||||
from .system_conf import ask_for_bootloader, ask_for_swap, ask_for_uki, select_driver, select_kernel
|
||||
|
||||
__all__ = [
|
||||
'ManualNetworkConfig',
|
||||
'UserList',
|
||||
'add_number_of_parallel_downloads',
|
||||
'ask_additional_packages_to_install',
|
||||
'ask_for_a_timezone',
|
||||
'ask_for_additional_users',
|
||||
'ask_for_audio_selection',
|
||||
'ask_for_bootloader',
|
||||
'ask_for_swap',
|
||||
'ask_for_uki',
|
||||
'ask_hostname',
|
||||
'ask_ntp',
|
||||
'ask_to_configure_network',
|
||||
'get_default_partition_layout',
|
||||
'select_archinstall_language',
|
||||
'select_devices',
|
||||
'select_disk_config',
|
||||
'select_driver',
|
||||
'select_kernel',
|
||||
'select_main_filesystem_format',
|
||||
'suggest_multi_disk_layout',
|
||||
'suggest_single_disk_layout',
|
||||
]
|
||||
|
|
|
|||
|
|
@ -7,3 +7,13 @@ from .utils import (
|
|||
verify_keyboard_layout,
|
||||
verify_x11_keyboard_layout,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
'list_keyboard_languages',
|
||||
'list_locales',
|
||||
'list_timezones',
|
||||
'list_x11_keyboard_languages',
|
||||
'set_kb_layout',
|
||||
'verify_keyboard_layout',
|
||||
'verify_x11_keyboard_layout',
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1,2 +1,8 @@
|
|||
from .abstract_menu import AbstractMenu, AbstractSubMenu
|
||||
from .list_manager import ListManager
|
||||
|
||||
__all__ = [
|
||||
'AbstractMenu',
|
||||
'AbstractSubMenu',
|
||||
'ListManager',
|
||||
]
|
||||
|
|
|
|||
|
|
@ -33,3 +33,48 @@ from .mirrors import CustomRepository, MirrorConfiguration, MirrorRegion
|
|||
from .network_configuration import NetworkConfiguration, Nic, NicType
|
||||
from .profile_model import ProfileConfiguration
|
||||
from .users import PasswordStrength, User
|
||||
|
||||
__all__ = [
|
||||
'Audio',
|
||||
'AudioConfiguration',
|
||||
'BDevice',
|
||||
'Bootloader',
|
||||
'CustomRepository',
|
||||
'DeviceGeometry',
|
||||
'DeviceModification',
|
||||
'DiskEncryption',
|
||||
'DiskLayoutConfiguration',
|
||||
'DiskLayoutType',
|
||||
'EncryptionType',
|
||||
'Fido2Device',
|
||||
'FilesystemType',
|
||||
'LocalPackage',
|
||||
'LocaleConfiguration',
|
||||
'LsblkInfo',
|
||||
'LvmConfiguration',
|
||||
'LvmLayoutType',
|
||||
'LvmVolume',
|
||||
'LvmVolumeGroup',
|
||||
'LvmVolumeStatus',
|
||||
'MirrorConfiguration',
|
||||
'MirrorRegion',
|
||||
'ModificationStatus',
|
||||
'NetworkConfiguration',
|
||||
'Nic',
|
||||
'NicType',
|
||||
'PackageSearch',
|
||||
'PackageSearchResult',
|
||||
'PartitionFlag',
|
||||
'PartitionModification',
|
||||
'PartitionTable',
|
||||
'PartitionType',
|
||||
'PasswordStrength',
|
||||
'ProfileConfiguration',
|
||||
'Repository',
|
||||
'SectorSize',
|
||||
'Size',
|
||||
'SubvolumeModification',
|
||||
'Unit',
|
||||
'User',
|
||||
'_DeviceInfo',
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1 +1,11 @@
|
|||
from .packages import find_package, find_packages, group_search, installed_package, list_available_packages, package_search, validate_package_list
|
||||
|
||||
__all__ = [
|
||||
'find_package',
|
||||
'find_packages',
|
||||
'group_search',
|
||||
'installed_package',
|
||||
'list_available_packages',
|
||||
'package_search',
|
||||
'validate_package_list',
|
||||
]
|
||||
|
|
|
|||
|
|
@ -86,3 +86,9 @@ class Pacman:
|
|||
f'pacstrap -C /etc/pacman.conf -K {self.target} {" ".join(packages)} --noconfirm',
|
||||
peek_output=True
|
||||
)
|
||||
|
||||
|
||||
__all__ = [
|
||||
'Config',
|
||||
'Pacman',
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1,2 +1,9 @@
|
|||
from .profile_menu import ProfileMenu, select_greeter, select_profile
|
||||
from .profiles_handler import profile_handler
|
||||
|
||||
__all__ = [
|
||||
'ProfileMenu',
|
||||
'profile_handler',
|
||||
'select_greeter',
|
||||
'select_profile',
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1,3 +1,19 @@
|
|||
from .curses_menu import EditMenu, SelectMenu, Tui
|
||||
from .menu_item import MenuItem, MenuItemGroup
|
||||
from .types import Alignment, Chars, FrameProperties, FrameStyle, Orientation, PreviewStyle, Result, ResultType
|
||||
|
||||
__all__ = [
|
||||
'Alignment',
|
||||
'Chars',
|
||||
'EditMenu',
|
||||
'FrameProperties',
|
||||
'FrameStyle',
|
||||
'MenuItem',
|
||||
'MenuItemGroup',
|
||||
'Orientation',
|
||||
'PreviewStyle',
|
||||
'Result',
|
||||
'ResultType',
|
||||
'SelectMenu',
|
||||
'Tui',
|
||||
]
|
||||
|
|
|
|||
|
|
@ -66,25 +66,12 @@ archinstall = "archinstall"
|
|||
python_version = "3.12"
|
||||
files = "."
|
||||
exclude = "^build/"
|
||||
check_untyped_defs = true
|
||||
disallow_any_explicit = false
|
||||
disallow_any_expr = false
|
||||
disallow_any_generics = true
|
||||
disallow_any_unimported = true
|
||||
disallow_incomplete_defs = true
|
||||
disallow_subclassing_any = true
|
||||
disallow_untyped_calls = true
|
||||
disallow_untyped_decorators = true
|
||||
disallow_untyped_defs = true
|
||||
extra_checks = true
|
||||
strict = false
|
||||
strict = true
|
||||
strict_bytes = true
|
||||
strict_equality = true
|
||||
warn_redundant_casts = true
|
||||
warn_return_any = true
|
||||
warn_unreachable = true
|
||||
warn_unused_configs = true
|
||||
warn_unused_ignores = true
|
||||
|
||||
[[tool.mypy.overrides]]
|
||||
module = "archinstall.default_profiles.*"
|
||||
|
|
@ -231,6 +218,3 @@ ignore = [
|
|||
|
||||
[tool.ruff.lint.mccabe]
|
||||
max-complexity = 40
|
||||
|
||||
[tool.ruff.lint.per-file-ignores]
|
||||
"__init__.py" = ["F401"] # unused-import
|
||||
|
|
|
|||
Loading…
Reference in New Issue