From f031278b7cf70db69b3dce63d94b65452728d080 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_whiteutils.html | 226 --------------------------------- 1 file changed, 226 deletions(-) delete mode 100644 doc/sample_html/cogapp_whiteutils.html (limited to 'doc/sample_html/cogapp_whiteutils.html') diff --git a/doc/sample_html/cogapp_whiteutils.html b/doc/sample_html/cogapp_whiteutils.html deleted file mode 100644 index c262ff9c..00000000 --- a/doc/sample_html/cogapp_whiteutils.html +++ /dev/null @@ -1,226 +0,0 @@ - - - - - - - - Coverage for cogapp/whiteutils: 92% - - - - - - - - - - - - -
- -

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

-

64

-

65

-

66

-

67

-

68

-

69

-

70

-

71

- -
-

""" Indentation utilities for Cog. 

-

    http://nedbatchelder.com/code/cog 

-

     

-

    Copyright 2004-2012, Ned Batchelder. 

-

""" 

-

 

-

from __future__ import absolute_import 

-

import re 

-

from .backward import string_types, bytes_types, to_bytes, text_types, b 

-

 

-

def whitePrefix(strings): 

-

    """ Determine the whitespace prefix common to all non-blank lines 

-

        in the argument list. 

-

    """ 

-

    # Remove all blank lines from the list 

-

    strings = [s for s in strings if s.strip() != ''] 

-

 

-

    if not strings: return '' 

-

 

-

    # Find initial whitespace chunk in the first line. 

-

    # This is the best prefix we can hope for. 

-

    pat = r'\s*' 

-

25    if isinstance(strings[0], bytes_types): 

-

        pat = to_bytes(pat) 

-

    prefix = re.match(pat, strings[0]).group(0) 

-

 

-

    # Loop over the other strings, keeping only as much of 

-

    # the prefix as matches each string. 

-

    for s in strings: 

-

        for i in range(len(prefix)): 

-

32            if prefix[i] != s[i]: 

-

                prefix = prefix[:i] 

-

                break 

-

    return prefix 

-

 

-

def reindentBlock(lines, newIndent=''): 

-

    """ Take a block of text as a string or list of lines. 

-

        Remove any common whitespace indentation. 

-

        Re-indent using newIndent, and return it as a single string. 

-

    """ 

-

    sep, nothing = '\n', '' 

-

    if isinstance(lines, bytes_types): 

-

        sep, nothing = b('\n'), b('') 

-

    if isinstance(lines, string_types): 

-

        lines = lines.split(sep) 

-

    oldIndent = whitePrefix(lines) 

-

    outLines = [] 

-

    for l in lines: 

-

        if oldIndent: 

-

            l = l.replace(oldIndent, nothing, 1) 

-

        if l and newIndent: 

-

            l = newIndent + l 

-

        outLines.append(l) 

-

    return sep.join(outLines) 

-

 

-

def commonPrefix(strings): 

-

    """ Find the longest string that is a prefix of all the strings. 

-

    """ 

-

60    if not strings: 

-

        return '' 

-

    prefix = strings[0] 

-

    for s in strings: 

-

        if len(s) < len(prefix): 

-

            prefix = prefix[:len(s)] 

-

        if not prefix: 

-

            return '' 

-

        for i in range(len(prefix)): 

-

            if prefix[i] != s[i]: 

-

                prefix = prefix[:i] 

-

                break 

-

    return prefix 

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