This file is indexed.

/usr/lib/python2.7/dist-packages/mutagen/id3/_util.py is in python-mutagen 1.36-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
 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# -*- coding: utf-8 -*-

# Copyright (C) 2005  Michael Urman
#               2013  Christoph Reiter
#               2014  Ben Ockmore
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.

from mutagen._compat import long_, integer_types, PY3
from mutagen._util import MutagenError


def is_valid_frame_id(frame_id):
    return frame_id.isalnum() and frame_id.isupper()


class ID3SaveConfig(object):

    def __init__(self, v2_version=4, v23_separator=None):
        assert v2_version in (3, 4)
        self.v2_version = v2_version
        self.v23_separator = v23_separator


class error(MutagenError):
    pass


class ID3NoHeaderError(error, ValueError):
    pass


class ID3UnsupportedVersionError(error, NotImplementedError):
    pass


class ID3EncryptionUnsupportedError(error, NotImplementedError):
    pass


class ID3JunkFrameError(error):
    pass


class unsynch(object):
    @staticmethod
    def decode(value):
        fragments = bytearray(value).split(b'\xff')
        if len(fragments) > 1 and not fragments[-1]:
            raise ValueError('string ended unsafe')

        for f in fragments[1:]:
            if (not f) or (f[0] >= 0xE0):
                raise ValueError('invalid sync-safe string')

            if f[0] == 0x00:
                del f[0]

        return bytes(bytearray(b'\xff').join(fragments))

    @staticmethod
    def encode(value):
        fragments = bytearray(value).split(b'\xff')
        for f in fragments[1:]:
            if (not f) or (f[0] >= 0xE0) or (f[0] == 0x00):
                f.insert(0, 0x00)
        return bytes(bytearray(b'\xff').join(fragments))


class _BitPaddedMixin(object):

    def as_str(self, width=4, minwidth=4):
        return self.to_str(self, self.bits, self.bigendian, width, minwidth)

    @staticmethod
    def to_str(value, bits=7, bigendian=True, width=4, minwidth=4):
        mask = (1 << bits) - 1

        if width != -1:
            index = 0
            bytes_ = bytearray(width)
            try:
                while value:
                    bytes_[index] = value & mask
                    value >>= bits
                    index += 1
            except IndexError:
                raise ValueError('Value too wide (>%d bytes)' % width)
        else:
            # PCNT and POPM use growing integers
            # of at least 4 bytes (=minwidth) as counters.
            bytes_ = bytearray()
            append = bytes_.append
            while value:
                append(value & mask)
                value >>= bits
            bytes_ = bytes_.ljust(minwidth, b"\x00")

        if bigendian:
            bytes_.reverse()
        return bytes(bytes_)

    @staticmethod
    def has_valid_padding(value, bits=7):
        """Whether the padding bits are all zero"""

        assert bits <= 8

        mask = (((1 << (8 - bits)) - 1) << bits)

        if isinstance(value, integer_types):
            while value:
                if value & mask:
                    return False
                value >>= 8
        elif isinstance(value, bytes):
            for byte in bytearray(value):
                if byte & mask:
                    return False
        else:
            raise TypeError

        return True


class BitPaddedInt(int, _BitPaddedMixin):

    def __new__(cls, value, bits=7, bigendian=True):

        mask = (1 << (bits)) - 1
        numeric_value = 0
        shift = 0

        if isinstance(value, integer_types):
            if value < 0:
                raise ValueError
            while value:
                numeric_value += (value & mask) << shift
                value >>= 8
                shift += bits
        elif isinstance(value, bytes):
            if bigendian:
                value = reversed(value)
            for byte in bytearray(value):
                numeric_value += (byte & mask) << shift
                shift += bits
        else:
            raise TypeError

        if isinstance(numeric_value, int):
            self = int.__new__(BitPaddedInt, numeric_value)
        else:
            self = long_.__new__(BitPaddedLong, numeric_value)

        self.bits = bits
        self.bigendian = bigendian
        return self

if PY3:
    BitPaddedLong = BitPaddedInt
else:
    class BitPaddedLong(long_, _BitPaddedMixin):
        pass


class ID3BadUnsynchData(error, ValueError):
    """Deprecated"""


class ID3BadCompressedData(error, ValueError):
    """Deprecated"""


class ID3TagError(error, ValueError):
    """Deprecated"""


class ID3Warning(error, UserWarning):
    """Deprecated"""