/usr/lib/python3/dist-packages/pyrad/bidict.py is in python3-pyrad 2.0-3.
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 | # bidict.py
#
# Bidirectional map
class BiDict:
def __init__(self):
self.forward = {}
self.backward = {}
def Add(self, one, two):
self.forward[one] = two
self.backward[two] = one
def __len__(self):
return len(self.forward)
def __getitem__(self, key):
return self.GetForward(key)
def __delitem__(self, key):
if key in self.forward:
del self.backward[self.forward[key]]
del self.forward[key]
else:
del self.forward[self.backward[key]]
del self.backward[key]
def GetForward(self, key):
return self.forward[key]
def HasForward(self, key):
return key in self.forward
def GetBackward(self, key):
return self.backward[key]
def HasBackward(self, key):
return key in self.backward
|