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 cb38360 commit 2b1aa13
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 54 deletions.
2 changes: 1 addition & 1 deletion picard/util/filenaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
import pywintypes
import win32api
except ImportError as e:
log.warning('pywin32 not available: %s', e)
log.warning("pywin32 not available: %s", e)


def _get_utf16_length(text):
Expand Down
14 changes: 7 additions & 7 deletions picard/util/imageinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def __init__(self, data):
self.data = data
self.datalen = len(self.data)
if self.datalen < 16:
raise NotEnoughData('Not enough data')
raise NotEnoughData("Not enough data")

def read(self):
self._read()
Expand Down Expand Up @@ -176,7 +176,7 @@ def _read(self):
index = data.find(b'\x9d\x01\x2a')
if index != -1:
if self.datalen < index + 7:
raise NotEnoughData('Not enough data for WebP VP8')
raise NotEnoughData("Not enough data for WebP VP8")
self.w, self.h = struct.unpack('<HH', data[index + 3:index + 7])
# Width and height are encoded as 14 bit integers, ignore the first 2 bits
self.w &= 0x3fff
Expand All @@ -186,14 +186,14 @@ def _read(self):
# Simple File Format (Lossless)
elif format == b'VP8L':
if self.datalen < 25:
raise NotEnoughData('Not enough data for WebP VP8L')
raise NotEnoughData("Not enough data for WebP VP8L")
reader = LSBBitReader(BytesIO(data[21:25]))
self.w = reader.bits(14) + 1
self.h = reader.bits(14) + 1
# Extended File Format
elif format == b'VP8X':
if self.datalen < 30:
raise NotEnoughData('Not enough data for WebP VP8X')
raise NotEnoughData("Not enough data for WebP VP8X")
reader = LSBBitReader(BytesIO(data[24:30]))
self.w = reader.bits(24) + 1
self.h = reader.bits(24) + 1
Expand Down Expand Up @@ -230,7 +230,7 @@ def _read(self):
elif byte_order == TIFF_BYTE_ORDER_MSB:
order = '>'
else:
raise UnexpectedError('TIFF: unexpected byte order %r' % byte_order)
raise UnexpectedError("TIFF: unexpected byte order %r" % byte_order)
try:
offset, = struct.unpack(order + 'I', data[4:8])
entry_count, = struct.unpack(order + 'H', data[offset:offset + 2])
Expand Down Expand Up @@ -259,7 +259,7 @@ def _read_value(tiff_type, order, data):
value = data[:2]
struct_format = order + 'H'
else:
raise UnexpectedError('TIFF: unexpected field type %s' % tiff_type)
raise UnexpectedError("TIFF: unexpected field type %s" % tiff_type)
return struct.unpack(struct_format, value)[0]


Expand Down Expand Up @@ -292,7 +292,7 @@ def identify(data):
if obj.match():
return obj.read()

raise UnrecognizedFormat('Unrecognized image data')
raise UnrecognizedFormat("Unrecognized image data")


def supports_mime_type(mime):
Expand Down
6 changes: 3 additions & 3 deletions picard/util/periodictouch.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,19 @@ def unregister_file(filepath):


def enable_timer():
log.debug('Setup timer for touching files every %i seconds', TOUCH_FILES_DELAY_SECONDS)
log.debug("Setup timer for touching files every %i seconds", TOUCH_FILES_DELAY_SECONDS)
_touch_timer.timeout.connect(_touch_files)
_touch_timer.start(TOUCH_FILES_DELAY_SECONDS * 1000)


