/usr/lib/python3/dist-packages/nagiosplugin/multiarg.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 | # Copyright (c) gocept gmbh & co. kg
# See also LICENSE.txt
class MultiArg(object):
def __init__(self, args, fill=None, splitchar=','):
if isinstance(args, list):
self.args = args
else:
self.args = args.split(splitchar)
self.fill = fill
def __len__(self):
return self.args.__len__()
def __iter__(self):
return self.args.__iter__()
def __getitem__(self, key):
try:
return self.args.__getitem__(key)
except IndexError:
pass
if self.fill is not None:
return self.fill
try:
return self.args.__getitem__(-1)
except IndexError:
return None
|