Also move FailedUnicode to powerline/lib/unicode
This commit is contained in:
parent
d8562256c1
commit
839038d58e
|
@ -7,7 +7,7 @@ import logging
|
|||
|
||||
from powerline.colorscheme import Colorscheme
|
||||
from powerline.lib.config import ConfigLoader
|
||||
from powerline.lib.unicode import safe_unicode
|
||||
from powerline.lib.unicode import safe_unicode, FailedUnicode
|
||||
|
||||
from threading import Lock, Event
|
||||
|
||||
|
@ -15,19 +15,6 @@ from threading import Lock, Event
|
|||
DEFAULT_SYSTEM_CONFIG_DIR = None
|
||||
|
||||
|
||||
class FailedUnicode(unicode):
|
||||
'''Builtin ``unicode`` (``str`` in python 3) subclass indicating fatal
|
||||
error.
|
||||
|
||||
If your code for some reason wants to determine whether `.render()` method
|
||||
failed it should check returned string for being a FailedUnicode instance.
|
||||
Alternatively you could subclass Powerline and override `.render()` method
|
||||
to do what you like in place of catching the exception and returning
|
||||
FailedUnicode.
|
||||
'''
|
||||
pass
|
||||
|
||||
|
||||
def find_config_file(search_paths, config_file):
|
||||
config_file += '.json'
|
||||
for path in search_paths:
|
||||
|
|
|
@ -43,3 +43,16 @@ def safe_unicode(s):
|
|||
return unicode(s, getpreferredencoding())
|
||||
except Exception as e:
|
||||
return safe_unicode(e)
|
||||
|
||||
|
||||
class FailedUnicode(unicode):
|
||||
'''Builtin ``unicode`` (``str`` in python 3) subclass indicating fatal
|
||||
error.
|
||||
|
||||
If your code for some reason wants to determine whether `.render()` method
|
||||
failed it should check returned string for being a FailedUnicode instance.
|
||||
Alternatively you could subclass Powerline and override `.render()` method
|
||||
to do what you like in place of catching the exception and returning
|
||||
FailedUnicode.
|
||||
'''
|
||||
pass
|
||||
|
|
Loading…
Reference in New Issue