This file is indexed.

/usr/share/pyshared/irc/connection.py is in python-irc 8.5.3+dfsg-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
from __future__ import absolute_import

import socket
try:
    from importlib import import_module
except ImportError:
    # for Python 2.6 compatibility
    import_module = __import__

identity = lambda x: x

class Factory(object):
    """
    A class for creating custom socket connections.

    To create a simple connection:

        server_address = ('localhost', 80)
        Factory()(server_address)

    To create an SSL connection:

        Factory(wrapper=ssl.wrap_socket)(server_address)

    To create an SSL connection with parameters to wrap_socket:

        wrapper = functools.partial(ssl.wrap_socket, ssl_cert=get_cert())
        Factory(wrapper=wrapper)(server_address)

    To create an IPv6 connection:

        Factory(ipv6=True)(server_address)

    Note that Factory doesn't save the state of the socket itself. The
    caller must do that, as necessary. As a result, the Factory may be
    re-used to create new connections with the same settings.

    """

    family = socket.AF_INET

    def __init__(self, bind_address=('', 0), wrapper=identity, ipv6=False):
        self.bind_address = bind_address
        self.wrapper = wrapper
        if ipv6:
            self.family = socket.AF_INET6

    def from_legacy_params(self, localaddress='', localport=0, ssl=False,
            ipv6=False):
        if localaddress or localport:
            self.bind_address = (localaddress, localport)
        if ssl:
            self.wrapper = import_module('ssl').wrap_socket
        if ipv6:
            self.family = socket.AF_INET6

    def connect(self, server_address):
        sock = self.wrapper(socket.socket(self.family, socket.SOCK_STREAM))
        sock.bind(self.bind_address)
        sock.connect(server_address)
        return sock
    __call__ = connect