From b1b1a648549d94e8120f2f56bcfbd0d9b16d8dc3 Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Wed, 6 Sep 2017 01:36:24 -0400 Subject: [PATCH] Pylint and fixing error type --- rtv/mime_parsers.py | 10 ++++++---- rtv/objects.py | 4 ++-- rtv/terminal.py | 6 +++--- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/rtv/mime_parsers.py b/rtv/mime_parsers.py index b039249..502ee8a 100644 --- a/rtv/mime_parsers.py +++ b/rtv/mime_parsers.py @@ -151,20 +151,22 @@ class RedditVideoMIMEParser(BaseMIMEParser): class ImgurApiMIMEParser(BaseMIMEParser): - """ + """ Imgur now provides a json API exposing its entire infrastructure. Each Imgur page has an associated hash and can either contain an album, a gallery, or single image. - + The default client token for RTV is shared among users and allows a maximum global number of requests per day of 12,500. If we find that this limit is not sufficient for all of rtv's traffic, this method will be revisited. - + Reference: https://apidocs.imgur.com """ CLIENT_ID = None - pattern = re.compile(r'https?://(w+\.)?(m\.)?imgur\.com/((?Pa|album|gallery)/)?(?P[a-zA-Z0-9]+)$') + pattern = re.compile( + r'https?://(w+\.)?(m\.)?imgur\.com/' + r'((?Pa|album|gallery)/)?(?P[a-zA-Z0-9]+)$') @classmethod def get_mimetype(cls, url): diff --git a/rtv/objects.py b/rtv/objects.py index cc5aa8f..d58b37d 100644 --- a/rtv/objects.py +++ b/rtv/objects.py @@ -29,7 +29,7 @@ def patch_webbrowser(): """ Patch webbrowser on macOS to support setting BROWSER=firefox, BROWSER=chrome, etc.. - + https://bugs.python.org/issue31348 """ @@ -44,7 +44,7 @@ def patch_webbrowser(): browser = webbrowser.MacOSXOSAScript(cmdline) try: webbrowser.register(cmdline, None, browser, update_tryorder=-1) - except AttributeError: + except TypeError: # 3.7 nightly build changed the method signature # pylint: disable=unexpected-keyword-arg webbrowser.register(cmdline, None, browser, preferred=True) diff --git a/rtv/terminal.py b/rtv/terminal.py index 87829b9..0ebfa08 100644 --- a/rtv/terminal.py +++ b/rtv/terminal.py @@ -775,7 +775,7 @@ class Terminal(object): out = '\n'.join(stack) return out - + def clear_screen(self): """ In the beginning this always called touchwin(). However, a bug @@ -785,14 +785,14 @@ class Terminal(object): this in their tmux.conf or .bashrc file which can cause issues. Using clearok() instead seems to fix the problem, with the trade off of slightly more expensive screen refreshes. - + Update: It was discovered that using clearok() introduced a separate bug for urxvt users in which their screen flashed when scrolling. Heuristics were added to make it work with as many configurations as possible. It's still not perfect (e.g. urxvt + xterm-256color) will screen flash, but it should work in all cases if the user sets their TERM correctly. - + Reference: https://github.com/michael-lazar/rtv/issues/343 https://github.com/michael-lazar/rtv/issues/323