From eb2acd7b5973d3fd7cc836a6ba483adea81c0399 Mon Sep 17 00:00:00 2001 From: Florian Best Date: Sun, 18 Feb 2024 12:55:56 +0100 Subject: [PATCH] style(python): ignore PLW1501,E721,S413,PLE0704,RUF025,PLR0916,PERF403,PLW0604,PLR1733,S410,PLW3201,PLW0108,S403,S405,PLW1641 Bug #31771 --- base/univention-bootsplash/sprites/create_animation.py | 2 +- .../python/univention/config_registry/backend.py | 2 +- .../python/univention/config_registry/handler.py | 2 +- .../python/univention/info_tools.py | 2 +- base/univention-config-registry/tests/test_ucr.py | 4 ++-- base/univention-debug-python/python/univention/debug2.py | 2 +- .../umc/python/setup/netconf/__init__.py | 2 +- base/univention-system-setup/umc/python/setup/network.py | 2 +- base/univention-system-setup/umc/python/setup/util.py | 2 +- .../univention-updater/modules/univention/updater/repo_url.py | 2 +- base/univention-updater/modules/univention/updater/tools.py | 4 ++-- base/univention-updater/tests/test_upgrade.py | 2 +- .../modules/univention/mail/dovecot_shared_folder.py | 2 +- .../univention-appcenter/conffiles/create_portal_entries.py | 2 +- management/univention-appcenter/python/appcenter/app.py | 2 +- management/univention-appcenter/python/appcenter/ucr.py | 2 +- management/univention-appcenter/unittests/conftest.py | 2 +- .../modules/univention/admin/__init__.py | 2 +- .../modules/univention/admin/filter.py | 4 ++-- .../univention/admin/handlers/settings/extended_attribute.py | 2 +- .../univention/admin/handlers/settings/extended_options.py | 2 +- .../modules/univention/admin/syntax.py | 2 +- .../modules/univention/admin/uldap.py | 2 +- .../modules/univention/admincli/admin.py | 2 +- .../src/univention/admin/rest/html_ui.py | 2 +- .../src/univention/admin/rest/module.py | 4 ++-- .../conffiles/var/www/univention/meta.json | 2 +- .../scripts/univention-management-console-acls | 2 +- .../src/univention/management/console/acl.py | 4 ++-- .../src/univention/management/console/category.py | 2 +- .../src/univention/management/console/module.py | 2 +- .../src/univention/management/console/resource.py | 2 +- .../usr/lib/nagios/plugins/check_univention_replication | 2 +- .../univention-l10n/univention/l10n/sourcefileprocessing.py | 2 +- packaging/univention-l10n/univention/l10n/umc.py | 2 +- .../listener/univention-saml-simplesamlphp-configuration.py | 2 +- .../modules/univention/connector/ad/__init__.py | 2 +- .../modules/univention/connector/ad/password.py | 2 +- services/univention-admin-diary/admindiary_backend_wrapper.py | 2 +- services/univention-radius/listener/univention-radius.py | 2 +- test/ucs-gui-tests/installation/vminstall/virtual_machine.py | 2 +- test/ucs-test/tests/03_ucr/71ucr_multiple_register.py | 2 +- test/ucs-test/tests/12_quota/quota_cache.py | 2 +- test/ucs-test/tests/20_appcenter/100_settings.py | 4 ++-- test/ucs-test/tests/20_appcenter/75_umc_query_app_data.py | 2 +- test/ucs-test/tests/20_appcenter/90_update_check.py | 2 +- .../ucs-test/tests/21_appcenter-uninstall/25_app_uninstall.py | 2 +- ...3_dovecot_shared_folder_add_remove_mail_primary_address.py | 2 +- .../43_dovecot_shared_folder_change_primary_mailaddress.py | 2 +- .../43_dovecot_shared_folder_create_folder_with_acls.py | 2 +- .../43_dovecot_shared_folder_create_subfolder_with_acls.py | 2 +- test/ucs-test/tests/43_proxy/essential/simplecurl.py | 2 +- test/ucs-test/tests/51_samba4/56evaluate_windows_gpo.py | 2 +- test/ucs-test/tests/82_saml/samltest.py | 2 +- test/ucs-test/univention/testing/browser/lib.py | 2 +- test/ucs-test/univention/testing/internal.py | 2 +- test/utils/ucsschool_id_connector.py | 2 +- 57 files changed, 63 insertions(+), 63 deletions(-) diff --git a/base/univention-bootsplash/sprites/create_animation.py b/base/univention-bootsplash/sprites/create_animation.py index 409ad63069..8371bc6656 100755 --- a/base/univention-bootsplash/sprites/create_animation.py +++ b/base/univention-bootsplash/sprites/create_animation.py @@ -34,7 +34,7 @@ import math import os import subprocess -import xml.etree.ElementTree as ET +import xml.etree.ElementTree as ET # noqa: S405 STEPS = 48 diff --git a/base/univention-config-registry/python/univention/config_registry/backend.py b/base/univention-config-registry/python/univention/config_registry/backend.py index d412650d43..fca37a2178 100644 --- a/base/univention-config-registry/python/univention/config_registry/backend.py +++ b/base/univention-config-registry/python/univention/config_registry/backend.py @@ -757,7 +757,7 @@ class _ConfigRegistry(dict): for key, val in sorted(self.items()) ) - def __unicode__(self): + def __unicode__(self): # noqa: PLW3201 data = self.__str__() if isinstance(data, bytes): data = data.decode('UTF-8') diff --git a/base/univention-config-registry/python/univention/config_registry/handler.py b/base/univention-config-registry/python/univention/config_registry/handler.py index d6c2ef6316..484692649d 100644 --- a/base/univention-config-registry/python/univention/config_registry/handler.py +++ b/base/univention-config-registry/python/univention/config_registry/handler.py @@ -42,7 +42,7 @@ from __future__ import print_function import errno import os -import pickle +import pickle # noqa: S403 import random import re import subprocess diff --git a/base/univention-config-registry/python/univention/info_tools.py b/base/univention-config-registry/python/univention/info_tools.py index 05448bdf24..5e98000046 100644 --- a/base/univention-config-registry/python/univention/info_tools.py +++ b/base/univention-config-registry/python/univention/info_tools.py @@ -99,7 +99,7 @@ else: __LD = dict -class LocalizedDictionary(__LD): +class LocalizedDictionary(__LD): # noqa: PLW1641 """Localized descriptions.""" _LOCALE_REGEX = re.compile(r'(?P[a-zA-Z]*)\[(?P[a-z]*)\]$') diff --git a/base/univention-config-registry/tests/test_ucr.py b/base/univention-config-registry/tests/test_ucr.py index 7db1311279..2428e64d80 100644 --- a/base/univention-config-registry/tests/test_ucr.py +++ b/base/univention-config-registry/tests/test_ucr.py @@ -33,10 +33,10 @@ def test_ro(ucrf): @pytest.mark.parametrize("autoload,before,after", [ - pytest.param(lambda: UCR.ConfigRegistry(), None, None, id="Manual"), + pytest.param(lambda: UCR.ConfigRegistry(), None, None, id="Manual"), # noqa: PLW0108 pytest.param(lambda: UCR.ucr, "BEFORE", "BEFORE", id="Once"), pytest.param(lambda: UCR.ucr_live, "BEFORE", "AFTER", id="Always"), - pytest.param(lambda: UCR.ucr_live.__enter__(), "BEFORE", "BEFORE", id="View"), + pytest.param(lambda: UCR.ucr_live.__enter__(), "BEFORE", "BEFORE", id="View"), # noqa: PLW0108 ]) def test_autoload(autoload, before, after, ucr0): reload(UCR) diff --git a/base/univention-debug-python/python/univention/debug2.py b/base/univention-debug-python/python/univention/debug2.py index c799207357..5b254aca43 100644 --- a/base/univention-debug-python/python/univention/debug2.py +++ b/base/univention-debug-python/python/univention/debug2.py @@ -140,7 +140,7 @@ _handler_syslog = None _do_flush = False _enable_function = False _enable_syslog = False -_logger_level = {key: DEFAULT for key in _map_id_old2new.values()} +_logger_level = {key: DEFAULT for key in _map_id_old2new.values()} # noqa: RUF025 def init(logfile, force_flush=0, enable_function=0, enable_syslog=0): diff --git a/base/univention-system-setup/umc/python/setup/netconf/__init__.py b/base/univention-system-setup/umc/python/setup/netconf/__init__.py index 0c2223f621..c52d8db18b 100644 --- a/base/univention-system-setup/umc/python/setup/netconf/__init__.py +++ b/base/univention-system-setup/umc/python/setup/netconf/__init__.py @@ -98,7 +98,7 @@ class SkipPhase(Exception): pass -class Phase: +class Phase: # noqa: PLW1641 """Base-class for all phases.""" priority = 0 diff --git a/base/univention-system-setup/umc/python/setup/network.py b/base/univention-system-setup/umc/python/setup/network.py index ef9192c634..77c32b336a 100644 --- a/base/univention-system-setup/umc/python/setup/network.py +++ b/base/univention-system-setup/umc/python/setup/network.py @@ -455,7 +455,7 @@ class Device(object): vals: Dict[str, str | None] = {key: None for key in ucr if pattern.match(key)} for key, val in self._leftover: - vals[key] = val + vals[key] = val # noqa: PERF403 if self.start is not None: vals['interfaces/%s/start' % (name)] = str(bool(self.start)).lower() diff --git a/base/univention-system-setup/umc/python/setup/util.py b/base/univention-system-setup/umc/python/setup/util.py index af4d705e57..27553272f5 100644 --- a/base/univention-system-setup/umc/python/setup/util.py +++ b/base/univention-system-setup/umc/python/setup/util.py @@ -344,7 +344,7 @@ def written_profile(values: Dict[str, str]) -> Iterator[None]: os.remove(PATH_PROFILE) -class ProgressState(object): +class ProgressState(object): # noqa: PLW1641 def __init__(self) -> None: self.reset() diff --git a/base/univention-updater/modules/univention/updater/repo_url.py b/base/univention-updater/modules/univention/updater/repo_url.py index 616d18c15e..650ef683f8 100644 --- a/base/univention-updater/modules/univention/updater/repo_url.py +++ b/base/univention-updater/modules/univention/updater/repo_url.py @@ -45,7 +45,7 @@ except ImportError: from six.moves.urllib_parse import quote, urlsplit -class UcsRepoUrl(object): +class UcsRepoUrl(object): # noqa: PLW1641 """UCS repository server base URL.""" DEFAULT = 'https://updates.software-univention.de/' diff --git a/base/univention-updater/modules/univention/updater/tools.py b/base/univention-updater/modules/univention/updater/tools.py index f9447d9c0b..1da38c8675 100644 --- a/base/univention-updater/modules/univention/updater/tools.py +++ b/base/univention-updater/modules/univention/updater/tools.py @@ -126,7 +126,7 @@ def verify_script(script, signature): return stdout if ret != 0 else None -class _UCSRepo(UCS_Version): +class _UCSRepo(UCS_Version): # noqa: PLW1641 """Super class to build URLs for APT repositories.""" ARCHS = {'all', 'amd64'} @@ -423,7 +423,7 @@ class UCSRepoPoolNoArch(_UCSRepo): return "clean %s%s" % (server, super(UCSRepoPoolNoArch, self)._format(fmt)) -class _UCSServer(object): +class _UCSServer(object): # noqa: PLW1641 """Abstrace base class to access UCS compatible update server.""" @classmethod diff --git a/base/univention-updater/tests/test_upgrade.py b/base/univention-updater/tests/test_upgrade.py index 6cf72be749..651ecc768f 100644 --- a/base/univention-updater/tests/test_upgrade.py +++ b/base/univention-updater/tests/test_upgrade.py @@ -27,7 +27,7 @@ def test_parse_args_rejects_invalid_update_to_bug49061(mocker): with pytest.raises(SystemExit) as pytest_wrapped_e: mocker.patch('sys.argv', ['/usr/sbin/univention-upgrade', '--updateto=4.0.0']) parse_args() - assert pytest_wrapped_e.type == SystemExit + assert pytest_wrapped_e.type == SystemExit # noqa: E721 assert pytest_wrapped_e.value.code == 1 diff --git a/mail/univention-mail-dovecot/modules/univention/mail/dovecot_shared_folder.py b/mail/univention-mail-dovecot/modules/univention/mail/dovecot_shared_folder.py index 8a38ec6371..f9780a5ecb 100644 --- a/mail/univention-mail-dovecot/modules/univention/mail/dovecot_shared_folder.py +++ b/mail/univention-mail-dovecot/modules/univention/mail/dovecot_shared_folder.py @@ -69,7 +69,7 @@ glocal_acl_pattern1 = re.compile(r'(?P[^ ]+) "(?P.+)" (?P\w+)') glocal_acl_pattern2 = re.compile(r'(?P[^ ]+) (?P.+) (?P\w+)') -class DovecotFolderAclEntry(object): +class DovecotFolderAclEntry(object): # noqa: PLW1641 def __init__(self, folder_name, identifier, acl): # type: (str, str, str) -> None self.folder_name = folder_name self.identifier = identifier diff --git a/management/univention-appcenter/conffiles/create_portal_entries.py b/management/univention-appcenter/conffiles/create_portal_entries.py index 89bfedb429..bcc56f3a23 100644 --- a/management/univention-appcenter/conffiles/create_portal_entries.py +++ b/management/univention-appcenter/conffiles/create_portal_entries.py @@ -73,7 +73,7 @@ class _Link(object): port = '' return '%s://%s%s%s' % (self.protocol, self.host, port, self.path) - def __nonzero__(self): + def __nonzero__(self): # noqa: PLW3201 return str(self) != '' __bool__ = __nonzero__ diff --git a/management/univention-appcenter/python/appcenter/app.py b/management/univention-appcenter/python/appcenter/app.py index 20c3a716c9..41568df40e 100644 --- a/management/univention-appcenter/python/appcenter/app.py +++ b/management/univention-appcenter/python/appcenter/app.py @@ -485,7 +485,7 @@ class AppMetaClass(UniventionMetaClass): return new_cls -class App(with_metaclass(AppMetaClass, object)): +class App(with_metaclass(AppMetaClass, object)): # noqa: PLW1641 """ This is the main App class. It represents *one version* of the App in the Univention App Center. It is mainly a container for a parsed ini diff --git a/management/univention-appcenter/python/appcenter/ucr.py b/management/univention-appcenter/python/appcenter/ucr.py index 51def711a4..7a5ffc09d7 100644 --- a/management/univention-appcenter/python/appcenter/ucr.py +++ b/management/univention-appcenter/python/appcenter/ucr.py @@ -61,7 +61,7 @@ def ucr_save(values): _UCR.load() for k, v in values.items(): if _UCR.get(k) != v: - changed_values[k] = v + changed_values[k] = v # noqa: PERF403 if changed_values: ucr_update(_UCR, changed_values) return changed_values diff --git a/management/univention-appcenter/unittests/conftest.py b/management/univention-appcenter/unittests/conftest.py index af8a8b034b..1e4ddffaaa 100644 --- a/management/univention-appcenter/unittests/conftest.py +++ b/management/univention-appcenter/unittests/conftest.py @@ -65,7 +65,7 @@ def mocked_ucr_appcenter(mock_ucr, mocker): changed_values = {} for k, v in values.items(): if mock_ucr.get(k) != v: - changed_values[k] = v + changed_values[k] = v # noqa: PERF403 if changed_values: mock_ucr.items.update(changed_values) return changed_values diff --git a/management/univention-directory-manager-modules/modules/univention/admin/__init__.py b/management/univention-directory-manager-modules/modules/univention/admin/__init__.py index b31bc923ec..721f6e94cd 100644 --- a/management/univention-directory-manager-modules/modules/univention/admin/__init__.py +++ b/management/univention-directory-manager-modules/modules/univention/admin/__init__.py @@ -543,7 +543,7 @@ if six.PY2: # deprecated, use layout.Tab instead if six.PY2: # deprecated, use layout.Group instead - class field: + class field: # noqa: PLW1641 """ >>> field('bar') < field('foo') True diff --git a/management/univention-directory-manager-modules/modules/univention/admin/filter.py b/management/univention-directory-manager-modules/modules/univention/admin/filter.py index 064df5f2e7..3ec83975d3 100644 --- a/management/univention-directory-manager-modules/modules/univention/admin/filter.py +++ b/management/univention-directory-manager-modules/modules/univention/admin/filter.py @@ -101,7 +101,7 @@ class conjunction(object): return '' return '(%s%s)' % (self.type, ''.join(map(six.text_type, self.expressions))) - def __unicode__(self): + def __unicode__(self): # noqa: PLW3201 # type: () -> str return self.__str__() @@ -198,7 +198,7 @@ class expression(object): self.__dict__.update(con.__dict__) self.__class__ = type(con) # type: ignore - def __unicode__(self): + def __unicode__(self): # noqa: PLW3201 # type: () -> str return self.__str__() diff --git a/management/univention-directory-manager-modules/modules/univention/admin/handlers/settings/extended_attribute.py b/management/univention-directory-manager-modules/modules/univention/admin/handlers/settings/extended_attribute.py index f30b590339..05754c02f4 100644 --- a/management/univention-directory-manager-modules/modules/univention/admin/handlers/settings/extended_attribute.py +++ b/management/univention-directory-manager-modules/modules/univention/admin/handlers/settings/extended_attribute.py @@ -392,7 +392,7 @@ class object(univention.admin.handlers.simpleLdap): # modlist for new items for lang, txt in oldlist.items(): if txt != newlist[lang]: - ml.append(('univentionUDMPropertyTranslation%s;entry-%s' % (transKey, lang), oldlist[lang], newlist[lang])) + ml.append(('univentionUDMPropertyTranslation%s;entry-%s' % (transKey, lang), oldlist[lang], newlist[lang])) # noqa: PLR1733 return ml diff --git a/management/univention-directory-manager-modules/modules/univention/admin/handlers/settings/extended_options.py b/management/univention-directory-manager-modules/modules/univention/admin/handlers/settings/extended_options.py index 43f65d1beb..efac58fe32 100644 --- a/management/univention-directory-manager-modules/modules/univention/admin/handlers/settings/extended_options.py +++ b/management/univention-directory-manager-modules/modules/univention/admin/handlers/settings/extended_options.py @@ -197,7 +197,7 @@ class object(univention.admin.handlers.simpleLdap): # modlist for new items for lang, txt in oldlist.items(): if txt != newlist[lang]: - ml.append(('univentionUDMOptionTranslation%s;entry-%s' % (transKey, lang), oldlist[lang], newlist[lang])) + ml.append(('univentionUDMOptionTranslation%s;entry-%s' % (transKey, lang), oldlist[lang], newlist[lang])) # noqa: PLR1733 return ml diff --git a/management/univention-directory-manager-modules/modules/univention/admin/syntax.py b/management/univention-directory-manager-modules/modules/univention/admin/syntax.py index 1f13b6f59e..640f22d73c 100644 --- a/management/univention-directory-manager-modules/modules/univention/admin/syntax.py +++ b/management/univention-directory-manager-modules/modules/univention/admin/syntax.py @@ -5520,7 +5520,7 @@ class SambaLogonHours(MultiSelect): from univention.admin.handlers.users.user import logonHoursUnmap value = logonHoursUnmap([value.encode('ASCII')]) else: - value = list(map(lambda x: int(x), shlex.split(value))) + value = list(map(lambda x: int(x), shlex.split(value))) # noqa: PLW0108 return super(SambaLogonHours, self).parse(value) diff --git a/management/univention-directory-manager-modules/modules/univention/admin/uldap.py b/management/univention-directory-manager-modules/modules/univention/admin/uldap.py index 120dea772b..89364ca3b9 100644 --- a/management/univention-directory-manager-modules/modules/univention/admin/uldap.py +++ b/management/univention-directory-manager-modules/modules/univention/admin/uldap.py @@ -69,7 +69,7 @@ class DN(object): def __str__(self): return ldap.dn.dn2str(self._dn) - def __unicode__(self): + def __unicode__(self): # noqa: PLW3201 return unicode(str(self)) # noqa: F821 def __repr__(self): diff --git a/management/univention-directory-manager-modules/modules/univention/admincli/admin.py b/management/univention-directory-manager-modules/modules/univention/admincli/admin.py index 4ed0fdd583..d63baf3b5d 100755 --- a/management/univention-directory-manager-modules/modules/univention/admincli/admin.py +++ b/management/univention-directory-manager-modules/modules/univention/admincli/admin.py @@ -797,7 +797,7 @@ class CLI(object): object.policy_reference(*policy_reference) object.policy_dereference(*policy_dereference) - if object.hasChanged(input.keys()) or object.hasChanged(append.keys()) or object.hasChanged(remove.keys()) or parsed_append_options or parsed_remove_options or parsed_options or object.policiesChanged(): + if object.hasChanged(input.keys()) or object.hasChanged(append.keys()) or object.hasChanged(remove.keys()) or parsed_append_options or parsed_remove_options or parsed_options or object.policiesChanged(): # noqa: PLR0916 try: dn = object.modify() object_modified += 1 diff --git a/management/univention-directory-manager-rest/src/univention/admin/rest/html_ui.py b/management/univention-directory-manager-rest/src/univention/admin/rest/html_ui.py index ec4bc01189..d73a522850 100644 --- a/management/univention-directory-manager-rest/src/univention/admin/rest/html_ui.py +++ b/management/univention-directory-manager-rest/src/univention/admin/rest/html_ui.py @@ -35,7 +35,7 @@ import json import re -import xml.etree.ElementTree as ET +import xml.etree.ElementTree as ET # noqa: S405 import defusedxml.minidom from genshi import XML diff --git a/management/univention-directory-manager-rest/src/univention/admin/rest/module.py b/management/univention-directory-manager-rest/src/univention/admin/rest/module.py index e7374fcb94..08f493b8f8 100755 --- a/management/univention-directory-manager-rest/src/univention/admin/rest/module.py +++ b/management/univention-directory-manager-rest/src/univention/admin/rest/module.py @@ -46,7 +46,7 @@ import os import re import traceback import uuid -import xml.etree.ElementTree as ET +import xml.etree.ElementTree as ET # noqa: S405 import zlib from http.client import responses from typing import Dict, List, Optional @@ -2687,7 +2687,7 @@ class PolicyResultBase(Resource): infos = copy.copy(policy_obj.polinfo_more) for key, _value in infos.items(): if key in policy_obj.polinfo: - if isinstance(infos[key], (tuple, list)): + if isinstance(infos[key], (tuple, list)): # noqa: PLR1733 continue _value['value'] = policy_obj.polinfo[key] if policy_dn: diff --git a/management/univention-management-console/conffiles/var/www/univention/meta.json b/management/univention-management-console/conffiles/var/www/univention/meta.json index c7a86dead4..3d4d907da8 100644 --- a/management/univention-management-console/conffiles/var/www/univention/meta.json +++ b/management/univention-management-console/conffiles/var/www/univention/meta.json @@ -221,7 +221,7 @@ ucr_vars = [ for i in ucr_vars: for key, value in get_ucr_entry(*i): - data[key] = value + data[key] = value # noqa: PERF403 print(json.dumps(data, indent=2, sort_keys=True)) @!@ diff --git a/management/univention-management-console/scripts/univention-management-console-acls b/management/univention-management-console/scripts/univention-management-console-acls index ca0fcb1389..3c3c80f53c 100755 --- a/management/univention-management-console/scripts/univention-management-console-acls +++ b/management/univention-management-console/scripts/univention-management-console-acls @@ -38,7 +38,7 @@ from __future__ import print_function import json import os -import pickle +import pickle # noqa: S403 import sys from argparse import ArgumentParser diff --git a/management/univention-management-console/src/univention/management/console/acl.py b/management/univention-management-console/src/univention/management/console/acl.py index ece7735eda..ea95ebbba8 100644 --- a/management/univention-management-console/src/univention/management/console/acl.py +++ b/management/univention-management-console/src/univention/management/console/acl.py @@ -71,7 +71,7 @@ import itertools import json import operator import os -import pickle +import pickle # noqa: S403 import traceback from fnmatch import fnmatch @@ -89,7 +89,7 @@ from .config import ucr from .log import ACL -class Rule(dict): +class Rule(dict): # noqa: PLW1641 """ A simple class representing one ACL rule in a form that can be simply serialized. diff --git a/management/univention-management-console/src/univention/management/console/category.py b/management/univention-management-console/src/univention/management/console/category.py index 569b61f9fa..a40113aa5b 100644 --- a/management/univention-management-console/src/univention/management/console/category.py +++ b/management/univention-management-console/src/univention/management/console/category.py @@ -70,7 +70,7 @@ must be given in curly braces {VARIABLE}. import os import sys -import xml.etree.cElementTree as ET +import xml.etree.cElementTree as ET # noqa: S405 import xml.parsers.expat from .log import RESOURCES diff --git a/management/univention-management-console/src/univention/management/console/module.py b/management/univention-management-console/src/univention/management/console/module.py index e532bf459d..a6a12b7c69 100644 --- a/management/univention-management-console/src/univention/management/console/module.py +++ b/management/univention-management-console/src/univention/management/console/module.py @@ -124,7 +124,7 @@ import copy import os import re import sys -import xml.etree.cElementTree as ET +import xml.etree.cElementTree as ET # noqa: S405 import xml.parsers.expat from .config import ucr diff --git a/management/univention-management-console/src/univention/management/console/resource.py b/management/univention-management-console/src/univention/management/console/resource.py index ce51ae29e7..c1cdb3ac17 100644 --- a/management/univention-management-console/src/univention/management/console/resource.py +++ b/management/univention-management-console/src/univention/management/console/resource.py @@ -110,7 +110,7 @@ class Resource(RequestHandler): def get_current_user(self): session = Session.get_or_create(self.get_session_id()) # FIXME: this creates a Session instance even if the session does not exists - session._ = lambda *args: self._(*args) # hack to prevent circular use, when "_" is not yet set but only in prepare() + session._ = lambda *args: self._(*args) # hack to prevent circular use, when "_" is not yet set but only in prepare() # noqa: PLW0108 if not session.user.ip: session.user.ip = self.get_ip_address() return session diff --git a/monitoring/univention-nagios/usr/lib/nagios/plugins/check_univention_replication b/monitoring/univention-nagios/usr/lib/nagios/plugins/check_univention_replication index 75345c93cf..f7f216bab8 100755 --- a/monitoring/univention-nagios/usr/lib/nagios/plugins/check_univention_replication +++ b/monitoring/univention-nagios/usr/lib/nagios/plugins/check_univention_replication @@ -35,7 +35,7 @@ import getopt import os -import pickle +import pickle # noqa: S403 import subprocess import sys diff --git a/packaging/univention-l10n/univention/l10n/sourcefileprocessing.py b/packaging/univention-l10n/univention/l10n/sourcefileprocessing.py index f0ad180b9c..556935fc49 100644 --- a/packaging/univention-l10n/univention/l10n/sourcefileprocessing.py +++ b/packaging/univention-l10n/univention/l10n/sourcefileprocessing.py @@ -39,7 +39,7 @@ from __future__ import absolute_import import os import polib -from lxml import etree +from lxml import etree # noqa: S410 from . import message_catalogs, umc diff --git a/packaging/univention-l10n/univention/l10n/umc.py b/packaging/univention-l10n/univention/l10n/umc.py index 11e710036e..239414bad1 100644 --- a/packaging/univention-l10n/univention/l10n/umc.py +++ b/packaging/univention-l10n/univention/l10n/umc.py @@ -64,7 +64,7 @@ import re import subprocess import sys import warnings -import xml.etree.ElementTree as ET +import xml.etree.ElementTree as ET # noqa: S405 from email.utils import formatdate import polib diff --git a/saml/univention-saml/listener/univention-saml-simplesamlphp-configuration.py b/saml/univention-saml/listener/univention-saml-simplesamlphp-configuration.py index abc62a163a..398e3c2073 100644 --- a/saml/univention-saml/listener/univention-saml-simplesamlphp-configuration.py +++ b/saml/univention-saml/listener/univention-saml-simplesamlphp-configuration.py @@ -38,7 +38,7 @@ from __future__ import absolute_import, annotations import glob import os import os.path -import xml.etree.ElementTree +import xml.etree.ElementTree # noqa: S405 from subprocess import PIPE, Popen from tempfile import NamedTemporaryFile from typing import Dict, List, Tuple diff --git a/services/univention-ad-connector/modules/univention/connector/ad/__init__.py b/services/univention-ad-connector/modules/univention/connector/ad/__init__.py index 93bed59357..12f9b3521a 100644 --- a/services/univention-ad-connector/modules/univention/connector/ad/__init__.py +++ b/services/univention-ad-connector/modules/univention/connector/ad/__init__.py @@ -1615,7 +1615,7 @@ class ad(univention.connector.ucs): ud.debug(ud.LDAP, ud.INFO, "group_members_sync_to_ucs: members to add: %s" % add_members) ud.debug(ud.LDAP, ud.INFO, "group_members_sync_to_ucs: members to del: %s" % del_members) - if add_members['user'] or add_members['group'] or del_members['user'] or del_members['group'] or add_members['unknown'] or add_members['windowscomputer'] or del_members['windowscomputer']: + if add_members['user'] or add_members['group'] or del_members['user'] or del_members['group'] or add_members['unknown'] or add_members['windowscomputer'] or del_members['windowscomputer']: # noqa: PLR0916 ucs_admin_object = univention.admin.objects.get(self.modules[object_key], co='', lo=self.lo, position='', dn=object['dn']) ucs_admin_object.open() diff --git a/services/univention-ad-connector/modules/univention/connector/ad/password.py b/services/univention-ad-connector/modules/univention/connector/ad/password.py index 33711cb2ce..6830c04591 100644 --- a/services/univention-ad-connector/modules/univention/connector/ad/password.py +++ b/services/univention-ad-connector/modules/univention/connector/ad/password.py @@ -45,7 +45,7 @@ import Crypto import heimdal import ldap import samba.dcerpc.samr -from Crypto.Cipher import ARC4, DES +from Crypto.Cipher import ARC4, DES # noqa: S413 from samba import NTSTATUSError from samba.dcerpc import drsblobs, drsuapi, lsa, misc, security from samba.ndr import ndr_unpack diff --git a/services/univention-admin-diary/admindiary_backend_wrapper.py b/services/univention-admin-diary/admindiary_backend_wrapper.py index a2a87a18eb..92acbbb01a 100755 --- a/services/univention-admin-diary/admindiary_backend_wrapper.py +++ b/services/univention-admin-diary/admindiary_backend_wrapper.py @@ -72,7 +72,7 @@ class RsyslogTransport(object): # message payload = Regex(".*") - payload.setParseAction(lambda t: "".join(t)) # json parsing happens in Event class + payload.setParseAction(lambda t: "".join(t)) # json parsing happens in Event class # noqa: PLW0108 self._pattern = timestamp("source_datetime") + hostname("source_hostname") + syslogtag + payload("serialized_event_dict") diff --git a/services/univention-radius/listener/univention-radius.py b/services/univention-radius/listener/univention-radius.py index 464da5181b..2df869ec2a 100755 --- a/services/univention-radius/listener/univention-radius.py +++ b/services/univention-radius/listener/univention-radius.py @@ -62,7 +62,7 @@ class AppListener(ListenerModuleHandler): if old_dn: self.run_update = True self.logger.info('config update triggered (move)') - elif (b'univentionRadiusClient' in old.get('objectClass', []) or b'univentionRadiusClient' in new.get('objectClass', [])) and ( + elif (b'univentionRadiusClient' in old.get('objectClass', []) or b'univentionRadiusClient' in new.get('objectClass', [])) and ( # noqa: PLR0916 set(old.get('univentionRadiusClientSharedSecret', [])) != set(new.get('univentionRadiusClientSharedSecret', [])) or set(old.get('univentionRadiusClientType', [])) != set(new.get('univentionRadiusClientType', [])) or set(old.get('univentionRadiusClientVirtualServer', [])) != set(new.get('univentionRadiusClientVirtualServer', [])) diff --git a/test/ucs-gui-tests/installation/vminstall/virtual_machine.py b/test/ucs-gui-tests/installation/vminstall/virtual_machine.py index ea5dc0b252..baac0d699c 100644 --- a/test/ucs-gui-tests/installation/vminstall/virtual_machine.py +++ b/test/ucs-gui-tests/installation/vminstall/virtual_machine.py @@ -44,7 +44,7 @@ from os.path import exists, extsep, join, split, splitext from sys import exit, stderr import libvirt -from lxml import etree +from lxml import etree # noqa: S410 from lxml.builder import E from urlparse import urlparse diff --git a/test/ucs-test/tests/03_ucr/71ucr_multiple_register.py b/test/ucs-test/tests/03_ucr/71ucr_multiple_register.py index 55929088db..177ceff181 100755 --- a/test/ucs-test/tests/03_ucr/71ucr_multiple_register.py +++ b/test/ucs-test/tests/03_ucr/71ucr_multiple_register.py @@ -5,7 +5,7 @@ ## - univention-base-files ## exposure: dangerous -import pickle +import pickle # noqa: S403 import sys import univention.config_registry.handler as ucrh diff --git a/test/ucs-test/tests/12_quota/quota_cache.py b/test/ucs-test/tests/12_quota/quota_cache.py index ec3331ebf1..ec498d2f15 100644 --- a/test/ucs-test/tests/12_quota/quota_cache.py +++ b/test/ucs-test/tests/12_quota/quota_cache.py @@ -1,5 +1,5 @@ import os -import pickle +import pickle # noqa: S403 import time from univention.testing import utils diff --git a/test/ucs-test/tests/20_appcenter/100_settings.py b/test/ucs-test/tests/20_appcenter/100_settings.py index 3f45828023..4401f61de8 100755 --- a/test/ucs-test/tests/20_appcenter/100_settings.py +++ b/test/ucs-test/tests/20_appcenter/100_settings.py @@ -48,13 +48,13 @@ class Configuring: def __exit__(self, exc_type, exc_val, exc_tb): if self.revert == 'configure': - config = {key: None for key in self.settings} + config = {key: None for key in self.settings} # noqa: RUF025 configure = get_action('configure') configure.call(app=self.app, set_vars=config, run_script='no') for setting in self.settings: assert ucr_get(setting) is None elif self.revert == 'ucr': - config = {key: None for key in self.settings} + config = {key: None for key in self.settings} # noqa: RUF025 ucr_save(config) diff --git a/test/ucs-test/tests/20_appcenter/75_umc_query_app_data.py b/test/ucs-test/tests/20_appcenter/75_umc_query_app_data.py index a380fcc181..976f2f1d45 100755 --- a/test/ucs-test/tests/20_appcenter/75_umc_query_app_data.py +++ b/test/ucs-test/tests/20_appcenter/75_umc_query_app_data.py @@ -70,7 +70,7 @@ def test_ini_data(umc_data, lang): 'description': 'Test App [%s]' % lang, } for ikey, ival in expected_data.items(): - expected_val = expected_data[ikey] + expected_val = expected_data[ikey] # noqa: PLR1733 assert umc_data[ikey] == ival, f'Entry {ikey}={ival} does not match expected value {expected_val}!' print('SUCCESS') diff --git a/test/ucs-test/tests/20_appcenter/90_update_check.py b/test/ucs-test/tests/20_appcenter/90_update_check.py index 180571b3d6..d38cd7c8b0 100755 --- a/test/ucs-test/tests/20_appcenter/90_update_check.py +++ b/test/ucs-test/tests/20_appcenter/90_update_check.py @@ -14,7 +14,7 @@ from univention.appcenter.actions import get_action def mock_ucr_get(var): if var == 'version/version': return '4.4' - raise + raise # noqa: PLE0704 # new app cache diff --git a/test/ucs-test/tests/21_appcenter-uninstall/25_app_uninstall.py b/test/ucs-test/tests/21_appcenter-uninstall/25_app_uninstall.py index d90e2c1065..e1f80f45b4 100755 --- a/test/ucs-test/tests/21_appcenter-uninstall/25_app_uninstall.py +++ b/test/ucs-test/tests/21_appcenter-uninstall/25_app_uninstall.py @@ -68,7 +68,7 @@ def check_webinterface(app): def _check_url(url): print(' Checking', url) - import lxml + import lxml # noqa: S410 import requests requests_timeout = 30 r = requests.get(url, timeout=requests_timeout, verify=False) # noqa: S501 diff --git a/test/ucs-test/tests/40_mail/43_dovecot_shared_folder_add_remove_mail_primary_address.py b/test/ucs-test/tests/40_mail/43_dovecot_shared_folder_add_remove_mail_primary_address.py index c76cc769df..83fc5c5b31 100755 --- a/test/ucs-test/tests/40_mail/43_dovecot_shared_folder_add_remove_mail_primary_address.py +++ b/test/ucs-test/tests/40_mail/43_dovecot_shared_folder_add_remove_mail_primary_address.py @@ -88,6 +88,6 @@ def main(): if __name__ == '__main__': - global timeout + global timeout # noqa: PLW0604 timeout = 1 main() diff --git a/test/ucs-test/tests/40_mail/43_dovecot_shared_folder_change_primary_mailaddress.py b/test/ucs-test/tests/40_mail/43_dovecot_shared_folder_change_primary_mailaddress.py index 5c812ac363..5b136bbc40 100755 --- a/test/ucs-test/tests/40_mail/43_dovecot_shared_folder_change_primary_mailaddress.py +++ b/test/ucs-test/tests/40_mail/43_dovecot_shared_folder_change_primary_mailaddress.py @@ -140,6 +140,6 @@ def main(): if __name__ == '__main__': - global timeout + global timeout # noqa: PLW0604 timeout = 1 main() diff --git a/test/ucs-test/tests/40_mail/43_dovecot_shared_folder_create_folder_with_acls.py b/test/ucs-test/tests/40_mail/43_dovecot_shared_folder_create_folder_with_acls.py index 6f4175eace..640244d7a1 100755 --- a/test/ucs-test/tests/40_mail/43_dovecot_shared_folder_create_folder_with_acls.py +++ b/test/ucs-test/tests/40_mail/43_dovecot_shared_folder_create_folder_with_acls.py @@ -85,6 +85,6 @@ def main() -> None: if __name__ == '__main__': - global timeout + global timeout # noqa: PLW0604 timeout = 1 main() diff --git a/test/ucs-test/tests/40_mail/43_dovecot_shared_folder_create_subfolder_with_acls.py b/test/ucs-test/tests/40_mail/43_dovecot_shared_folder_create_subfolder_with_acls.py index d3fe5503b7..14e543f036 100755 --- a/test/ucs-test/tests/40_mail/43_dovecot_shared_folder_create_subfolder_with_acls.py +++ b/test/ucs-test/tests/40_mail/43_dovecot_shared_folder_create_subfolder_with_acls.py @@ -135,6 +135,6 @@ def main(): if __name__ == '__main__': - global timeout + global timeout # noqa: PLW0604 timeout = 1 main() diff --git a/test/ucs-test/tests/43_proxy/essential/simplecurl.py b/test/ucs-test/tests/43_proxy/essential/simplecurl.py index 5307932821..a6d45a287c 100644 --- a/test/ucs-test/tests/43_proxy/essential/simplecurl.py +++ b/test/ucs-test/tests/43_proxy/essential/simplecurl.py @@ -108,7 +108,7 @@ class SimpleCurl: time.sleep(1) else: print('Requested page could not be fetched') - raise + raise # noqa: PLE0704 page = buf.getvalue() # print page[1:400] buf.close() diff --git a/test/ucs-test/tests/51_samba4/56evaluate_windows_gpo.py b/test/ucs-test/tests/51_samba4/56evaluate_windows_gpo.py index 49043fc1d8..2169dc77da 100755 --- a/test/ucs-test/tests/51_samba4/56evaluate_windows_gpo.py +++ b/test/ucs-test/tests/51_samba4/56evaluate_windows_gpo.py @@ -8,7 +8,7 @@ ## - domaincontroller_master ## - domaincontroller_slave -import xml.etree.ElementTree as ET +import xml.etree.ElementTree as ET # noqa: S405 from os import path from re import search from subprocess import PIPE, Popen diff --git a/test/ucs-test/tests/82_saml/samltest.py b/test/ucs-test/tests/82_saml/samltest.py index 4cd0816b44..afbf18a397 100644 --- a/test/ucs-test/tests/82_saml/samltest.py +++ b/test/ucs-test/tests/82_saml/samltest.py @@ -10,7 +10,7 @@ from html import unescape import requests from bs4 import BeautifulSoup -from lxml import etree +from lxml import etree # noqa: S410 from requests_kerberos import OPTIONAL, HTTPKerberosAuth import univention.config_registry as configRegistry diff --git a/test/ucs-test/univention/testing/browser/lib.py b/test/ucs-test/univention/testing/browser/lib.py index 150d27c583..87f1260882 100644 --- a/test/ucs-test/univention/testing/browser/lib.py +++ b/test/ucs-test/univention/testing/browser/lib.py @@ -180,7 +180,7 @@ class Interactions: from univention.testing.browser.appcenter import AppCenter, wait_for_final_query app_center = AppCenter(self.tester) - with self.page.expect_response(lambda request: wait_for_final_query(request), timeout=2 * MIN): + with self.page.expect_response(lambda request: wait_for_final_query(request), timeout=2 * MIN): # noqa: PLW0108 app_center.handle_first_open_dialog() def fill_combobox(self, name: str, option: str): diff --git a/test/ucs-test/univention/testing/internal.py b/test/ucs-test/univention/testing/internal.py index f7596989ad..fc54f91000 100644 --- a/test/ucs-test/univention/testing/internal.py +++ b/test/ucs-test/univention/testing/internal.py @@ -128,7 +128,7 @@ def get_tests(sections: Iterable[str]) -> Dict[str, List[str]]: return result -class UCSVersion: # pylint: disable-msg=R0903 +class UCSVersion: # pylint: disable-msg=R0903 # noqa: PLW1641 """ UCS version. diff --git a/test/utils/ucsschool_id_connector.py b/test/utils/ucsschool_id_connector.py index 093a8932e5..fbc4a6364d 100644 --- a/test/utils/ucsschool_id_connector.py +++ b/test/utils/ucsschool_id_connector.py @@ -30,7 +30,7 @@ MAPPED_UDM_PROPERTIES = [ def setup_kelvin_traeger(): - with open('/var/lib/ucs-school-import/configs/kelvin.json', 'r+w') as fp: + with open('/var/lib/ucs-school-import/configs/kelvin.json', 'r+w') as fp: # noqa: PLW1501 config = json.load(fp) config['configuration_checks'] = ['defaults', 'class_overwrites', 'mapped_udm_properties'] config['mapped_udm_properties'] = MAPPED_UDM_PROPERTIES