This file is indexed.

/usr/lib/python3/dist-packages/txfixtures/phantomjs.py is in python3-txfixtures 0.2.6-1.

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
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.remote import webdriver

from fixtures import TempDir

from txfixtures.service import Service

FORMAT = (
    "\[{levelname} +- +{Y}-{m}-{d}T{H}:{M}:{S}\.{msecs}Z\] {name} - {message}")


class PhantomJS(Service):
    """Start and stop a `phantomjs` process in the background. """

    def __init__(self, phantomjs="phantomjs", args=(), **kwargs):
        command = [phantomjs] + list(args)
        super(PhantomJS, self).__init__(command, **kwargs)

        #: Desired capabilities that will be passed to the webdriver.
        self.desiredCapabilities = DesiredCapabilities.PHANTOMJS

        #: A WebDriver instance pointing to the phantomjs process spawned
        #: by this fixture.
        self.webdriver = None

        self.expectOutput("running on port")
        self.setOutputFormat(FORMAT)

    def _setUp(self):
        self.expectPort(self.allocatePort())
        self._cookies = self.useFixture(TempDir()).join("phantomjs.cookies")
        super(PhantomJS, self)._setUp()
        url = "http://localhost:%d/wd/hub" % self.protocol.expectedPort
        self.webdriver = webdriver.WebDriver(
            command_executor=url,
            desired_capabilities=self.desiredCapabilities)

    @property
    def _args(self):
        return self.command[:] + [
            "--webdriver=%d" % self.protocol.expectedPort,
            "--cookies-file=%s" % self._cookies,
        ]