@@ -274,6 +274,7 @@ class Traceback(list):
274274 """ Traceback objects encapsulate and offer higher level
275275 access to Traceback entries.
276276 """
277+
277278 Entry = TracebackEntry
278279
279280 def __init__ (self , tb , excinfo = None ):
@@ -382,8 +383,11 @@ class ExceptionInfo(object):
382383 """ wraps sys.exc_info() objects and offers
383384 help for navigating the traceback.
384385 """
386+
385387 _striptext = ""
386- _assert_start_repr = "AssertionError(u'assert " if _PY2 else "AssertionError('assert "
388+ _assert_start_repr = (
389+ "AssertionError(u'assert " if _PY2 else "AssertionError('assert "
390+ )
387391
388392 def __init__ (self , tup = None , exprinfo = None ):
389393 import _pytest ._code
@@ -424,7 +428,7 @@ def exconly(self, tryshort=False):
424428 text = text .rstrip ()
425429 if tryshort :
426430 if text .startswith (self ._striptext ):
427- text = text [len (self ._striptext ):]
431+ text = text [len (self ._striptext ) :]
428432 return text
429433
430434 def errisinstance (self , exc ):
@@ -497,6 +501,7 @@ def match(self, regexp):
497501@attr .s
498502class FormattedExcinfo (object ):
499503 """ presenting information about failing Functions and Generators. """
504+
500505 # for traceback entries
501506 flow_marker = ">"
502507 fail_marker = "E"
@@ -556,7 +561,7 @@ def get_source(self, source, line_index=-1, excinfo=None, short=False):
556561 for line in source .lines [:line_index ]:
557562 lines .append (space_prefix + line )
558563 lines .append (self .flow_marker + " " + source .lines [line_index ])
559- for line in source .lines [line_index + 1 :]:
564+ for line in source .lines [line_index + 1 :]:
560565 lines .append (space_prefix + line )
561566 if excinfo is not None :
562567 indent = 4 if short else self ._getindent (source )
@@ -691,7 +696,7 @@ def _truncate_recursive_traceback(self, traceback):
691696 else :
692697 if recursionindex is not None :
693698 extraline = "!!! Recursion detected (same locals & position)"
694- traceback = traceback [:recursionindex + 1 ]
699+ traceback = traceback [: recursionindex + 1 ]
695700 else :
696701 extraline = None
697702
@@ -722,15 +727,19 @@ def repr_excinfo(self, excinfo):
722727 repr_chain += [(reprtraceback , reprcrash , descr )]
723728 if e .__cause__ is not None :
724729 e = e .__cause__
725- excinfo = ExceptionInfo (
726- (type (e ), e , e .__traceback__ )
727- ) if e .__traceback__ else None
730+ excinfo = (
731+ ExceptionInfo ((type (e ), e , e .__traceback__ ))
732+ if e .__traceback__
733+ else None
734+ )
728735 descr = "The above exception was the direct cause of the following exception:"
729- elif ( e .__context__ is not None and not e .__suppress_context__ ) :
736+ elif e .__context__ is not None and not e .__suppress_context__ :
730737 e = e .__context__
731- excinfo = ExceptionInfo (
732- (type (e ), e , e .__traceback__ )
733- ) if e .__traceback__ else None
738+ excinfo = (
739+ ExceptionInfo ((type (e ), e , e .__traceback__ ))
740+ if e .__traceback__
741+ else None
742+ )
734743 descr = "During handling of the above exception, another exception occurred:"
735744 else :
736745 e = None
@@ -739,7 +748,6 @@ def repr_excinfo(self, excinfo):
739748
740749
741750class TerminalRepr (object ):
742-
743751 def __str__ (self ):
744752 s = self .__unicode__ ()
745753 if _PY2 :
@@ -759,7 +767,6 @@ def __repr__(self):
759767
760768
761769class ExceptionRepr (TerminalRepr ):
762-
763770 def __init__ (self ):
764771 self .sections = []
765772
@@ -773,7 +780,6 @@ def toterminal(self, tw):
773780
774781
775782class ExceptionChainRepr (ExceptionRepr ):
776-
777783 def __init__ (self , chain ):
778784 super (ExceptionChainRepr , self ).__init__ ()
779785 self .chain = chain
@@ -792,7 +798,6 @@ def toterminal(self, tw):
792798
793799
794800class ReprExceptionInfo (ExceptionRepr ):
795-
796801 def __init__ (self , reprtraceback , reprcrash ):
797802 super (ReprExceptionInfo , self ).__init__ ()
798803 self .reprtraceback = reprtraceback
@@ -831,7 +836,6 @@ def toterminal(self, tw):
831836
832837
833838class ReprTracebackNative (ReprTraceback ):
834-
835839 def __init__ (self , tblines ):
836840 self .style = "native"
837841 self .reprentries = [ReprEntryNative (tblines )]
@@ -885,7 +889,6 @@ def __str__(self):
885889
886890
887891class ReprFileLocation (TerminalRepr ):
888-
889892 def __init__ (self , path , lineno , message ):
890893 self .path = str (path )
891894 self .lineno = lineno
@@ -903,7 +906,6 @@ def toterminal(self, tw):
903906
904907
905908class ReprLocals (TerminalRepr ):
906-
907909 def __init__ (self , lines ):
908910 self .lines = lines
909911
@@ -913,7 +915,6 @@ def toterminal(self, tw):
913915
914916
915917class ReprFuncArgs (TerminalRepr ):
916-
917918 def __init__ (self , args ):
918919 self .args = args
919920
0 commit comments