From a6f8fd26ab1c019dba1bad590c5170a79d575f36 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sun, 20 Sep 2015 10:31:52 -0400 Subject: Latest sample HTML report --- doc/sample_html/cogapp_makefiles_py.html | 217 +++++++++++++++++++++++++++++++ 1 file changed, 217 insertions(+) create mode 100644 doc/sample_html/cogapp_makefiles_py.html (limited to 'doc/sample_html/cogapp_makefiles_py.html') diff --git a/doc/sample_html/cogapp_makefiles_py.html b/doc/sample_html/cogapp_makefiles_py.html new file mode 100644 index 0000000..0421c1f --- /dev/null +++ b/doc/sample_html/cogapp_makefiles_py.html @@ -0,0 +1,217 @@ + + + + + + + + + + + Coverage for cogapp/makefiles.py: 64.29% + + + + + + + + + + + + +
+ Hide keyboard shortcuts +

Hot-keys on this page

+
+

+ r + m + x + p   toggle line displays +

+

+ j + k   next/prev highlighted chunk +

+

+ 0   (zero) top of page +

+

+ 1   (one) first highlighted chunk +

+
+
+ +
+ + + + + +
+

1

+

2

+

3

+

4

+

5

+

6

+

7

+

8

+

9

+

10

+

11

+

12

+

13

+

14

+

15

+

16

+

17

+

18

+

19

+

20

+

21

+

22

+

23

+

24

+

25

+

26

+

27

+

28

+

29

+

30

+

31

+

32

+

33

+

34

+

35

+

36

+

37

+

38

+

39

+

40

+

41

+

42

+

43

+

44

+

45

+

46

+

47

+

48

+

49

+

50

+

51

+

52

+

53

+

54

+

55

+

56

+

57

+

58

+

59

+

60

+

61

+

62

+

63

+ +
+

""" Dictionary-to-filetree functions, to create test files for testing. 

+

    http://nedbatchelder.com/code/cog 

+

 

+

    Copyright 2004-2015, Ned Batchelder. 

+

""" 

+

 

+

from __future__ import absolute_import 

+

import os.path 

+

from .whiteutils import reindentBlock 

+

from .backward import string_types, bytes_types 

+

 

+

__version__ = '1.0.20040126' 

+

__all__ = ['makeFiles', 'removeFiles'] 

+

 

+

def makeFiles(d, basedir='.'): 

+

    """ Create files from the dictionary `d`, in the directory named by `basedir`. 

+

    """ 

+

    for name, contents in d.items(): 

+

        child = os.path.join(basedir, name) 

+

        if isinstance(contents, string_types): 

+

            mode = 'w' 

+

22 ↛ 24 [?]            if isinstance(contents, bytes_types): 

+

                mode += "b" 

+

            f = open(child, mode) 

+

            contents = reindentBlock(contents) 

+

            f.write(contents) 

+

            f.close() 

+

        else: 

+

29 ↛ 31 [?]            if not os.path.exists(child): 

+

                os.mkdir(child) 

+

            makeFiles(contents, child) 

+

 

+

def removeFiles(d, basedir='.'): 

+

    """ Remove the files created by makeFiles. 

+

        Directories are removed if they are empty. 

+

    """ 

+

    for name, contents in d.items(): 

+

        child = os.path.join(basedir, name) 

+

        if isinstance(contents, string_types): 

+

            os.remove(child) 

+

        else: 

+

            removeFiles(contents, child) 

+

            if not os.listdir(child): 

+

                os.rmdir(child) 

+

 

+

if __name__ == '__main__':      #pragma: no cover 

+

    # Try it a little. 

+

    d = { 

+

        'test_makefiles': { 

+

            'hey.txt': """\ 

+

                        This is hey.txt. 

+

                        It's very simple. 

+

                        """, 

+

            'subdir': { 

+

                'fooey': """\ 

+

                            # Fooey 

+

                                Kablooey 

+

                            Ew. 

+

                            """ 

+

            } 

+

        } 

+

    } 

+

    makeFiles(d) 

+ +
+
+ + + + + -- cgit v1.2.1