/usr/lib/python2.7/dist-packages/pyvisa/compat/struct.py is in python-pyvisa 1.8-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 | # -*- coding: utf-8 -*-
"""
pyvisa.compat.struct
~~~~~~~~~~~~~~~~~~~~~~~~~
Python 2/3 compatibility for struct module
:copyright: 2015, PSF
:license: PSF License
"""
from __future__ import division, unicode_literals, print_function, absolute_import
import sys
import struct
# we always want the exception to be able to catch it
error = struct.error
# compatibility for unicode literals was introduced in 2.7.8
# if we're above that there is nothing to do except aliasing
if sys.hexversion >= 0x02070800:
pack = struct.pack
pack_into = struct.pack_into
unpack = struct.unpack
unpack_from = struct.unpack_from
calcsize = struct.calcsize
else:
def pack(fmt, *args):
return struct.pack(str(fmt), *args)
def pack_into(fmt, *args, **argk):
return struct.pack_into(str(fmt), *args, **argk)
def unpack(fmt, string):
return struct.unpack(str(fmt), string)
def unpack_from(fmt, *args, **kwargs):
return struct.unpack_from(str(fmt), *args, **kwargs)
def calcsize(fmt):
return struct.calcsize(str(fmt))
|