lsst.meas.algorithms  21.0.0-15-g490e301a+1aca7ce27a
printers.py
Go to the documentation of this file.
1 import gdb
2 import sys
3 
4 try:
5  import gdb.printing
6 
8  "Print a CRPixel"
9 
10  def __init__(self, val):
11  self.valval = val
12 
13  def to_string(self):
14  return "{id=%d (%d, %d)}" % (self.valval["id"], self.valval["col"], self.valval["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 
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 
36 except 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