From: Frank Brehm Date: Wed, 24 May 2023 07:57:09 +0000 (+0200) Subject: Make the linter happy X-Git-Tag: 0.9.0~1^2~35 X-Git-Url: https://git.uhu-banane.net/?a=commitdiff_plain;h=7c81202c9277b200f41c75c2e813a549215d8815;p=pixelpark%2Fpp-admin-tools.git Make the linter happy --- diff --git a/lib/pp_admintools/app/barracuda_sync.py b/lib/pp_admintools/app/barracuda_sync.py index 071e275..8a91543 100644 --- a/lib/pp_admintools/app/barracuda_sync.py +++ b/lib/pp_admintools/app/barracuda_sync.py @@ -16,8 +16,8 @@ import re from pathlib import Path # Third party modules -from fb_tools.common import pp from fb_tools.argparse_actions import DirectoryOptionAction +from fb_tools.common import pp from fb_tools.handler import BaseHandler from fb_tools.multi_config import DEFAULT_ENCODING from fb_tools.xlate import format_list @@ -26,7 +26,7 @@ from fb_tools.xlate import format_list from .ldap import BaseLdapApplication from ..xlate import XLATOR -__version__ = '0.7.1' +__version__ = '0.7.2' LOG = logging.getLogger(__name__) _ = XLATOR.gettext @@ -233,7 +233,7 @@ class BarracudaSyncApp(BaseLdapApplication): self.exit(6) if self.verbose > 1: - LOG.debug(_("Candidate for lookup table type: {!r}.").format(self.postfix_db_hashtype)) + LOG.debug(_('Candidate for lookup table type: {!r}.').format(self.postfix_db_hashtype)) if self.postfix_db_hashtype not in self.usable_postfix_hashtypes: msg = _( @@ -248,8 +248,9 @@ class BarracudaSyncApp(BaseLdapApplication): LOG.debug(_('Collecting all available virtual aliases table files ...')) va_files = [] - basenames = ['virtual', 'virtual-alias', 'virtual-aliases', - 'virtualalias', 'virtualaliases'] + basenames = [ + 'virtual', 'virtual-alias', 'virtual-aliases', + 'virtualalias', 'virtualaliases'] if self.args.basename: for basename in self.args.basename: @@ -259,15 +260,15 @@ class BarracudaSyncApp(BaseLdapApplication): for va_file in self.default_virtaliases_files: if va_file.exists() and va_file.is_file(): if self.verbose > 1: - LOG.debug(_("Using virtual aliases file: {!r}").format(str(va_file))) + LOG.debug(_('Using virtual aliases file: {!r}').format(str(va_file))) va_files.append(va_file) for maps_dir in (self.postfix_config_dir, self.postfix_maps_dir): if not maps_dir.exists(): - LOG.debug(_("Directory {!r} does not exists.").format(str(maps_dir))) + LOG.debug(_('Directory {!r} does not exists.').format(str(maps_dir))) continue if not maps_dir.is_dir(): - LOG.debug(_("Path {!r} exists, but is not a directory.").format(str(maps_dir))) + LOG.debug(_('Path {!r} exists, but is not a directory.').format(str(maps_dir))) continue for basename in basenames: @@ -276,14 +277,14 @@ class BarracudaSyncApp(BaseLdapApplication): va_file = va_file.resolve() if va_file not in va_files: if self.verbose > 1: - LOG.debug(_("Using virtual aliases file: {!r}").format(str(va_file))) + LOG.debug(_('Using virtual aliases file: {!r}').format(str(va_file))) va_files.append(va_file) if not len(va_files): - LOG.error(_("Did not found any virtual aliases files.")) + LOG.error(_('Did not found any virtual aliases files.')) self.exit(6) - LOG.debug(_("Found virtual aliases files:") + '\n' + pp( + LOG.debug(_('Found virtual aliases files:') + '\n' + pp( list(map(lambda x: str(x), va_files)))) self.virtaliases_files = va_files @@ -294,31 +295,31 @@ class BarracudaSyncApp(BaseLdapApplication): db_extension = self.postfix_filetype_extensions[self.postfix_db_hashtype] if self.verbose > 1: - LOG.debug(_("Using file extension for db-files: {!r}.").format(db_extension)) + LOG.debug(_('Using file extension for db-files: {!r}.').format(db_extension)) for va_file in self.virtaliases_files: db_file = va_file.parent / (va_file.name + db_extension) if not db_file.exists() or not db_file.is_file(): LOG.error(_( - "DB file for virtual aliases {!r} does not exists or is not a regular " - "file.").format(str(db_file))) + 'DB file for virtual aliases {!r} does not exists or is not a regular ' + 'file.').format(str(db_file))) self.virtaliases_files.remove(va_file) continue mtime_db_file = db_file.stat().st_mtime mtime_va_file = va_file.stat().st_mtime if mtime_db_file < mtime_va_file: LOG.warn(_( - "The last modification time of {db!r} is older than this " - "of {va!r}.").format(db=str(db_file), va=str(va_file))) + 'The last modification time of {db!r} is older than this ' + 'of {va!r}.').format(db=str(db_file), va=str(va_file))) elif self.verbose > 1: LOG.debug(_( - "The last modification time of {db!r} and {va!r} are " - "okay.").format(db=str(db_file), va=str(va_file))) + 'The last modification time of {db!r} and {va!r} are ' + 'okay.').format(db=str(db_file), va=str(va_file))) # ------------------------------------------------------------------------- def read_local_virtual_aliases(self): - """Reading virtual alias files.""" - LOG.info(_("Reading in virtual alias files ...")) + """Read virtual alias files.""" + LOG.info(_('Reading in virtual alias files ...')) self.existing_aliases = [] @@ -327,8 +328,8 @@ class BarracudaSyncApp(BaseLdapApplication): # ------------------------------------------------------------------------- def read_virtual_alias_file(self, va_file): - """Reading virtual aliases from given file.""" - LOG.info(_("Reading in from virtual alias file {!r} ...").format(str(va_file))) + """Read virtual aliases from given file.""" + LOG.info(_('Reading in from virtual alias file {!r} ...').format(str(va_file))) handler = BaseHandler(appname=self.appname, verbose=self.verbose) pdata = handler.call([str(self.postmap_command), '-s', str(va_file)], quiet=True)