def _touch_files():
log.debug('Touching %i files', len(_files_to_touch))
log.debug("Touching %i files", len(_files_to_touch))
for filepath in _files_to_touch.copy():
path = Path(filepath)
if path.exists():
try:
path.touch()
except OSError:
log.error('error touching file "%s"', filepath, exc_info=True)
log.error("error touching file `%s`", filepath, exc_info=True)
else:
unregister_file(filepath)
6 changes: 3 additions & 3 deletions picard/util/pipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,11 @@ def __init__(self, app_name: str, app_version: str, args: Optional[Iterable[str]
if not isinstance(app_name, str) or not isinstance(app_version, str):
raise PipeErrorInvalidAppData

self._identifier = identifier or "main"
self._identifier = identifier or 'main'

if forced_path:
self._paths = (forced_path,)
elif IS_WIN or os.getenv("HOME"):
elif IS_WIN or os.getenv('HOME'):
self._paths = self.__generate_filenames(app_name, app_version)
self.path_was_forced = False
else:
Expand Down Expand Up @@ -468,7 +468,7 @@ def _reader(self) -> str:
self.__create_pipe()

if message is not None:
message = message.decode("utf-8")
message = message.decode('utf-8')
if exit_code == 0:
return message # type: ignore
else:
Expand Down
80 changes: 40 additions & 40 deletions picard/util/remotecommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,93 +36,93 @@ def __init__(self, method_name, help_text=None, help_args=None):


REMOTE_COMMANDS = {
"CLEAR_LOGS": RemoteCommand(
"handle_command_clear_logs",
'CLEAR_LOGS': RemoteCommand(
'handle_command_clear_logs',
help_text="Clear the Picard logs",
),
"CLUSTER": RemoteCommand(
"handle_command_cluster",
'CLUSTER': RemoteCommand(
'handle_command_cluster',
help_text="Cluster all files in the cluster pane.",
),
"FINGERPRINT": RemoteCommand(
"handle_command_fingerprint",
'FINGERPRINT': RemoteCommand(
'handle_command_fingerprint',
help_text="Calculate acoustic fingerprints for all (matched) files in the album pane.",
),
"FROM_FILE": RemoteCommand(
"handle_command_from_file",
'FROM_FILE': RemoteCommand(
'handle_command_from_file',
help_text="Load commands from a file.",
help_args="[Path to a file containing commands]",
),
"LOAD": RemoteCommand(
"handle_command_load",
'LOAD': RemoteCommand(
'handle_command_load',
help_text="Load one or more files/MBIDs/URLs to Picard.",
help_args="[supported MBID/URL or path to a file]",
),
"LOOKUP": RemoteCommand(
"handle_command_lookup",
'LOOKUP': RemoteCommand(
'handle_command_lookup',
help_text="Lookup files in the clustering pane. Defaults to all files.",
help_args="[clustered|unclustered|all]"
),
"LOOKUP_CD": RemoteCommand(
"handle_command_lookup_cd",
'LOOKUP_CD': RemoteCommand(
'handle_command_lookup_cd',
help_text="Read CD from the selected drive and lookup on MusicBrainz. "
"Without argument, it defaults to the first (alphabetically) available disc drive.",
help_args="[device/log file]",
),
"PAUSE": RemoteCommand(
"handle_command_pause",
'PAUSE': RemoteCommand(
'handle_command_pause',
help_text="Pause executable command processing.",
help_args="[number of seconds to pause]",
),
"QUIT": RemoteCommand(
"handle_command_quit",
'QUIT': RemoteCommand(
'handle_command_quit',
help_text="Exit the running instance of Picard. "
"Use the argument 'FORCE' to bypass Picard's unsaved files check.",
help_args="[FORCE]",
),
"REMOVE": RemoteCommand(
"handle_command_remove",
'REMOVE': RemoteCommand(
'handle_command_remove',
help_text="Remove the file from Picard. Do nothing if no arguments provided.",
help_args="[absolute path to one or more files]",
),
"REMOVE_ALL": RemoteCommand(
"handle_command_remove_all",
'REMOVE_ALL': RemoteCommand(
'handle_command_remove_all',
help_text="Remove all files from Picard.",
),
"REMOVE_EMPTY": RemoteCommand(
"handle_command_remove_empty",
'REMOVE_EMPTY': RemoteCommand(
'handle_command_remove_empty',
help_text="Remove all empty clusters and albums.",
),
"REMOVE_SAVED": RemoteCommand(
"handle_command_remove_saved",
'REMOVE_SAVED': RemoteCommand(
'handle_command_remove_saved',
help_text="Remove all saved files from the album pane.",
),
"REMOVE_UNCLUSTERED": RemoteCommand(
"handle_command_remove_unclustered",
'REMOVE_UNCLUSTERED': RemoteCommand(
'handle_command_remove_unclustered',
help_text="Remove all unclustered files from the cluster pane.",
),
"SAVE_MATCHED": RemoteCommand(
"handle_command_save_matched",
'SAVE_MATCHED': RemoteCommand(
'handle_command_save_matched',
help_text="Save all matched files from the album pane."
),
"SAVE_MODIFIED": RemoteCommand(
"handle_command_save_modified",
'SAVE_MODIFIED': RemoteCommand(
'handle_command_save_modified',
help_text="Save all modified files from the album pane.",
),
"SCAN": RemoteCommand(
"handle_command_scan",
'SCAN': RemoteCommand(
'handle_command_scan',
help_text="Scan all files in the cluster pane.",
),
"SHOW": RemoteCommand(
"handle_command_show",
'SHOW': RemoteCommand(
'handle_command_show',
help_text="Make the running instance the currently active window.",
),
"SUBMIT_FINGERPRINTS": RemoteCommand(
"handle_command_submit_fingerprints",
'SUBMIT_FINGERPRINTS': RemoteCommand(
'handle_command_submit_fingerprints',
help_text="Submit outstanding acoustic fingerprints for all (matched) files in the album pane.",
),
"WRITE_LOGS": RemoteCommand(
"handle_command_write_logs",
'WRITE_LOGS': RemoteCommand(
'handle_command_write_logs',
help_text="Write Picard logs to a given path.",
help_args="[absolute path to one file]",
),
Expand Down

0 comments on commit 2b1aa13

Please sign in to comment.