/usr/lib/python3/dist-packages/nagiosplugin/compat.py is in python3-nagiosplugin 1.2.4-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 | # Copyright (c) gocept gmbh & co. kg
# See also LICENSE.txt
"""Python 2/3 compatibility wrappers.
This module contains imports and functions that help mask Python 2/3
compatibility issues.
"""
import tempfile
# UserDict
try:
from collections import UserDict
except ImportError:
from UserDict import UserDict
# StringIO
try:
from io import StringIO
except ImportError:
from StringIO import StringIO
# Python 2: TemporaryFile does not support the `encoding` parameter
def TemporaryFile(mode='w+b', encoding=None, suffix='', prefix='tmp',
dir=None):
try:
return tempfile.TemporaryFile(
mode=mode, encoding=encoding, suffix=suffix, prefix=prefix,
dir=dir)
except TypeError:
return tempfile.TemporaryFile(
mode=mode, suffix=suffix, prefix=prefix, dir=dir)
|