PEP8'd helpers, history, page.py
This commit is contained in:
@@ -16,6 +16,7 @@ from .exceptions import ProgramError
|
|||||||
__all__ = ['open_browser', 'clean', 'wrap_text', 'strip_textpad',
|
__all__ = ['open_browser', 'clean', 'wrap_text', 'strip_textpad',
|
||||||
'strip_subreddit_url', 'humanize_timestamp', 'open_editor']
|
'strip_subreddit_url', 'humanize_timestamp', 'open_editor']
|
||||||
|
|
||||||
|
|
||||||
def clean(string, n_cols=None):
|
def clean(string, n_cols=None):
|
||||||
"""
|
"""
|
||||||
Required reading!
|
Required reading!
|
||||||
@@ -49,6 +50,7 @@ def clean(string, n_cols=None):
|
|||||||
string = string.encode('utf-8')
|
string = string.encode('utf-8')
|
||||||
return string
|
return string
|
||||||
|
|
||||||
|
|
||||||
def open_editor(data=''):
|
def open_editor(data=''):
|
||||||
"""
|
"""
|
||||||
Open a temporary file using the system's default editor.
|
Open a temporary file using the system's default editor.
|
||||||
@@ -124,6 +126,7 @@ def open_browser(url):
|
|||||||
webbrowser.open_new_tab(url)
|
webbrowser.open_new_tab(url)
|
||||||
curses.doupdate()
|
curses.doupdate()
|
||||||
|
|
||||||
|
|
||||||
def wrap_text(text, width):
|
def wrap_text(text, width):
|
||||||
"""
|
"""
|
||||||
Wrap text paragraphs to the given character width while preserving newlines.
|
Wrap text paragraphs to the given character width while preserving newlines.
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ def save_history(history):
|
|||||||
# Ignore unicode URLS, may want to handle this at some point
|
# Ignore unicode URLS, may want to handle this at some point
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
||||||
class OrderedSet(object):
|
class OrderedSet(object):
|
||||||
"""
|
"""
|
||||||
A simple implementation of an ordered set. A set is used to check
|
A simple implementation of an ordered set. A set is used to check
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ from .curses_helpers import (Color, show_notification, show_help, text_input,
|
|||||||
from .docs import COMMENT_EDIT_FILE, SUBMISSION_FILE
|
from .docs import COMMENT_EDIT_FILE, SUBMISSION_FILE
|
||||||
|
|
||||||
__all__ = ['Navigator', 'BaseController', 'BasePage']
|
__all__ = ['Navigator', 'BaseController', 'BasePage']
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Navigator(object):
|
class Navigator(object):
|
||||||
"""
|
"""
|
||||||
Handles math behind cursor movement and screen paging.
|
Handles math behind cursor movement and screen paging.
|
||||||
@@ -155,6 +155,7 @@ class Navigator(object):
|
|||||||
else:
|
else:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class SafeCaller(object):
|
class SafeCaller(object):
|
||||||
|
|
||||||
def __init__(self, window):
|
def __init__(self, window):
|
||||||
@@ -186,6 +187,7 @@ class SafeCaller(object):
|
|||||||
_logger.exception(e)
|
_logger.exception(e)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class BaseController(object):
|
class BaseController(object):
|
||||||
"""
|
"""
|
||||||
Event handler for triggering functions with curses keypresses.
|
Event handler for triggering functions with curses keypresses.
|
||||||
|
|||||||
Reference in New Issue
Block a user