/usr/lib/python3/dist-packages/dvdvideo/utils.py is in python3-dvdvideo 0.20140413.
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  | """
@copyright: 2009 Bastian Blank <waldi@debian.org>
@license: GNU GPL-3
"""
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
class ProgressMeter:
    def __init__(self, stream, total, count=0):
        self.stream = stream
        self.total = total
        self.count = count
        self.meter_ticks = 60
        stream.set_meter(self)
    def clear(self):
        self.stream.write_real(chr(27) + '[M' + chr(27) + '[G')
    def display(self):
        value = int(self.count / self.total * self.meter_ticks)
        meter = ['[%s>%s]' % ('-' * value, ' ' * (self.meter_ticks - value))]
        meter.append('%d/%d %d%%' % (self.count, self.total, self.count / self.total * 100))
        self.stream.write_real(' '.join(meter))
        self.stream.flush()
    def set(self, count):
        self.count = min(count, self.total)
        self.clear()
        self.display()
    def update(self, count):
        self.set(self.count + count)
    def write(self, str):
        self.clear()
        self.stream.write_real(str)
        self.display()
class ProgressStream:
    def __init__(self, stream):
        self.stream = stream
        self._meter = None
    def clear_meter(self):
        self.set_meter(None)
    def flush(self):
        self.stream.flush()
    def set_meter(self, meter):
        if self._meter:
            self._meter.clear()
        self._meter = meter
        if self._meter:
            self._meter.display()
    def write(self, str):
        if self._meter:
            self._meter.write(str)
        else:
            self.stream.write(str)
    def write_real(self, str):
        return self.stream.write(str)
 |