Coverage for python / lsst / gdb / meas / algorithms / printers.py: 0%

25 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-04-24 08:25 +0000

1import gdb 

2import sys 

3 

4try: 

5 import gdb.printing 

6 

7 class CRPixelPrinter: 

8 "Print a CRPixel" 

9 

10 def __init__(self, val): 

11 self.val = val 

12 

13 def to_string(self): 

14 return "{id=%d (%d, %d)}" % (self.val["id"], self.val["col"], self.val["row"]) 

15 

16 printers = [] 

17 

18 def register(obj): 

19 "Register my pretty-printers with objfile Obj." 

20 

21 if obj is None: 

22 obj = gdb 

23 

24 for p in printers: 

25 gdb.printing.register_pretty_printer(obj, p) 

26 

27 def build_meas_algorithms_dictionary(): 

28 printer = gdb.printing.RegexpCollectionPrettyPrinter("meas_algorithms") 

29 

30 printer.add_printer('lsst::meas::algorithms::CRPixel', 

31 '^lsst::meas::algorithms::CRPixel', CRPixelPrinter) 

32 return printer 

33 

34 printers.append(build_meas_algorithms_dictionary()) 

35 

36except ImportError as e: 

37 def register(*args, exception=e, **kwargs): 

38 print("Your version of gdb is too old to load the meas.algorithms python pretty printers: %s" % 

39 (exception,), file=sys.stderr) 

40 pass 

41 

42 pass