/usr/lib/python2.7/dist-packages/dicom/misc.py is in python-dicom 0.9.9-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 | # misc.py
"""Miscellaneous helper functions"""
# Copyright (c) 2009 Darcy Mason
# This file is part of pydicom, released under a modified MIT license.
# See the file license.txt included with this distribution, also
# available at http://pydicom.googlecode.com
_size_factors = dict(KB=1024, MB=1024 * 1024, GB=1024 * 1024 * 1024)
def size_in_bytes(expr):
"""Return the number of bytes for a defer_size argument to read_file()
"""
try:
return int(expr)
except ValueError:
unit = expr[-2:].upper()
if unit in _size_factors.keys():
val = float(expr[:-2]) * _size_factors[unit]
return val
else:
raise ValueError("Unable to parse length with unit '{0:s}'".format(unit))
|