Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
b5994bd
[DLStreamer] fixed some pylint problems
marcin-wadolkowski Nov 5, 2025
c5280df
[DLStreamer] fixed some pylint problems, part2
marcin-wadolkowski Nov 5, 2025
4a21cd4
[DLStreamer] fixed some pylint problems, part3
marcin-wadolkowski Nov 5, 2025
be5d779
[DLStreamer] fixed some pylint problems, part4
marcin-wadolkowski Nov 5, 2025
e10e9ec
[DLStreamer] fixed some pylint problems, part5
marcin-wadolkowski Nov 5, 2025
c55ad4b
[DLStreamer] fixed some pylint problems, part6
marcin-wadolkowski Nov 6, 2025
51e5811
[DLStreamer] fixed some pylint problems, part7
marcin-wadolkowski Nov 6, 2025
a72480e
[DLStreamer] fixed some pylint problems, part8
marcin-wadolkowski Nov 6, 2025
3f511ea
[DLStreamer] fixed some pylint problems, part9
marcin-wadolkowski Nov 6, 2025
01ac104
[DLStreamer] fixed some pylint problems, part10
marcin-wadolkowski Nov 7, 2025
288655e
[DLStreamer] fixed some pylint problems, part11
marcin-wadolkowski Nov 7, 2025
7c86526
[DLStreamer] fixed some pylint problems, part12
marcin-wadolkowski Nov 7, 2025
0f6e764
[DLStreamer] fixed some pylint problems, part11
marcin-wadolkowski Nov 12, 2025
34c9cdf
[DLStreamer] fixed some pylint problems, part14
marcin-wadolkowski Nov 12, 2025
8877019
[DLStreamer] fixed some pylint problems, part15
marcin-wadolkowski Nov 12, 2025
21a1a36
[DLStreamer] fixed some pylint problems, part16
marcin-wadolkowski Nov 12, 2025
cc87af5
[DLStreamer] fixed some pylint problems, part17
marcin-wadolkowski Nov 12, 2025
eea6f30
[DLStreamer] fixed some pylint problems, part18
marcin-wadolkowski Nov 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 52 additions & 20 deletions libraries/dl-streamer/docs/scripts/generate_elements_page.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ==============================================================================
# Copyright (C) 2023 Intel Corporation
# Copyright (C) 2023-2025 Intel Corporation
#
# SPDX-License-Identifier: MIT
# ==============================================================================
Expand All @@ -14,34 +14,38 @@
import re
import sys
import gi
gi.require_version('Gst', '1.0')

gi.require_version("Gst", "1.0")
from gi.repository import Gst

import inspect


def get_elements(lib):
elements = []

result = subprocess.Popen(['gst-inspect-1.0', lib], stdout=subprocess.PIPE)
result = subprocess.Popen(["gst-inspect-1.0", lib], stdout=subprocess.PIPE)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[pylint] reported by reviewdog 🐶
R1732: Consider using 'with' for resource-allocating operations (consider-using-with)

while True:
line = result.stdout.readline()
if not line:
break
line = line.decode('utf-8').rstrip('\n')
line = line.decode("utf-8").rstrip("\n")
match = re.match(r"^\s+([^\s]\w+):", str(line))
if match:
elements.append(match.group(1))

return elements


def get_element_description(element_name):
factory = Gst.ElementFactory.find(element_name)
return factory.get_metadata("description")


def get_field_info(field, value, pfx):
str = Gst.value_serialize(value)
return "{0:s} {1:15s}: {2:s}".format(
pfx, GLib.quark_to_string(field), str)
return "{0:s} {1:15s}: {2:s}".format(pfx, GLib.quark_to_string(field), str)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[pylint] reported by reviewdog 🐶
C0209: Formatting a regular string which could be an f-string (consider-using-f-string)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[pylint] reported by reviewdog 🐶
E0602: Undefined variable 'GLib' (undefined-variable)



def get_caps_info(caps):
if not caps:
Expand All @@ -65,21 +69,34 @@ def get_caps_info(caps):

return caps_info

def generate_table(table_data, table_header = ["", ""]):

