/usr/lib/python2.7/dist-packages/pyvisa/compat/__init__.py is in python-pyvisa 1.8-4.
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 | # -*- coding: utf-8 -*-
"""
pyvisa.compat
~~~~~~~~~~~~~
Compatibility layer.
:copyright: 2014 by PyVISA Authors, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import division, unicode_literals, print_function, absolute_import
import sys
PYTHON3 = sys.version >= '3'
if PYTHON3:
string_types = str
def u(x):
return x
integer_types = (int, )
input = input
else:
string_types = basestring
import codecs
def u(x):
return codecs.unicode_escape_decode(x)[0]
integer_types = (int, long)
input = raw_input
if sys.version_info < (2, 7):
try:
# noinspection PyPackageRequirements
import unittest2 as unittest
except ImportError:
raise Exception("Testing PyVISA in Python 2.6 requires package 'unittest2'")
else:
import unittest
try:
from collections import OrderedDict
except ImportError:
from .ordereddict import OrderedDict
try:
from logging import NullHandler
except ImportError:
from .nullhandler import NullHandler
try:
from subprocess import check_output
except ImportError:
from .check_output import check_output
def with_metaclass(meta, *bases):
"""Create a base class with a metaclass."""
# This requires a bit of explanation: the basic idea is to make a dummy
# metaclass for one level of class instantiation that replaces itself with
# the actual metaclass.
class metaclass(meta):
def __new__(cls, name, this_bases, d):
return meta(name, bases, d)
return type.__new__(metaclass, str('temporary_class'), (), {})
|