Skip to content

Commit

Permalink
Continuing on quote consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
zas committed Sep 24, 2023
1 parent f9200b9 commit cb38360
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 25 deletions.
12 changes: 6 additions & 6 deletions picard/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down
26 changes: 13 additions & 13 deletions picard/util/bytes2human.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
)


Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions picard/util/cdrom.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
)

Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions picard/util/checkupdate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand All @@ -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"),
Expand Down
4 changes: 2 additions & 2 deletions picard/util/emptydir.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit cb38360

Please sign in to comment.