This file is indexed.

/usr/lib/python3/dist-packages/pyvisa-py/common.py is in python3-pyvisa-py 0.2-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
# -*- coding: utf-8 -*-
"""
    pyvisa-sim.common
    ~~~~~~~~~~~~~~~~~

    Common code.

    :copyright: 2014 by PyVISA-sim Authors, see AUTHORS for more details.
    :license: MIT, see LICENSE for more details.
"""

from __future__ import division, unicode_literals, print_function, absolute_import

import logging
import sys

from pyvisa import logger

logger = logging.LoggerAdapter(logger, {'backend': 'py'})


class MockInterface(object):

    def __init__(self, resource_name):
        self.resource_name = resource_name


class NamedObject(object):
    """A class to construct named sentinels.
    """

    def __init__(self, name):
        self.name = name

    def __repr__(self):
        return '<%s>' % self.name

    __str__ = __repr__


if sys.version >= '3':
    def iter_bytes(data, mask=None, send_end=False):

        if send_end and mask is None:
            raise ValueError('send_end requires a valid mask.')

        if mask is None:
            for d in data[:]:
                yield bytes([d])

        else:
            for d in data[:-1]:
                yield bytes([d & ~mask])

            if send_end:
                yield bytes([data[-1] | ~mask])
            else:
                yield bytes([data[-1] & ~mask])

    int_to_byte = lambda val: bytes([val])
    last_int = lambda val: val[-1]
else:
    def iter_bytes(data, mask=None, send_end=False):

        if send_end and mask is None:
            raise ValueError('send_end requires a valid mask.')

        if mask is None:
            for d in data[:]:
                yield d
        else:
            for d in data[:-1]:
                yield chr(ord(d) & ~mask)

            if send_end:
                yield chr(ord(data[-1]) | ~mask)
            else:
                yield chr(ord(data[-1]) & ~mask)

    int_to_byte = chr
    last_int = lambda val: ord(val[-1])