aboutsummaryrefslogtreecommitdiff
path: root/pydora/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'pydora/utils.py')
-rw-r--r--pydora/utils.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/pydora/utils.py b/pydora/utils.py
index ca40095..6675773 100644
--- a/pydora/utils.py
+++ b/pydora/utils.py
@@ -13,15 +13,15 @@ class TerminalPlatformUnsupported(Exception):
13 pass 13 pass
14 14
15 15
16class Colors(object): 16class Colors:
17 17
18 def __wrap_with(raw_code): 18 def __wrap_with(raw_code):
19 @staticmethod 19 @staticmethod
20 def inner(text, bold=False): 20 def inner(text, bold=False):
21 code = raw_code 21 code = raw_code
22 if bold: 22 if bold:
23 code = u"1;{}".format(code) 23 code = "1;{}".format(code)
24 return u"\033[{}m{}\033[0m".format(code, text) 24 return "\033[{}m{}\033[0m".format(code, text)
25 return inner 25 return inner
26 26
27 red = __wrap_with("31") 27 red = __wrap_with("31")
@@ -33,7 +33,7 @@ class Colors(object):
33 white = __wrap_with("37") 33 white = __wrap_with("37")
34 34
35 35
36class PosixEchoControl(object): 36class PosixEchoControl:
37 """Posix Console Echo Control Driver 37 """Posix Console Echo Control Driver
38 38
39 Uses termios on POSIX compliant platforms to control console echo. Is not 39 Uses termios on POSIX compliant platforms to control console echo. Is not
@@ -63,7 +63,7 @@ class PosixEchoControl(object):
63 self.termios.tcsetattr(handle, self.termios.TCSANOW, attrs) 63 self.termios.tcsetattr(handle, self.termios.TCSANOW, attrs)
64 64
65 65
66class Win32EchoControl(object): 66class Win32EchoControl:
67 """Windows Console Echo Control Driver 67 """Windows Console Echo Control Driver
68 68
69 This uses the console API from WinCon.h and ctypes to control console echo 69 This uses the console API from WinCon.h and ctypes to control console echo
@@ -109,7 +109,7 @@ class Win32EchoControl(object):
109 self._SetConsoleMode(stdin, mode & self.DISABLE_ECHO_INPUT) 109 self._SetConsoleMode(stdin, mode & self.DISABLE_ECHO_INPUT)
110 110
111 111
112class Screen(object): 112class Screen:
113 113
114 def __init__(self): 114 def __init__(self):
115 try: 115 try:
@@ -201,8 +201,8 @@ class SilentPopen(subprocess.Popen):
201 kwargs["stdin"] = subprocess.PIPE 201 kwargs["stdin"] = subprocess.PIPE
202 kwargs["stdout"] = subprocess.PIPE 202 kwargs["stdout"] = subprocess.PIPE
203 kwargs["stderr"] = self._dev_null 203 kwargs["stderr"] = self._dev_null
204 super(SilentPopen, self).__init__(*args, **kwargs) 204 super().__init__(*args, **kwargs)
205 205
206 def __del__(self): 206 def __del__(self):
207 self._dev_null.close() 207 self._dev_null.close()
208 super(SilentPopen, self).__del__() 208 super().__del__()