mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Cleanup unused imports / misc 'fatal' flake8 errors
This commit is contained in:
parent
6f75b889b7
commit
fa19c9480c
17 changed files with 13 additions and 42 deletions
|
@ -3,7 +3,6 @@
|
|||
import os
|
||||
|
||||
from yunohost.diagnosis import Diagnoser
|
||||
from yunohost.utils.error import YunohostError
|
||||
from yunohost.service import _get_services
|
||||
|
||||
class PortsDiagnoser(Diagnoser):
|
||||
|
|
|
@ -8,7 +8,6 @@ from moulinette.utils.filesystem import read_file
|
|||
|
||||
from yunohost.diagnosis import Diagnoser
|
||||
from yunohost.domain import domain_list
|
||||
from yunohost.utils.error import YunohostError
|
||||
|
||||
DIAGNOSIS_SERVER = "diagnosis.yunohost.org"
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
import os
|
||||
|
||||
import subprocess
|
||||
from yunohost.diagnosis import Diagnoser
|
||||
from yunohost.regenconf import _get_regenconf_infos, _calculate_hash
|
||||
|
||||
|
|
|
@ -681,7 +681,7 @@ def app_install(operation_logger, app, label=None, args=None, no_remove_on_failu
|
|||
|
||||
from yunohost.hook import hook_add, hook_remove, hook_exec, hook_callback
|
||||
from yunohost.log import OperationLogger
|
||||
from yunohost.permission import user_permission_list, permission_create, permission_url, permission_delete, permission_sync_to_user, user_permission_update
|
||||
from yunohost.permission import user_permission_list, permission_create, permission_url, permission_delete, permission_sync_to_user
|
||||
from yunohost.regenconf import manually_modified_files
|
||||
|
||||
# Fetch or extract sources
|
||||
|
|
|
@ -894,8 +894,6 @@ class RestoreManager():
|
|||
"""
|
||||
from permission import permission_sync_to_user
|
||||
|
||||
successfull_apps = self.targets.list("apps", include=["Success", "Warning"])
|
||||
|
||||
permission_sync_to_user()
|
||||
|
||||
if os.path.ismount(self.work_dir):
|
||||
|
@ -1160,7 +1158,7 @@ class RestoreManager():
|
|||
return
|
||||
|
||||
from yunohost.user import user_group_list
|
||||
from yunohost.permission import permission_create, permission_delete, user_permission_update, user_permission_list, permission_sync_to_user
|
||||
from yunohost.permission import permission_create, permission_delete, user_permission_list, permission_sync_to_user
|
||||
|
||||
# Backup old permission for apps
|
||||
# We need to do that because in case of an app is installed we can't remove the permission for this app
|
||||
|
@ -1257,7 +1255,7 @@ class RestoreManager():
|
|||
name should be already install)
|
||||
"""
|
||||
from yunohost.user import user_group_list
|
||||
from yunohost.permission import permission_create, permission_delete, user_permission_list, user_permission_update, permission_sync_to_user
|
||||
from yunohost.permission import permission_create, permission_delete, user_permission_list, permission_sync_to_user
|
||||
|
||||
def copytree(src, dst, symlinks=False, ignore=None):
|
||||
for item in os.listdir(src):
|
||||
|
|
|
@ -4,7 +4,7 @@ from shutil import copy2
|
|||
|
||||
from moulinette.utils.log import getActionLogger
|
||||
|
||||
from yunohost.app import _is_installed, _get_app_settings, _set_app_settings, _patch_legacy_php_versions_in_settings
|
||||
from yunohost.app import _is_installed, _patch_legacy_php_versions_in_settings
|
||||
from yunohost.tools import Migration
|
||||
from yunohost.service import _run_service_command
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ class MyMigration(Migration):
|
|||
# Make sure there's a 9.6 cluster
|
||||
try:
|
||||
self.runcmd("pg_lsclusters | grep -q '^9.6 '")
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
logger.warning("It looks like there's not active 9.6 cluster, so probably don't need to run this migration")
|
||||
return
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
Manage firewall rules
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
import yaml
|
||||
import miniupnpc
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@ import random
|
|||
from moulinette import m18n
|
||||
from moulinette.utils.log import getActionLogger
|
||||
from yunohost.utils.error import YunohostError
|
||||
from yunohost.user import user_list
|
||||
from yunohost.log import is_unit_operation
|
||||
|
||||
logger = getActionLogger('yunohost.user')
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
import os
|
||||
import yaml
|
||||
import json
|
||||
import subprocess
|
||||
import shutil
|
||||
import hashlib
|
||||
|
@ -31,7 +30,6 @@ from datetime import datetime
|
|||
|
||||
from moulinette import m18n
|
||||
from moulinette.utils import log, filesystem
|
||||
from moulinette.utils.filesystem import read_file
|
||||
|
||||
from yunohost.utils.error import YunohostError
|
||||
from yunohost.log import is_unit_operation
|
||||
|
|
|
@ -6,7 +6,7 @@ import glob
|
|||
import shutil
|
||||
|
||||
from moulinette import m18n
|
||||
from moulinette.utils.filesystem import read_json, write_to_json, write_to_yaml, mkdir
|
||||
from moulinette.utils.filesystem import read_json, write_to_json, write_to_yaml
|
||||
|
||||
from yunohost.utils.error import YunohostError
|
||||
from yunohost.app import (_initialize_apps_catalog_system,
|
||||
|
|
|
@ -4,7 +4,7 @@ import os
|
|||
|
||||
from conftest import message, raiseYunohostError, get_test_apps_dir
|
||||
|
||||
from yunohost.app import app_install, app_remove, app_change_url, app_list, app_map, _installed_apps
|
||||
from yunohost.app import app_install, app_remove, app_change_url, app_map, _installed_apps
|
||||
from yunohost.user import user_list, user_create, user_delete, \
|
||||
user_group_list, user_group_delete
|
||||
from yunohost.permission import user_permission_update, user_permission_list, user_permission_reset, \
|
||||
|
@ -370,16 +370,6 @@ def test_permission_reset_idempotency():
|
|||
assert set(res['blog.main']['corresponding_users']) == set(["alice", "bob"])
|
||||
|
||||
|
||||
def test_permission_reset_idempotency():
|
||||
# Reset permission
|
||||
user_permission_reset("blog.main")
|
||||
user_permission_reset("blog.main")
|
||||
|
||||
res = user_permission_list(full=True)['permissions']
|
||||
assert res['blog.main']['allowed'] == ["all_users"]
|
||||
assert set(res['blog.main']['corresponding_users']) == set(["alice", "bob"])
|
||||
|
||||
|
||||
#
|
||||
# Error on update function
|
||||
#
|
||||
|
|
|
@ -64,10 +64,10 @@ def test_settings_list():
|
|||
|
||||
def test_settings_set():
|
||||
settings_set("example.bool", False)
|
||||
assert settings_get("example.bool") == False
|
||||
assert settings_get("example.bool") is False
|
||||
|
||||
settings_set("example.bool", "on")
|
||||
assert settings_get("example.bool") == True
|
||||
assert settings_get("example.bool") is True
|
||||
|
||||
def test_settings_set_int():
|
||||
settings_set("example.int", 21)
|
||||
|
|
|
@ -26,10 +26,8 @@
|
|||
import re
|
||||
import os
|
||||
import yaml
|
||||
import json
|
||||
import subprocess
|
||||
import pwd
|
||||
import socket
|
||||
from importlib import import_module
|
||||
|
||||
from moulinette import msignals, m18n
|
||||
|
@ -37,8 +35,8 @@ from moulinette.utils.log import getActionLogger
|
|||
from moulinette.utils.process import check_output, call_async_output
|
||||
from moulinette.utils.filesystem import read_json, write_to_json, read_yaml, write_to_yaml
|
||||
|
||||
from yunohost.app import _update_apps_catalog, app_info, app_upgrade, app_ssowatconf, app_list, _initialize_apps_catalog_system
|
||||
from yunohost.domain import domain_add, domain_list
|
||||
from yunohost.app import _update_apps_catalog, app_info, app_upgrade, _initialize_apps_catalog_system
|
||||
from yunohost.domain import domain_add
|
||||
from yunohost.dyndns import _dyndns_available, _dyndns_provides
|
||||
from yunohost.firewall import firewall_upnp
|
||||
from yunohost.service import service_start, service_enable
|
||||
|
@ -118,7 +116,7 @@ def tools_ldapinit():
|
|||
if not os.path.isdir('/home/{0}'.format("admin")):
|
||||
logger.warning(m18n.n('user_home_creation_failed'),
|
||||
exc_info=1)
|
||||
|
||||
|
||||
logger.success(m18n.n('ldap_initialized'))
|
||||
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ import os
|
|||
import re
|
||||
import pwd
|
||||
import grp
|
||||
import json
|
||||
import crypt
|
||||
import random
|
||||
import string
|
||||
|
@ -36,7 +35,6 @@ import copy
|
|||
|
||||
from moulinette import m18n
|
||||
from moulinette.utils.log import getActionLogger
|
||||
from moulinette.utils.filesystem import read_json, write_to_json, read_yaml, write_to_yaml
|
||||
|
||||
from yunohost.utils.error import YunohostError
|
||||
from yunohost.service import service_status
|
||||
|
@ -239,7 +237,6 @@ def user_delete(operation_logger, username, purge=False):
|
|||
"""
|
||||
from yunohost.hook import hook_callback
|
||||
from yunohost.utils.ldap import _get_ldap_interface
|
||||
from yunohost.permission import permission_sync_to_user
|
||||
|
||||
if username not in user_list()["users"]:
|
||||
raise YunohostError('user_unknown', user=username)
|
||||
|
|
|
@ -63,7 +63,7 @@ class PasswordValidator(object):
|
|||
settings = json.load(open('/etc/yunohost/settings.json', "r"))
|
||||
setting_key = "security.password." + profile + ".strength"
|
||||
self.validation_strength = int(settings[setting_key]["value"])
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
# Fallback to default value if we can't fetch settings for some reason
|
||||
self.validation_strength = 1
|
||||
|
||||
|
@ -83,11 +83,7 @@ class PasswordValidator(object):
|
|||
# on top (at least not the moulinette ones)
|
||||
# because the moulinette needs to be correctly initialized
|
||||
# as well as modules available in python's path.
|
||||
import logging
|
||||
from yunohost.utils.error import YunohostError
|
||||
from moulinette.utils.log import getActionLogger
|
||||
|
||||
logger = logging.getLogger('yunohost.utils.password')
|
||||
|
||||
status, msg = self.validation_summary(password)
|
||||
if status == "error":
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import re
|
||||
import json
|
||||
import glob
|
||||
from collections import OrderedDict
|
||||
|
|
Loading…
Add table
Reference in a new issue