Best Python code snippet using slash
error.py
Source:error.py  
...104        if self.traceback is not None:105            return self.traceback.cause.func_name106    def __repr__(self):107        return '<{0.__class__.__name__}: {0.message}>'.format(self)108    def get_detailed_traceback_str(self):109        """Returns a formatted traceback string for the exception caught110        """111        if self._cached_detailed_traceback_str is None:112            stream = StringIO()113            f = Formatter(stream, indentation_string='  ')114            f.writeln("Traceback (most recent call last):")115            with f.indented():116                for frame in self.traceback.frames:117                    with get_no_deprecations_context():118                        locals_ = frame.locals119                        globals_ = frame.globals120                    f.writeln('File "{f.filename}", line {f.lineno}, in {f.func_name}:'.format(f=frame))121                    with f.indented():122                        f.writeln('>', frame.code_line.strip() or '?')123                        with f.indented():124                            for title, vars in [('globals', globals_), ('locals', locals_)]:125                                for index, (var_name, var_repr) in enumerate(vars.items()):126                                    if index == 0:127                                        f.writeln(title)128                                        f.indent()129                                    f.writeln(' - {}: {}'.format(var_name, var_repr['value']))130                            f.dedent()131            self._cached_detailed_traceback_str = stream.getvalue()132        return self._cached_detailed_traceback_str133    def get_detailed_str(self):134        return '{}*** {}'.format(...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
