Skip to content

Commit fdb0ae9

Browse files
committed
quality: Please the linter gods?
1 parent a915395 commit fdb0ae9

File tree

6 files changed

+15
-11
lines changed

6 files changed

+15
-11
lines changed

src/app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1451,12 +1451,11 @@ def _run_step(step):
14511451
_run_step("post_init_as_root")
14521452

14531453
# FIXME: i18n / ux
1454-
logger.info(f"Finalizing ...")
1454+
logger.info("Finalizing ...")
14551455
_run_step("pre_finalize_as_root")
14561456
_run_step("finalize")
14571457
_run_step("post_finalize_as_root")
14581458

1459-
14601459
if packaging_format >= 3:
14611460
install_sequence()
14621461

@@ -1743,6 +1742,7 @@ def app_regen_conf(app: str, dry_run: bool, with_diff: bool = False) -> dict:
17431742
# FIXME : to be consistent, we should also call the pre / post regenconf hook of the app if there are any
17441743
return manager.apply()
17451744

1745+
17461746
@is_unit_operation()
17471747
def app_makedefault(
17481748
operation_logger: "OperationLogger",

src/permission.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,15 +161,15 @@ def user_permission_list(
161161
g: infos["members"] for g, infos in user_group_list()["groups"].items()
162162
}
163163
for infos in permissions.values():
164-
infos["corresponding_users"] = set()
164+
corresponding_users = set()
165165
for group in infos["allowed"]:
166166
# FIXME: somewhere we may want to have some sort of garbage collection
167167
# to automatically remove user/groups from the "allowed" info when they
168168
# somehow disappeared from the system (for example this may happen when
169169
# restoring an app on which not all the user/group exist)
170170
users_in_group = set(map_group_to_users.get(group, []))
171-
infos["corresponding_users"] |= users_in_group
172-
infos["corresponding_users"] = list(sorted(infos["corresponding_users"]))
171+
corresponding_users |= users_in_group
172+
infos["corresponding_users"] = list(sorted(corresponding_users))
173173
else:
174174
# Keep the output concise when used without --full, meant to not bloat CLI
175175
for infos in permissions.values():

src/service.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@
2222
import re
2323
import subprocess
2424
import time
25+
import yaml
2526
from datetime import datetime
2627
from glob import glob
2728
from logging import getLogger
29+
from typing import TYPE_CHECKING, cast
2830

29-
import yaml
3031
from moulinette import m18n, Moulinette
3132
from moulinette.utils.filesystem import (
3233
append_to_file,
@@ -46,7 +47,11 @@
4647
SERVICES_CONF = "/etc/yunohost/services.yml"
4748
SERVICES_CONF_BASE = "/usr/share/yunohost/conf/yunohost/services.yml"
4849

49-
logger = getLogger("yunohost.service")
50+
if TYPE_CHECKING:
51+
from moulinette.utils.log import MoulinetteLogger
52+
logger = cast(MoulinetteLogger, getLogger("yunohost.service"))
53+
else:
54+
logger = getLogger("yunohost.service")
5055

5156

5257
def service_add(

src/utils/form.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,8 @@
1818
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1919
#
2020

21-
import ast
2221
import datetime
23-
import operator as op
2422
import os
25-
import re
2623
import shutil
2724
import tempfile
2825
import urllib.parse

src/utils/resources.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
from typing import Any, Callable, Dict, List, Union
2929

3030
from moulinette import m18n
31-
from moulinette.utils.filesystem import chmod, chown, mkdir, rm, write_to_file
31+
from moulinette.utils.filesystem import chmod, chown, mkdir, rm
3232
from moulinette.utils.process import check_output
3333
from moulinette.utils.text import random_ascii
3434

@@ -40,6 +40,7 @@
4040

4141
SOURCES_CACHE_DIR = "/var/tmp/yunohost/download/"
4242

43+
4344
class AppResourceManager:
4445
def __init__(self, app: str, current: Dict, wanted: Dict, workdir=None):
4546
self.app = app

src/utils/system.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ def ram_total():
148148

149149
return (psutil.virtual_memory().total, psutil.swap_memory().total)
150150

151+
151152
def get_ynh_package_version(package):
152153
# Returns the installed version and release version ('stable' or 'testing'
153154
# or 'unstable')

0 commit comments

Comments
 (0)