X-Git-Url: https://jfr.im/git/z_archive/twitter.git/blobdiff_plain/b15b92f0ab9b80bab945439062e4df2894a7eba6..8ec08295c4a156f046b60be77b79f2c97df48e09:/twitter/ansi.py diff --git a/twitter/ansi.py b/twitter/ansi.py index 0a84564..1537000 100644 --- a/twitter/ansi.py +++ b/twitter/ansi.py @@ -20,12 +20,12 @@ import sys ESC = chr(0x1B) RESET = "0" -COLOURS_NAMED = dict(zip( +COLOURS_NAMED = dict(list(zip( ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white'], [str(x) for x in range(30, 38)] -)) +))) COLOURS_MIDS = [ - colour for name, colour in COLOURS_NAMED.items() + colour for name, colour in list(COLOURS_NAMED.items()) if name not in ('black', 'white') ] @@ -47,8 +47,8 @@ class ColourMap(object): Returns an ansi colour value given a `string`. The same ansi colour value is always returned for the same string ''' - if not self._cmap.has_key(string): - self._cmap[string] = self._colourIter.next() + if string not in self._cmap: + self._cmap[string] = next(self._colourIter) return self._cmap[string] def cmdReset():