@@ -312,21 +312,20 @@ def bg(self, color=None):
312312 def flush (self ):
313313 self .stream .flush ()
314314
315- class TerminfoDisabled (Exception ):
316- """
317- Raised if Terminfo is disabled.
318315
319- Only possible to see this is you're trying to generate a formatter directly
320- yourself
321- """
322316
323317
324- class _BogusTerminfo (ValueError ):
325- """Used internally."""
326318
327319
328- class TerminfoHatesOurTerminal (Exception ):
320+ class TerminfoDisabled (Exception ):
321+ """Raised if Terminfo is disabled."""
322+
323+
324+ class _BogusTerminfo (ValueError ):
325+ """Internal terminfo exception."""
326+
329327
328+ class TerminfoUnsupported (Exception ):
330329 """Raised if our terminal type is unsupported."""
331330
332331 def __init__ (self , term ):
@@ -467,7 +466,7 @@ def __init__(self, stream, term=None, encoding=None):
467466 curses .tigetstr ('setaf' ),
468467 curses .tigetstr ('setab' ))
469468 except (_BogusTerminfo , curses .error ) as e :
470- raise TerminfoHatesOurTerminal (self ._term ) from e
469+ raise TerminfoUnsupported (self ._term ) from e
471470
472471 if not all (self ._set_color ):
473472 raise TerminfoDisabled (
@@ -492,7 +491,7 @@ def bg(self, color=None):
492491
493492 @steal_docs (Formatter )
494493 def write (self , * args , ** kwargs ):
495- PlainTextFormatter .write (self , * args , ** kwargs )
494+ super () .write (self , * args , ** kwargs )
496495 try :
497496 if self ._modes :
498497 self .reset (self )
@@ -548,7 +547,7 @@ def get_formatter(stream, force_color=False):
548547 try :
549548 term = 'ansi' if force_color else None
550549 return TerminfoFormatter (stream , term = term )
551- except (curses .error , TerminfoDisabled , TerminfoHatesOurTerminal ):
550+ except (curses .error , TerminfoDisabled , TerminfoUnsupported ):
552551 # This happens if TERM is unset and possibly in more cases.
553552 # Just fall back to the PlainTextFormatter.
554553 pass
0 commit comments