From 72b764cc51db1513c4497e0c442aaca184fde6bf Mon Sep 17 00:00:00 2001 From: satreix Date: Fri, 26 Feb 2016 19:25:21 +0100 Subject: [PATCH] pep: fix e502 --- .pep8 | 3 +-- headphones/__init__.py | 2 +- headphones/helpers.py | 6 +++--- headphones/logger.py | 2 +- headphones/postprocessor.py | 12 ++++++------ headphones/searcher.py | 14 +++++++------- headphones/transmission.py | 2 +- headphones/webstart.py | 4 ++-- 8 files changed, 22 insertions(+), 23 deletions(-) diff --git a/.pep8 b/.pep8 index daa763d1..92ad73e6 100644 --- a/.pep8 +++ b/.pep8 @@ -10,6 +10,5 @@ # E262 inline comment should start with '# ' # E265 block comment should start with '# ' # E501 line too long (312 > 160 characters) -# E502 the backslash is redundant between brackets -ignore = E121,E122,E123,E124,E125,E126,E127,E128,E261,E262,E265,E501,E502 +ignore = E121,E122,E123,E124,E125,E126,E127,E128,E261,E262,E265,E501 max-line-length = 160 diff --git a/headphones/__init__.py b/headphones/__init__.py index 4b36acf7..0ed027af 100644 --- a/headphones/__init__.py +++ b/headphones/__init__.py @@ -132,7 +132,7 @@ def initialize(config_file): CONFIG.LOG_DIR = None if not QUIET: - sys.stderr.write("Unable to create the log directory. " \ + sys.stderr.write("Unable to create the log directory. " "Logging to screen only.\n") # Start the logger, disable console if needed diff --git a/headphones/helpers.py b/headphones/helpers.py index 5e836178..adfced66 100644 --- a/headphones/helpers.py +++ b/headphones/helpers.py @@ -538,8 +538,8 @@ def preserve_torrent_directory(albumpath): shutil.copytree(albumpath, new_folder) return new_folder except Exception as e: - logger.warn("Cannot copy/move files to temp folder: " + \ - new_folder.decode(headphones.SYS_ENCODING, 'replace') + \ + logger.warn("Cannot copy/move files to temp folder: " + + new_folder.decode(headphones.SYS_ENCODING, 'replace') + ". Not continuing. Error: " + str(e)) return None @@ -684,7 +684,7 @@ def walk_directory(basedir, followlinks=True): real_path = os.path.abspath(os.readlink(path)) if real_path in traversed: - logger.debug("Skipping '%s' since it is a symlink to " \ + logger.debug("Skipping '%s' since it is a symlink to " "'%s', which is already visited.", path, real_path) else: traversed.append(real_path) diff --git a/headphones/logger.py b/headphones/logger.py index b01e880f..1eaac7cc 100644 --- a/headphones/logger.py +++ b/headphones/logger.py @@ -72,7 +72,7 @@ def listener(): # http://stackoverflow.com/questions/2009278 for more information. if e.errno == errno.EACCES: logger.warning("Multiprocess logging disabled, because " - "current user cannot map shared memory. You won't see any" \ + "current user cannot map shared memory. You won't see any" "logging generated by the worker processed.") # Multiprocess logging may be disabled. diff --git a/headphones/postprocessor.py b/headphones/postprocessor.py index 507a5571..2bc8e7c6 100755 --- a/headphones/postprocessor.py +++ b/headphones/postprocessor.py @@ -108,8 +108,8 @@ def verify(albumid, albumpath, Kind=None, forced=False, keep_original_folder=Fal [release_dict['artist_id'], release_dict['artist_name']]) if not artist: - logger.warn("Continuing would add new artist '%s' (ID %s), " \ - "but database is frozen. Will skip postprocessing for " \ + logger.warn("Continuing would add new artist '%s' (ID %s), " + "but database is frozen. Will skip postprocessing for " "album with rgid: %s", release_dict['artist_name'], release_dict['artist_id'], albumid) @@ -348,7 +348,7 @@ def doPostProcessing(albumid, albumpath, release, tracks, downloaded_track_list, # this test is just to keep pyflakes from complaining about an unused variable return except (FileTypeError, UnreadableFileError): - logger.error("Track file is not a valid media file: %s. Not " \ + logger.error("Track file is not a valid media file: %s. Not " "continuing.", downloaded_track.decode( headphones.SYS_ENCODING, "replace")) return @@ -371,7 +371,7 @@ def doPostProcessing(albumid, albumpath, release, tracks, downloaded_track_list, fp.seek(0) except IOError as e: logger.debug("Write check exact error: %s", e) - logger.error("Track file is not writable. This is required " \ + logger.error("Track file is not writable. This is required " "for some post processing steps: %s. Not continuing.", downloaded_track.decode(headphones.SYS_ENCODING, "replace")) if new_folder: @@ -1420,7 +1420,7 @@ def forcePostProcess(dir=None, expand_subfolders=True, album_dir=None, keep_orig logger.info('No match found on MusicBrainz for: %s - %s', name, album) # Fail here - logger.info("Couldn't parse '%s' into any valid format. If adding " \ - "albums from another source, they must be in an 'Artist - Album " \ + logger.info("Couldn't parse '%s' into any valid format. If adding " + "albums from another source, they must be in an 'Artist - Album " "[Year]' format, or end with the musicbrainz release group id.", folder_basename) diff --git a/headphones/searcher.py b/headphones/searcher.py index 5c8b4144..66611f8f 100644 --- a/headphones/searcher.py +++ b/headphones/searcher.py @@ -119,10 +119,10 @@ def read_torrent_name(torrent_file, default_name=None): return torrent_info["info"]["name"] except KeyError: if default_name: - logger.warning("Couldn't get name from torrent file: %s. " \ + logger.warning("Couldn't get name from torrent file: %s. " "Defaulting to '%s'", e, default_name) else: - logger.warning("Couldn't get name from torrent file: %s. No " \ + logger.warning("Couldn't get name from torrent file: %s. No " "default given", e) # Return default @@ -143,7 +143,7 @@ def calculate_torrent_hash(link, data=None): info = bdecode(data)["info"] torrent_hash = sha1(bencode(info)).hexdigest() else: - raise ValueError("Cannot calculate torrent hash without magnet link " \ + raise ValueError("Cannot calculate torrent hash without magnet link " "or data") return torrent_hash.upper() @@ -842,16 +842,16 @@ def send_to_downloader(data, bestqual, album): break else: # No service succeeded - logger.warning("Unable to convert magnet with hash " \ + logger.warning("Unable to convert magnet with hash " "'%s' into a torrent file.", torrent_hash) return elif headphones.CONFIG.MAGNET_LINKS == 3: torrent_to_file(download_path, data) return else: - logger.error("Cannot save magnet link in blackhole. " \ - "Please switch your torrent downloader to " \ - "Transmission, uTorrent or Deluge, or allow Headphones " \ + logger.error("Cannot save magnet link in blackhole. " + "Please switch your torrent downloader to " + "Transmission, uTorrent or Deluge, or allow Headphones " "to open or convert magnet links") return else: diff --git a/headphones/transmission.py b/headphones/transmission.py index b62e2fac..3e436617 100644 --- a/headphones/transmission.py +++ b/headphones/transmission.py @@ -164,7 +164,7 @@ def torrentAction(method, arguments): whitelist_status_code=[401, 409]) if response.status_code == 401: if auth: - logger.error("Username and/or password not accepted by " \ + logger.error("Username and/or password not accepted by " "Transmission") else: logger.error("Transmission authorization required") diff --git a/headphones/webstart.py b/headphones/webstart.py index a4ab7113..cc639221 100644 --- a/headphones/webstart.py +++ b/headphones/webstart.py @@ -35,12 +35,12 @@ def initialize(options): if not (https_cert and os.path.exists(https_cert)) or not ( https_key and os.path.exists(https_key)): if not create_https_certificates(https_cert, https_key): - logger.warn("Unable to create certificate and key. Disabling " \ + logger.warn("Unable to create certificate and key. Disabling " "HTTPS") enable_https = False if not (os.path.exists(https_cert) and os.path.exists(https_key)): - logger.warn("Disabled HTTPS because of missing certificate and " \ + logger.warn("Disabled HTTPS because of missing certificate and " "key.") enable_https = False