This file is indexed.

/usr/share/pyshared/myghty/buffer.py is in python-myghty 1.1-5.

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
# $Id: buffer.py 2133 2006-09-06 18:52:56Z dairiki $
# buffer.py - string buffering functions for Myghty
# Copyright (C) 2004, 2005 Michael Bayer mike_mp@zzzcomputing.com
#
# This module is part of Myghty and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
#
#

"""Buffer is an output handling object which corresponds to the Python file object
interface."""

from myghty.util import *
import string

class BufferDecorator(object):
    """allows flexible combinations of buffers.  """
    
    def __init__(self, buffer):
        self.buffer = buffer
        
    def __getattr__(self, name):
        return getattr(self.buffer, name)
        
    def __repr__(self):
        return "BufferDecorator, enclosing %s." % repr(self.buffer)

class FunctionBuffer(BufferDecorator):
    def __init__(self, func):
        self.func = func
    def write(self, s):
        self.func(s)

class LinePrinter(BufferDecorator):
    def write(self, s):
        self.buffer.write(s + "\n")
    def writelines(self, list):
        self.buffer.writelines([s + "\n" for s in list])


class LogFormatter(BufferDecorator):
    def __init__(self, buffer, identifier, id_threads = False, autoflush = True):
        BufferDecorator.__init__(self, buffer)
        self.identifier = identifier
        self.id_threads = id_threads
        self.autoflush = autoflush
        
    def _formatline(self, s):
        if self.id_threads:
            return "[%s] [pid:%d tid:%d] %s" % (self.identifier, pid(), thread_id(), string.rstrip(s))
        else:
            return "[%s] %s" % (self.identifier, string.rstrip(s))
        
    def write(self, s):
        self.buffer.write(self._formatline(s))
        if self.autoflush:
            self.flush()
        
    def writelines(self, lines):
        for line in lines:
            self.buffer.write(self._formatline(line))