Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/nbconvert/writers/debug.py: 40%

10 statements  

« prev     ^ index     » next       coverage.py v7.2.7, created at 2023-07-01 06:54 +0000

1""" 

2Contains debug writer. 

3""" 

4 

5from pprint import pprint 

6 

7from .base import WriterBase 

8 

9# ----------------------------------------------------------------------------- 

10# Copyright (c) 2013, the IPython Development Team. 

11# 

12# Distributed under the terms of the Modified BSD License. 

13# 

14# The full license is in the file COPYING.txt, distributed with this software. 

15# ----------------------------------------------------------------------------- 

16 

17# ----------------------------------------------------------------------------- 

18# Imports 

19# ----------------------------------------------------------------------------- 

20 

21 

22# ----------------------------------------------------------------------------- 

23# Classes 

24# ----------------------------------------------------------------------------- 

25 

26 

27class DebugWriter(WriterBase): 

28 """Consumes output from nbconvert export...() methods and writes useful 

29 debugging information to the stdout. The information includes a list of 

30 resources that were extracted from the notebook(s) during export.""" 

31 

32 def write(self, output, resources, notebook_name="notebook", **kw): 

33 """ 

34 Consume and write Jinja output. 

35 

36 See base for more... 

37 """ 

38 

39 if isinstance(resources["outputs"], dict): 

40 print("outputs extracted from %s" % notebook_name) 

41 print("-" * 80) 

42 pprint(resources["outputs"], indent=2, width=70) # noqa 

43 else: 

44 print("no outputs extracted from %s" % notebook_name) 

45 print("=" * 80)