This file is indexed.

/usr/lib/python2.7/dist-packages/wx-2.6-gtk2-unicode/wx/py/pseudo.py is in python-wxgtk2.6 2.6.3.2.2-5ubuntu4.

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
"""Provides a variety of classes to create pseudo keywords and pseudo files."""

__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id: pseudo.py,v 1.5 2004/02/13 02:47:58 PKO Exp $"
__revision__ = "$Revision: 1.5 $"[11:-2]


class PseudoKeyword:
    """A callable class that calls a method passed as a parameter.

    Good for creating a pseudo keyword in the python runtime
    environment. The keyword is really an object that has a repr()
    that calls itself which calls the method that was passed in the
    init of the object. All this just to avoid having to type in the
    closing parens on a method. So, for example:

        >>> quit = PseudoKeyword(SomeObject.someMethod)
        >>> quit

    SomeObject.someMethod gets executed as if it had been called
    directly and the user didn't have to type the parens, like
    'quit()'. This technique is most applicable for pseudo keywords
    like quit, exit and help.

    If SomeObject.someMethod can take parameters, they can still be
    passed by using the keyword in the traditional way with parens."""

    def __init__(self, method):
        """Create a callable object that executes method when called."""

        if callable(method):
            self.method = method
        else:
            raise ValueError, 'method must be callable'

    def __call__(self, *args, **kwds):
        self.method(*args, **kwds)

    def __repr__(self):
        self()
        return ''


class PseudoFile:

    def __init__(self):
        """Create a file-like object."""
        pass

    def readline(self):
        pass

    def write(self, s):
        pass

    def writelines(self, l):
        map(self.write, l)

    def flush(self):
        pass

    def isatty(self):
        pass


class PseudoFileIn(PseudoFile):

    def __init__(self, readline, readlines=None):
        if callable(readline):
            self.readline = readline
        else:
            raise ValueError, 'readline must be callable'
        if callable(readlines):
            self.readlines = readlines

    def isatty(self):
        return 1
        
        
class PseudoFileOut(PseudoFile):

    def __init__(self, write):
        if callable(write):
            self.write = write
        else:
            raise ValueError, 'write must be callable'

    def isatty(self):
        return 1


class PseudoFileErr(PseudoFile):

    def __init__(self, write):
        if callable(write):
            self.write = write
        else:
            raise ValueError, 'write must be callable'

    def isatty(self):
        return 1