mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
gdb: make the code PEP-8 compliant
This commit is contained in:
parent
156d33f30a
commit
e43a0c9943
1 changed files with 36 additions and 30 deletions
|
@ -7,6 +7,7 @@ from glib_gobject_helper import g_type_to_name, g_type_name_from_instance
|
|||
if sys.version_info[0] >= 3:
|
||||
long = int
|
||||
|
||||
|
||||
def is_gst_type(val, klass):
|
||||
def _is_gst_type(type):
|
||||
if str(type) == klass:
|
||||
|
@ -25,13 +26,13 @@ def is_gst_type (val, klass):
|
|||
first_field = fields[0]
|
||||
return _is_gst_type(first_field.type)
|
||||
|
||||
|
||||
type = val.type
|
||||
if type.code != gdb.TYPE_CODE_PTR:
|
||||
return False
|
||||
type = type.target()
|
||||
return _is_gst_type(type)
|
||||
|
||||
|
||||
class GstMiniObjectPrettyPrinter:
|
||||
"Prints a GstMiniObject instance pointer"
|
||||
|
||||
|
@ -47,6 +48,7 @@ class GstMiniObjectPrettyPrinter:
|
|||
except RuntimeError:
|
||||
return "0x%x" % long(self.val)
|
||||
|
||||
|
||||
class GstObjectPrettyPrinter:
|
||||
"Prints a GstObject instance"
|
||||
|
||||
|
@ -67,6 +69,7 @@ class GstObjectPrettyPrinter:
|
|||
except RuntimeError:
|
||||
return "0x%x" % long(self.val)
|
||||
|
||||
|
||||
class GstClockTimePrinter:
|
||||
"Prints a GstClockTime / GstClockTimeDiff"
|
||||
|
||||
|
@ -92,12 +95,14 @@ class GstClockTimePrinter:
|
|||
if invalid:
|
||||
return str(n) + " [99:99:99.999999999]"
|
||||
|
||||
return str(n) + " [%s%u:%02u:%02u.%09u]" % ( prefix,
|
||||
return str(n) + " [%s%u:%02u:%02u.%09u]" % (
|
||||
prefix,
|
||||
n / (GST_SECOND * 60 * 60),
|
||||
(n / (GST_SECOND * 60)) % 60,
|
||||
(n / GST_SECOND) % 60,
|
||||
n % GST_SECOND)
|
||||
|
||||
|
||||
def gst_pretty_printer_lookup(val):
|
||||
if is_gst_type(val, "GstMiniObject"):
|
||||
return GstMiniObjectPrettyPrinter(val)
|
||||
|
@ -107,8 +112,9 @@ def gst_pretty_printer_lookup (val):
|
|||
return GstClockTimePrinter(val)
|
||||
return None
|
||||
|
||||
|
||||
def register(obj):
|
||||
if obj == None:
|
||||
if obj is None:
|
||||
obj = gdb
|
||||
|
||||
# Make sure this is always used befor the glib lookup function.
|
||||
|
|
Loading…
Reference in a new issue