22
22
# Invalid constant name "echo"
23
23
# Invalid constant name "flushout" (col 4)
24
24
# Invalid module name "wcwidth-browser"
25
- from __future__ import division , print_function
26
25
27
26
# std imports
28
27
import sys
44
43
45
44
#: printable length of highest unicode character description
46
45
LIMIT_UCS = 0x3fffd
47
- UCS_PRINTLEN = len ('{value :0x}'. format ( value = LIMIT_UCS ) )
46
+ UCS_PRINTLEN = len (f' { LIMIT_UCS :0x} ' )
48
47
49
48
50
49
def readline (term , width ):
@@ -69,7 +68,7 @@ def readline(term, width):
69
68
return text
70
69
71
70
72
- class WcWideCharacterGenerator ( object ) :
71
+ class WcWideCharacterGenerator :
73
72
"""Generator yields unicode characters of the given ``width``."""
74
73
75
74
# pylint: disable=R0903
@@ -101,7 +100,7 @@ def __next__(self):
101
100
return (ucs , name )
102
101
103
102
104
- class WcCombinedCharacterGenerator ( object ) :
103
+ class WcCombinedCharacterGenerator :
105
104
"""Generator yields unicode characters with combining."""
106
105
107
106
# pylint: disable=R0903
@@ -148,11 +147,8 @@ def __next__(self):
148
147
continue
149
148
return (ucs , name )
150
149
151
- # python 2.6 - 3.3 compatibility
152
- next = __next__
153
150
154
-
155
- class Style (object ):
151
+ class Style :
156
152
"""Styling decorator class instance for terminal output."""
157
153
158
154
# pylint: disable=R0903
@@ -184,7 +180,7 @@ def __init__(self, **kwargs):
184
180
setattr (self , key , val )
185
181
186
182
187
- class Screen ( object ) :
183
+ class Screen :
188
184
"""Represents terminal style, data dimensions, and drawables."""
189
185
190
186
intro_msg_fmt = ('Delimiters ({delim}) should align, '
@@ -217,8 +213,7 @@ def head_item(self):
217
213
"""Text of a single column heading."""
218
214
delimiter = self .style .attr_minor (self .style .delimiter )
219
215
hint = self .style .header_hint * self .wide
220
- heading = ('{delimiter}{hint}{delimiter}'
221
- .format (delimiter = delimiter , hint = hint ))
216
+ heading = f'{ delimiter } { hint } { delimiter } '
222
217
223
218
def alignment (* args ):
224
219
if self .style .alignment == 'right' :
@@ -264,7 +259,7 @@ def page_size(self):
264
259
return self .num_rows * self .num_columns
265
260
266
261
267
- class Pager ( object ) :
262
+ class Pager :
268
263
"""A less(1)-like browser for browsing unicode characters."""
269
264
# pylint: disable=too-many-instance-attributes
270
265
@@ -570,10 +565,10 @@ def draw_status(self, writer, idx):
570
565
if idx == self .last_page :
571
566
last_end = '(END)'
572
567
else :
573
- last_end = '/{0}' . format ( self .last_page )
568
+ last_end = f '/{ self .last_page } '
574
569
txt = ('Page {idx}{last_end} - '
575
570
'{q} to quit, [keys: {keyset}]'
576
- .format (idx = style .attr_minor ('{0}' . format ( idx ) ),
571
+ .format (idx = style .attr_minor (f' { idx } ' ),
577
572
last_end = style .attr_major (last_end ),
578
573
keyset = style .attr_major ('kjfbvc12-=' ),
579
574
q = style .attr_minor ('q' )))
0 commit comments