Reduce the max line length from 220 to 160 by wrapping some lines (#2867)
This will make it easier to auto-format import sections.
This commit is contained in:
parent
89425912b9
commit
7776f82cbc
2
.flake8
2
.flake8
|
|
@ -3,7 +3,7 @@ count = True
|
|||
# Several of the following could be autofixed or improved by running the code through psf/black
|
||||
ignore = E722,W191,W503
|
||||
max-complexity = 40
|
||||
max-line-length = 220
|
||||
max-line-length = 160
|
||||
show-source = True
|
||||
statistics = True
|
||||
builtins = _
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ The exceptions to PEP8 are:
|
|||
* Archinstall uses [tabs instead of spaces](https://www.python.org/dev/peps/pep-0008/#tabs-or-spaces) simply to make it
|
||||
easier for non-IDE developers to navigate the code *(Tab display-width should be equal to 4 spaces)*. Exception to the
|
||||
rule are comments that need fine-tuned indentation for documentation purposes.
|
||||
* [Line length](https://www.python.org/dev/peps/pep-0008/#maximum-line-length) a maximum line length is enforced via flake8 with 220 characters
|
||||
* [Line length](https://www.python.org/dev/peps/pep-0008/#maximum-line-length) a maximum line length is enforced via flake8 with 160 characters
|
||||
* Archinstall should always be saved with **Unix-formatted line endings** and no other platform-specific formats.
|
||||
* [String quotes](https://www.python.org/dev/peps/pep-0008/#string-quotes) follow PEP8, the exception being when
|
||||
creating formatted strings, double-quoted strings are *preferred* but not required on the outer edges *(
|
||||
|
|
|
|||
|
|
@ -112,10 +112,11 @@ def parse_unspecified_argument_list(unknowns: list, multiple: bool = False, err:
|
|||
--argument (boolean as default)
|
||||
the optional parameters to the function alter a bit its behaviour:
|
||||
* multiple allows multivalued arguments, each value separated by whitespace. They're returned as a list
|
||||
* error. If set any non correctly specified argument-value pair to raise an exception. Else, simply notifies the existence of a problem and continues processing.
|
||||
* error. If set any non correctly specified argument-value pair to raise an exception. Else, simply notifies the
|
||||
existence of a problem and continues processing.
|
||||
|
||||
To a certain extent, multiple and error are incompatible. In fact, the only error this routine can catch, as of now, is the event
|
||||
argument value value ...
|
||||
To a certain extent, multiple and error are incompatible. In fact, the only error this routine can catch, as of now,
|
||||
is the event argument value value ...
|
||||
which isn't am error if multiple is specified
|
||||
"""
|
||||
tmp_list = [arg for arg in unknowns if arg != "="] # wastes a few bytes, but avoids any collateral effect of the destructive nature of the pop method()
|
||||
|
|
@ -174,14 +175,17 @@ def get_arguments() -> dict[str, Any]:
|
|||
Is done on following steps:
|
||||
0) we create a dict to store the arguments and their values
|
||||
1) preprocess.
|
||||
We take those arguments which use JSON files, and read them into the argument dict. So each first level entry becomes a argument on it's own right
|
||||
We take those arguments which use JSON files, and read them into the argument dict. So each first level entry
|
||||
becomes a argument on it's own right
|
||||
2) Load.
|
||||
We convert the predefined argument list directly into the dict via the vars() function. Non specified arguments are loaded with value None or false if they are booleans (action="store_true").
|
||||
The name is chosen according to argparse conventions. See above (the first text is used as argument name, but underscore substitutes dash)
|
||||
We then load all the undefined arguments. In this case the names are taken as written.
|
||||
We convert the predefined argument list directly into the dict via the vars() function. Non specified arguments
|
||||
are loaded with value None or false if they are booleans (action="store_true"). The name is chosen according to
|
||||
argparse conventions. See above (the first text is used as argument name, but underscore substitutes dash). We
|
||||
then load all the undefined arguments. In this case the names are taken as written.
|
||||
Important. This way explicit command line arguments take precedence over configuration files.
|
||||
3) Amend
|
||||
Change whatever is needed on the configuration dictionary (it could be done in post_process_arguments but this ougth to be left to changes anywhere else in the code, not in the arguments dictionary
|
||||
Change whatever is needed on the configuration dictionary (it could be done in post_process_arguments but this
|
||||
ougth to be left to changes anywhere else in the code, not in the arguments dictionary
|
||||
"""
|
||||
config: dict[str, Any] = {}
|
||||
args, unknowns = parser.parse_known_args()
|
||||
|
|
|
|||
|
|
@ -44,8 +44,14 @@ class PipewireProfile(Profile):
|
|||
install_session.arch_chroot(f'chown -R {user.username}:{user.username} /home/{user.username}')
|
||||
|
||||
# symlink in the correct pipewire systemd items
|
||||
install_session.arch_chroot(f'ln -s /usr/lib/systemd/user/pipewire-pulse.service /home/{user.username}/.config/systemd/user/default.target.wants/pipewire-pulse.service', run_as=user.username)
|
||||
install_session.arch_chroot(f'ln -s /usr/lib/systemd/user/pipewire-pulse.socket /home/{user.username}/.config/systemd/user/default.target.wants/pipewire-pulse.socket', run_as=user.username)
|
||||
install_session.arch_chroot(
|
||||
f'ln -s /usr/lib/systemd/user/pipewire-pulse.service /home/{user.username}/.config/systemd/user/default.target.wants/pipewire-pulse.service',
|
||||
run_as=user.username
|
||||
)
|
||||
install_session.arch_chroot(
|
||||
f'ln -s /usr/lib/systemd/user/pipewire-pulse.socket /home/{user.username}/.config/systemd/user/default.target.wants/pipewire-pulse.socket',
|
||||
run_as=user.username
|
||||
)
|
||||
|
||||
def install(self, install_session: 'Installer') -> None:
|
||||
super().install(install_session)
|
||||
|
|
|
|||
|
|
@ -114,7 +114,8 @@ class Installer:
|
|||
raise exc_val
|
||||
|
||||
if not (missing_steps := self.post_install_check()):
|
||||
log(f'Installation completed without any errors.\nLog files temporarily available at {storage["LOG_PATH"]}.\nYou may reboot when ready.\n', fg='green')
|
||||
msg = f'Installation completed without any errors.\nLog files temporarily available at {storage["LOG_PATH"]}.\nYou may reboot when ready.\n'
|
||||
log(msg, fg='green')
|
||||
self.sync_log_to_install_medium()
|
||||
return True
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -21,7 +21,10 @@ if TYPE_CHECKING:
|
|||
|
||||
def ask_ntp(preset: bool = True) -> bool:
|
||||
header = str(_('Would you like to use automatic time synchronization (NTP) with the default time servers?\n')) + '\n'
|
||||
header += str(_('Hardware time and other post-configuration steps might be required in order for NTP to work.\nFor more information, please check the Arch wiki')) + '\n'
|
||||
header += str(_(
|
||||
'Hardware time and other post-configuration steps might be required in order for NTP to work.\n'
|
||||
'For more information, please check the Arch wiki'
|
||||
)) + '\n'
|
||||
|
||||
preset_val = MenuItem.yes() if preset else MenuItem.no()
|
||||
group = MenuItemGroup.yes_no()
|
||||
|
|
|
|||
|
|
@ -386,7 +386,8 @@ def _parse_remote_mirror_list(mirrorlist: str) -> dict[str, list[MirrorStatusEnt
|
|||
if any([
|
||||
mirror.active is False, # Disabled by mirror-list admins
|
||||
mirror.last_sync is None, # Has not synced recently
|
||||
# mirror.score (error rate) over time reported from backend: https://github.com/archlinux/archweb/blob/31333d3516c91db9a2f2d12260bd61656c011fd1/mirrors/utils.py#L111C22-L111C66
|
||||
# mirror.score (error rate) over time reported from backend:
|
||||
# https://github.com/archlinux/archweb/blob/31333d3516c91db9a2f2d12260bd61656c011fd1/mirrors/utils.py#L111C22-L111C66
|
||||
(mirror.score is None or mirror.score >= 100),
|
||||
]):
|
||||
continue
|
||||
|
|
|
|||
|
|
@ -113,4 +113,6 @@ def installed_package(package: str) -> LocalPackage:
|
|||
except SysCallError:
|
||||
pass
|
||||
|
||||
return LocalPackage({field.name: package_info.get(field.name) for field in dataclasses.fields(LocalPackage)}) # type: ignore # pylint: disable=no-value-for-parameter
|
||||
return LocalPackage( # pylint: disable=no-value-for-parameter
|
||||
{field.name: package_info.get(field.name) for field in dataclasses.fields(LocalPackage)} # type: ignore
|
||||
)
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ py-version = "3.11"
|
|||
recursive = true
|
||||
|
||||
[tool.pylint.format]
|
||||
max-line-length = 220
|
||||
max-line-length = 160
|
||||
|
||||
[tool.pylint."messages control"]
|
||||
disable = [
|
||||
|
|
@ -163,7 +163,7 @@ additional-builtins = ["_"]
|
|||
[tool.ruff]
|
||||
target-version = "py311"
|
||||
builtins = ["_"]
|
||||
line-length = 220
|
||||
line-length = 160
|
||||
|
||||
[tool.ruff.lint]
|
||||
select = [
|
||||
|
|
|
|||
Loading…
Reference in New Issue