/usr/lib/python2.7/dist-packages/mx/BeeBase/showBeeDict.py is in python-egenix-mxbeebase 3.2.8-1.
This file is owned by root:root, with mode 0o755.
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 | #! /usr/bin/python -O
""" Tool to show BeeDict data.
"""
import cPickle,sys,os
from BeeDict import *
import CommandLine
from mx import Log
def show(name,keys,all=0,levels=3):
print 'Records from BeeDict "%s"' % name
print
d = BeeDict(name,
readonly=1)
if all:
keys = d.keys()
for key in keys:
print_record(d,key,levels)
print
d.close()
def print_record(d,key,levels=3):
print 'Record for key "%s"' % str(key)[:50]
try:
data = d[key]
except:
print 'Failed to load.'
return
try:
data = cPickle.loads(data)
except:
pass
Log.print_obj(data,indent=' ',levels=levels)
class ShowRecord(CommandLine.Application):
header = 'Tool for displaying BeeDict records'
synopsis = '%s [options] dictname keys...'
options = [CommandLine.ArgumentOption('-d','Display depth',3),
CommandLine.SwitchOption('-a','Show all records')
]
def check_files(self,files):
if len(files) < 1:
self.help('Missing arguments')
sys.exit(1)
def main(self):
show(self.files[0],self.files[1:],self.values['-a'],self.values['-d'])
if __name__ == '__main__':
ShowRecord()
|