diff --git a/picard/util/__init__.py b/picard/util/__init__.py index a83d8b9d930..5f211c6fba5 100644 --- a/picard/util/__init__.py +++ b/picard/util/__init__.py @@ -245,7 +245,7 @@ def system_supports_long_paths(): system_supports_long_paths._supported = supported return supported except OSError: - log.info('Failed reading LongPathsEnabled from registry') + log.info("Failed reading LongPathsEnabled from registry") return False @@ -257,7 +257,7 @@ def normpath(path): # realpath can fail if path does not exist or is not accessible # or on Windows if drives are mounted without mount manager # (see https://tickets.metabrainz.org/browse/PICARD-2425). - log.warning('Failed getting realpath for "%s": %s', path, why) + log.warning("Failed getting realpath for `%s`: %s", path, why) # If the path is longer than 259 characters on Windows, prepend the \\?\ # prefix. This enables access to long paths using the Windows API. See # https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation @@ -400,7 +400,7 @@ def translate_from_sortname(name, sortname): """'Translate' the artist name by reversing the sortname.""" for c in name: ctg = unicodedata.category(c) - if ctg[0] == "L" and unicodedata.name(c).find("LATIN") == -1: + if ctg[0] == "L" and unicodedata.name(c).find('LATIN') == -1: for separator in (" & ", "; ", " and ", " vs. ", " with ", " y "): if separator in sortname: parts = sortname.split(separator) @@ -749,11 +749,11 @@ def build_qurl(host, port=80, path=None, queryargs=None): url.setHost(host) if port == 443 or host in MUSICBRAINZ_SERVERS: - url.setScheme("https") + url.setScheme('https') elif port == 80: - url.setScheme("http") + url.setScheme('http') else: - url.setScheme("http") + url.setScheme('http') url.setPort(port) if path is not None: diff --git a/picard/util/bytes2human.py b/picard/util/bytes2human.py index 5794a5aa8f1..a26a117feef 100644 --- a/picard/util/bytes2human.py +++ b/picard/util/bytes2human.py @@ -34,17 +34,17 @@ # used to force gettextization _BYTES_STRINGS_I18N = ( - N_('%(value)s B'), - N_('%(value)s kB'), - N_('%(value)s KiB'), - N_('%(value)s MB'), - N_('%(value)s MiB'), - N_('%(value)s GB'), - N_('%(value)s GiB'), - N_('%(value)s TB'), - N_('%(value)s TiB'), - N_('%(value)s PB'), - N_('%(value)s PiB'), + N_("%(value)s B"), + N_("%(value)s kB"), + N_("%(value)s KiB"), + N_("%(value)s MB"), + N_("%(value)s MiB"), + N_("%(value)s GB"), + N_("%(value)s GiB"), + N_("%(value)s TB"), + N_("%(value)s TiB"), + N_("%(value)s PB"), + N_("%(value)s PiB"), ) @@ -116,9 +116,9 @@ def calc_unit(number, multiple=1000): elif multiple == 1024: k, b = 'K', 'iB' else: - raise ValueError('multiple parameter has to be 1000 or 1024') + raise ValueError("multiple parameter has to be 1000 or 1024") - suffixes = ["B"] + [i + b for i in k + "MGTP"] + suffixes = ['B'] + [i + b for i in k + 'MGTP'] for suffix in suffixes: if n < multiple or suffix == suffixes[-1]: return (sign * n, suffix) diff --git a/picard/util/cdrom.py b/picard/util/cdrom.py index 8d8c31d0f2d..d43b11046c3 100644 --- a/picard/util/cdrom.py +++ b/picard/util/cdrom.py @@ -63,7 +63,7 @@ def _generic_iter_drives(): config = get_config() yield from ( device.strip() for device - in config.setting["cd_lookup_device"].split(",") + in config.setting['cd_lookup_device'].split(',') if device and not device.isspace() ) @@ -97,7 +97,7 @@ def _iter_drives(): mask = GetLogicalDrives() for i in range(26): if mask >> i & 1: - drive = chr(i + ord("A")) + ":" + drive = chr(i + ord('A')) + ':' if GetDriveType(drive) == DRIVE_TYPE_CDROM: yield drive diff --git a/picard/util/checkupdate.py b/picard/util/checkupdate.py index f2ac320cff4..78593e1fa0d 100644 --- a/picard/util/checkupdate.py +++ b/picard/util/checkupdate.py @@ -128,7 +128,7 @@ def _display_results(self): try: test_version = Version(*version_tuple) except (TypeError, VersionError): - log.error('Invalid version %r for update level %s.', version_tuple, update_level) + log.error("Invalid version %r for update level %s.", version_tuple, update_level) continue if self._update_level >= test_key and test_version > high_version: key = PROGRAM_UPDATE_LEVELS[test_key]['name'] @@ -153,7 +153,7 @@ def _display_results(self): if self._update_level in PROGRAM_UPDATE_LEVELS: update_level = PROGRAM_UPDATE_LEVELS[self._update_level]['title'] else: - update_level = N_('unknown') + update_level = N_("unknown") QMessageBox.information( self._parent, _("Picard Update"), diff --git a/picard/util/emptydir.py b/picard/util/emptydir.py index 48e1aa37bf6..5edb4d86c84 100644 --- a/picard/util/emptydir.py +++ b/picard/util/emptydir.py @@ -84,8 +84,8 @@ def rm_empty_dir(path): or considered a special directory. """ if os.path.realpath(path) in PROTECTED_DIRECTORIES: - raise SkipRemoveDir('%s is a protected directory' % path) + raise SkipRemoveDir("%s is a protected directory" % path) elif not is_empty_dir(path): - raise SkipRemoveDir('%s is not empty' % path) + raise SkipRemoveDir("%s is not empty" % path) else: shutil.rmtree(path)