This file is indexed.

/usr/share/pyshared/rest2web/printing.py is in rest2web 0.5.2~alpha+svn-r248-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
# printing.py

# Subversion Details
# $LastChangedDate: 2006-01-05 12:06:07 +0000 (Thu, 05 Jan 2006) $
# $LastChangedBy: fuzzyman $
# $HeadURL: https://svn.rest2web.python-hosting.com/trunk/rest2web/printing.py $
# $LastChangedRevision: 155 $

# Helper functions for rest2web
# Primarily functions that handle the docutils/encodings stuff
# http://www.voidspace.org.uk/python/rest2web/

# Copyright Michael Foord, 2004 - 2006.
# Released subject to the BSD License
# Please see http://www.voidspace.org.uk/python/license.shtml

# For information about bugfixes, updates and support, please join the
# rest2web mailing list.
# https://lists.sourceforge.net/lists/listinfo/rest2web-develop
# Comments, suggestions and bug reports welcome.
# Scripts maintained at http://www.voidspace.org.uk/python/index.shtml
# E-mail fuzzyman@voidspace.org.uk

"""
This module provides two print functions.

If StandOut is in use, then ``standout`` should be used, otherwise ``standard``
should be used.

If you use ``standout`` you can pass in a verbosity level for the current
message. (This parameter will be ignored by the ``standard`` function.)

It also defines four constants for message priority levels :

    OVERRIDE
    WARN
    ACTION
    INFO
    
The VERBOSITY dictionary maps different verbosity levels (integers) to the
right setting to pass to StandOut.
"""

import sys

__all__ = (
    'WARN',
    'ACTION',
    'INFO',
    'OVERRIDE',
    'standard',
    'standout',
    'VERBOSITY',
)

OVERRIDE = 9
WARN = 7
ACTION = 3
INFO = 1

# maps verbosity level to the right setting
THRESHOLD = {
    # verbose (default)
    0: 1,
    # Actions & Warnings
    1: 3,
    # Warnings Only
    2: 7,
}

def out(line, level=INFO, newline=True):
    """Print a line if StandOut is enabled."""
    global ERROR_STATUS
    if level == WARN:
        ERROR_STATUS += 1
        stream = sys.stderr
    else:
        stream = sys.stdout
    stream.write(line, level)
    if newline:
        stream.write('\n', level)
    else:
        stream.write(' ', level)

ERROR_STATUS = 0


"""
TODO
====

Find a way of using this from within plugins.

CHANGELOG
=========

2006/08/21
----------

Changed VERBOSITY to THRESHOLD.

Changed standout to out.

This is support for standout version 3.


2006/04/05
----------

First implementation.

"""