From c370ced80e6510ebdf85104a6dbd21d043d3e366 Mon Sep 17 00:00:00 2001 From: codesparkle Date: Fri, 16 May 2014 18:08:53 +1000 Subject: [PATCH] Removed redundant parentheses and replaced expressions of the form x = x + n with x += n --- youtube_dl/aes.py | 6 +++--- youtube_dl/extractor/common.py | 6 +++--- youtube_dl/extractor/dailymotion.py | 2 +- youtube_dl/extractor/francetv.py | 2 +- youtube_dl/extractor/hark.py | 2 +- youtube_dl/extractor/justintv.py | 2 +- youtube_dl/extractor/youtube.py | 2 +- youtube_dl/utils.py | 10 +++++----- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/youtube_dl/aes.py b/youtube_dl/aes.py index e9c5e2152..3e53ba745 100644 --- a/youtube_dl/aes.py +++ b/youtube_dl/aes.py @@ -261,7 +261,7 @@ def xor(data1, data2): return [x^y for x, y in zip(data1, data2)] def rijndael_mul(a, b): - if(a==0 or b==0): + if a==0 or b==0: return 0 return RIJNDAEL_EXP_TABLE[(RIJNDAEL_LOG_TABLE[a] + RIJNDAEL_LOG_TABLE[b]) % 0xFF] @@ -301,10 +301,10 @@ def shift_rows_inv(data): def inc(data): data = data[:] # copy - for i in range(len(data)-1,-1,-1): + for i in range(len(data)-1, -1, -1): if data[i] == 255: data[i] = 0 else: - data[i] = data[i] + 1 + data[i] += 1 break return data diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index db472aace..6d4646b0b 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -269,7 +269,7 @@ class InfoExtractor(object): msg += u' Visit %s for more details' % blocked_iframe raise ExtractorError(msg, expected=True) - return (content, urlh) + return content, urlh def _download_webpage(self, url_or_request, video_id, note=None, errnote=None, fatal=True): """ Returns the data of the page as a string """ @@ -399,7 +399,7 @@ class InfoExtractor(object): If there's no info available, return (None, None) """ if self._downloader is None: - return (None, None) + return None, None username = None password = None @@ -420,7 +420,7 @@ class InfoExtractor(object): except (IOError, netrc.NetrcParseError) as err: self._downloader.report_warning(u'parsing .netrc: %s' % compat_str(err)) - return (username, password) + return username, password # Helper functions for extracting OpenGraph info @staticmethod diff --git a/youtube_dl/extractor/dailymotion.py b/youtube_dl/extractor/dailymotion.py index 55216201f..7b5a851b8 100644 --- a/youtube_dl/extractor/dailymotion.py +++ b/youtube_dl/extractor/dailymotion.py @@ -168,7 +168,7 @@ class DailymotionIE(DailymotionBaseInfoExtractor, SubtitlesInfoExtractor): self._downloader.report_warning(u'unable to download video subtitles: %s' % compat_str(err)) return {} info = json.loads(sub_list) - if (info['total'] > 0): + if info['total'] > 0: sub_lang_list = dict((l['language'], l['url']) for l in info['list']) return sub_lang_list self._downloader.report_warning(u'video doesn\'t have subtitles') diff --git a/youtube_dl/extractor/francetv.py b/youtube_dl/extractor/francetv.py index f3e0f38b7..58aecd941 100644 --- a/youtube_dl/extractor/francetv.py +++ b/youtube_dl/extractor/francetv.py @@ -173,7 +173,7 @@ class FranceTVIE(FranceTVBaseInfoExtractor): class="francetv-video-player">'''), (r'][^\s/=>]*(?:\s*=+\s*(?:'[^']*'|"[^"]*"|(?!['"])[^>\s]*))?\s*)*)?\s*""", re.VERBOSE) # backport bugfix class BaseHTMLParser(compat_html_parser.HTMLParser): @@ -435,9 +435,9 @@ def sanitize_open(filename, open_mode): if sys.platform == 'win32': import msvcrt msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) - return (sys.stdout.buffer if hasattr(sys.stdout, 'buffer') else sys.stdout, filename) + return sys.stdout.buffer if hasattr(sys.stdout, 'buffer') else sys.stdout, filename stream = open(encodeFilename(filename), open_mode) - return (stream, filename) + return stream, filename except (IOError, OSError) as err: if err.errno in (errno.EACCES,): raise @@ -452,7 +452,7 @@ def sanitize_open(filename, open_mode): else: # An exception here should be caught in the caller stream = open(encodeFilename(filename), open_mode) - return (stream, alt_filename) + return stream, alt_filename def timeconvert(timestr): @@ -614,7 +614,7 @@ class ExtractorError(Exception): if video_id is not None: msg = video_id + ': ' + msg if not expected: - msg = msg + u'; please report this issue on https://yt-dl.org/bug . Be sure to call youtube-dl with the --verbose flag and include its complete output. Make sure you are using the latest version; type youtube-dl -U to update.' + msg += u'; please report this issue on https://yt-dl.org/bug . Be sure to call youtube-dl with the --verbose flag and include its complete output. Make sure you are using the latest version; type youtube-dl -U to update.' super(ExtractorError, self).__init__(msg) self.traceback = tb