def generate_table(table_data, table_header=["", ""]):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[pylint] reported by reviewdog 🐶
C0116: Missing function or method docstring (missing-function-docstring)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[pylint] reported by reviewdog 🐶
W0102: Dangerous default value [] as argument (dangerous-default-value)

table = ""

first_collumn_length = len(table_header[0])
second_collumn_length = len(table_header[1])

for first_column in table_data:
first_collumn_length = len(first_column) if len(first_column) > first_collumn_length else first_collumn_length
first_collumn_length = (
len(first_column) if len(first_column) > first_collumn_length else first_collumn_length
)

for second_column in table_data[first_column]:
second_collumn_length = len(second_column) if len(second_column) > second_collumn_length else second_collumn_length
second_collumn_length = (
len(second_column)
if len(second_column) > second_collumn_length
else second_collumn_length
)

if table_header[0]:
table = "=" * first_collumn_length + " " + "=" * second_collumn_length + "\n"
table += table_header[0] + " " * (first_collumn_length - len(table_header[0])) + " " + table_header[1] + "\n"
table += (
table_header[0]
+ " " * (first_collumn_length - len(table_header[0]))
+ " "
+ table_header[1]
+ "\n"
)

table += "=" * first_collumn_length + " " + "=" * second_collumn_length + "\n"

Expand All @@ -88,19 +105,19 @@ def generate_table(table_data, table_header = ["", ""]):
table += table_data[first_column][0] + "\n"

i = 0
for second_column_line in table_data[first_column]:
for second_column_line in table_data[first_column]:
i += 1
if i == 1:
continue

table += " " * first_collumn_length + " " + second_column_line + "\n"


table += "=" * first_collumn_length + " " + "=" * second_collumn_length + "\n"
return table


def get_pad_templates_information(factory):

if factory.get_num_pad_templates() == 0:
return None

Expand All @@ -116,7 +133,7 @@ def get_pad_templates_information(factory):
if pad.direction == Gst.PadDirection.SRC:
pad_direction = "SRC template: {}".format(padtemplate.name_template)
elif pad.direction == Gst.PadDirection.SINK:
pad_direction = "SINK template: {}".format(padtemplate.name_template)
pad_direction = "SINK template: {}".format(padtemplate.name_template)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[pylint] reported by reviewdog 🐶
C0209: Formatting a regular string which could be an f-string (consider-using-f-string)

else:
pad_direction = "UNKNOWN template: {}".format(padtemplate.name_template)

Expand All @@ -141,6 +158,7 @@ def get_pad_templates_information(factory):

return "\nCapabilities\r\n**********************\r\n" + generate_table(table) + "\n"


def get_properties_info(element):

table = {}
Expand All @@ -153,16 +171,31 @@ def get_properties_info(element):

default_value = str(prop.default_value).replace("__main__.", "")
if not default_value:
default_value = "\"\""
default_value = '""'

table[prop.name].append("*Default: {}*\n".format(default_value))

return "\nProperties\r\n**********************\r\n" + generate_table(table, ["Name", "Description"]) + "\n"
return (
"\nProperties\r\n**********************\r\n"
+ generate_table(table, ["Name", "Description"])
+ "\n"
)


def generate_elements_page(page_file_name):
page = "------------\nElements 2.0\n------------\n\n"

libraries = ["dlstreamer_bins", "dlstreamer_elements", "dlstreamer_cpu", "dlstreamer_openvino", "dlstreamer_opencv", "dlstreamer_vaapi", "dlstreamer_opencl", "dlstreamer_sycl", "python"]

libraries = [
"dlstreamer_bins",
"dlstreamer_elements",
"dlstreamer_cpu",
"dlstreamer_openvino",
"dlstreamer_opencv",
"dlstreamer_vaapi",
"dlstreamer_opencl",
"dlstreamer_sycl",
"python",
]

for lib in libraries:
elements = get_elements(lib)
Expand All @@ -186,7 +219,7 @@ def generate_elements_page(page_file_name):
elements_list_file.write(page)
elements_list_file.close()


if __name__ == "__main__":
Gst.init(sys.argv)

Expand All @@ -195,5 +228,4 @@ def generate_elements_page(page_file_name):
if len(sys.argv) > 1 and sys.argv[1]:
page_file_name = sys.argv[1]


generate_elements_page(page_file_name)
Loading
Loading