Skip to content
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
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
2 changes: 1 addition & 1 deletion .github/actions/common/pylint/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ runs:
echo "📝 Found Python files, running pylint..."
# Save full output to temporary file first
temp_output="${output_file}.full"
find "${path}" -name "*.py" -not -path "*/venv/*" -print0 | xargs -0 pylint 2>&1 | tee "${temp_output}" || true
find "${path}" -name "*.py" -not -path "*/venv/*" -print0 | xargs -0 pylint --rcfile="${path}/pylintrc" 2>&1 | tee "${temp_output}" || true
# Filter only errors (E) and fatal (F) issues to the main output file
if [ -f "${temp_output}" ]; then
# Extract errors and fatal issues
Expand Down
2 changes: 1 addition & 1 deletion docs/scripts/generate_elements_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import sys
import gi
gi.require_version('Gst', '1.0')
from gi.repository import Gst
from gi.repository import Gst # pylint: disable=no-name-in-module
Comment thread
mholowni marked this conversation as resolved.
Outdated

import inspect

Expand Down
10 changes: 10 additions & 0 deletions pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[MAIN]
source-roots = python/gstgva

[MESSAGES CONTROL]

# E0401 = Unable to import module
disable=E0401

[FORMAT]
max-line-length=160
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

please add empty line

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

added

3 changes: 2 additions & 1 deletion python/gstgva/audio/audio_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
# @brief This file contains gstgva.audio_event.AudioEvent class to control audio events for particular gstgva.audio_frame.AudioFrame with gstgva.tensor.Tensor instances attached

import ctypes
import numpy
from typing import List
from collections import namedtuple

Expand All @@ -20,7 +19,9 @@
gi.require_version('GstAudio', '1.0')
gi.require_version('GLib', '2.0')
gi.require_version('Gst', '1.0')
# pylint: disable=no-name-in-module
from gi.repository import GstAudio, GLib, GObject, Gst
# pylint: enable=no-name-in-module

Segment = namedtuple("Segment", "start_time end_time")

Expand Down
2 changes: 2 additions & 0 deletions python/gstgva/audio/audio_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
gi.require_version("GstAudio", "1.0")
gi.require_version('GObject', '2.0')

# pylint: disable=no-name-in-module
from gi.repository import GObject, Gst, GstAudio
# pylint: enable=no-name-in-module
from .audio_event_meta import AudioEventMeta
from .audio_event import AudioEvent
from ..util import GVATensorMeta
Expand Down
2 changes: 2 additions & 0 deletions python/gstgva/tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
gi.require_version("GstAnalytics", "1.0")

from enum import Enum
# pylint: disable=no-name-in-module
from gi.repository import GObject, GstAnalytics, GLib
# pylint: enable=no-name-in-module
from .util import (
libgst,
libgobject,
Expand Down
2 changes: 2 additions & 0 deletions python/gstgva/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
gi.require_version('GstVideo', '1.0')
gi.require_version('GstAudio', '1.0')
gi.require_version('Gst', '1.0')
# pylint: disable=no-name-in-module
from gi.repository import GstVideo, GstAudio, GObject, Gst
# pylint: enable=no-name-in-module

# libgstreamer
if platform.system() == 'Windows':
Expand Down
2 changes: 2 additions & 0 deletions python/gstgva/video_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
gi.require_version("GstAnalytics", "1.0")
gi.require_version("GLib", "2.0")

# pylint: disable=no-name-in-module
from gi.repository import Gst, GstVideo, GstAnalytics, GLib
# pylint: enable=no-name-in-module
from .util import VideoRegionOfInterestMeta
from .util import GVATensorMeta
from .util import GVAJSONMeta
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import sys
import gi
gi.require_version('Gst', '1.0')
from gi.repository import Gst, GObject
from gi.repository import Gst, GObject # pylint: disable=no-name-in-module
Comment thread
mholowni marked this conversation as resolved.
Outdated
Comment thread
mholowni marked this conversation as resolved.
Outdated

from gstgva import VideoFrame

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
gi.require_version('Gst', '1.0')
gi.require_version('GstApp', '1.0')
gi.require_version('GstVideo', '1.0')
from gi.repository import Gst, GLib, GstApp, GstVideo
from gi.repository import Gst, GLib, GstApp, GstVideo # pylint: disable=no-name-in-module
Comment thread
mholowni marked this conversation as resolved.
Outdated
Comment thread
mholowni marked this conversation as resolved.
Outdated
Comment thread
mholowni marked this conversation as resolved.
Outdated

parser = ArgumentParser(add_help=False)
_args = parser.add_argument_group('Options')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
import os
import subprocess
import urllib.request
import gi
from gi.repository import Gst

from huggingface_hub import hf_hub_download
from ultralytics import YOLO

import gi
gi.require_version("Gst", "1.0")
gi.require_version("GstAnalytics", "1.0")
from gi.repository import Gst # pylint: disable=no-name-in-module,wrong-import-position



# Prepare input video file; download default if none provided
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
gi.require_version("GLib", "2.0")
gi.require_version("Gst", "1.0")
gi.require_version("GstAnalytics", "1.0")
from gi.repository import GLib, Gst, GstAnalytics
from gi.repository import GLib, Gst, GstAnalytics # pylint: disable=no-name-in-module
Comment thread
mholowni marked this conversation as resolved.
Outdated

def watermark_sink_pad_buffer_probe(pad,info,u_data):
obj_counter = {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import subprocess
import threading
from typing import List
from onvif import ONVIFCamera # pylint: disable=import-error
from onvif import ONVIFCamera
import dls_onvif_discovery_utils as dls_discovery

def run_single_streamer(gst_command: List[str]) -> subprocess.Popen:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
import gi
gi.require_version('Gst', '1.0')
gi.require_version('GstAnalytics', '1.0')
# pylint: disable=no-name-in-module
from gi.repository import Gst, GLib, GstAnalytics
# pylint: enable=no-name-in-module


class DualStreamController:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@

import sys
import os

from ultralytics import YOLO
import gi
gi.require_version("Gst", "1.0")
gi.require_version("GstAnalytics", "1.0")
# pylint: disable=no-name-in-module
from gi.repository import GLib, Gst, GstAnalytics
from ultralytics import YOLO
# pylint: enable=no-name-in-module


# wrapper to run the gstreamer pipeline loop
def pipeline_loop(pipeline):
Expand Down
2 changes: 1 addition & 1 deletion scripts/optimizer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# SPDX-License-Identifier: MIT
# ==============================================================================

__all__ = [get_optimized_pipeline, preprocess_pipeline]
__all__ = ['get_optimized_pipeline', 'preprocess_pipeline']
Comment thread
mholowni marked this conversation as resolved.
Outdated
Comment thread
mholowni marked this conversation as resolved.
Outdated
10 changes: 5 additions & 5 deletions scripts/optimizer/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
import argparse
import logging

from optimizer import get_optimized_pipeline
from optimizer import get_optimized_pipeline # pylint: disable=no-name-in-module

parser = argparse.ArgumentParser(
prog="DLStreamer Pipeline Optimization Tool",
description="Use this tool to try and find versions of your pipeline that will run with increased performance." # pylint: disable=line-too-long
description="Use this tool to try and find versions of your pipeline that will run with increased performance."
)
parser.add_argument("--search-duration", default=300,
help="Duration in seconds of time which should be spent searching for optimized pipelines (default: %(default)s)") # pylint: disable=line-too-long
help="Duration in seconds of time which should be spent searching for optimized pipelines (default: %(default)s)")
parser.add_argument("--sample-duration", default=10,
help="Duration in seconds of sampling individual pipelines. Longer duration should offer more stable results (default: %(default)s)") # pylint: disable=line-too-long
parser.add_argument("--log-level", default="INFO", choices=["CRITICAL", "FATAL", "ERROR" ,"WARN", "INFO", "DEBUG"], # pylint: disable=line-too-long
help="Duration in seconds of sampling individual pipelines. Longer duration should offer more stable results (default: %(default)s)")
parser.add_argument("--log-level", default="INFO", choices=["CRITICAL", "FATAL", "ERROR" ,"WARN", "INFO", "DEBUG"],
help="Minimum used log level (default: %(default)s)")
parser.add_argument("pipeline", nargs="+",
help="Pipeline to be analyzed")
Expand Down
2 changes: 1 addition & 1 deletion scripts/optimizer/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import gi
gi.require_version("Gst", "1.0")
from gi.repository import Gst
from gi.repository import Gst # pylint: disable=no-name-in-module
Comment thread
mholowni marked this conversation as resolved.

####################################### Init ######################################################

Expand Down
4 changes: 2 additions & 2 deletions src/gst/python/inference_openvino.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/python3

# ==============================================================================
# Copyright (C) 2022 Intel Corporation
# Copyright (C) 2022-2026 Intel Corporation
#
# SPDX-License-Identifier: MIT
# ==============================================================================
Expand All @@ -11,7 +11,7 @@
gi.require_version('GstBase', '1.0')
gi.require_version('GstVideo', '1.0')

from gi.repository import Gst, GObject, GLib, GstBase, GstVideo
from gi.repository import Gst, GObject, GLib, GstBase, GstVideo # pylint: disable=no-name-in-module
Comment thread
mholowni marked this conversation as resolved.
Outdated
Comment thread
mholowni marked this conversation as resolved.
Outdated
import numpy as np

from openvino.runtime import Core, Layout, Type, InferRequest, AsyncInferQueue
Expand Down
4 changes: 2 additions & 2 deletions src/gst/python/python_object_association.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/python3

# ==============================================================================
# Copyright (C) 2023 Intel Corporation
# Copyright (C) 2023-2026 Intel Corporation
#
# SPDX-License-Identifier: MIT
# ==============================================================================
Expand All @@ -10,7 +10,7 @@
gi.require_version('Gst', '1.0')
gi.require_version('GstBase', '1.0')
gi.require_version('GstVideo', '1.0')
from gi.repository import Gst, GObject, GstBase, GLib
from gi.repository import Gst, GObject, GstBase, GLib # pylint: disable=no-name-in-module
Comment thread
mholowni marked this conversation as resolved.
Outdated

from gstgva import VideoFrame

Expand Down
4 changes: 2 additions & 2 deletions src/gst/python/pytorch_tensor_inference.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/python3

# ==============================================================================
# Copyright (C) 2022-2024 Intel Corporation
# Copyright (C) 2022-2026 Intel Corporation
#
# SPDX-License-Identifier: MIT
# ==============================================================================
Expand All @@ -11,7 +11,7 @@
gi.require_version('GstBase', '1.0')
gi.require_version('GstVideo', '1.0')

from gi.repository import Gst, GObject, GstBase
from gi.repository import Gst, GObject, GstBase # pylint: disable=no-name-in-module
Comment thread
mholowni marked this conversation as resolved.
Outdated

import torch
import numpy as np
Expand Down
2 changes: 2 additions & 0 deletions tests/unit_tests/tests_gstgva/pipeline_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
gi.require_version("GLib", "2.0")
gi.require_version('GstApp', '1.0')
gi.require_version("GstVideo", "1.0")
# pylint: disable=no-name-in-module
from gi.repository import GLib, Gst, GstApp, GstVideo # noqa
# pylint: enable=no-name-in-module
import gstgva as va # noqa

Gst.init(None)
Expand Down
2 changes: 2 additions & 0 deletions tests/unit_tests/tests_gstgva/test_audio_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
gi.require_version('Gst', '1.0')
gi.require_version('GstAudio', '1.0')

# pylint: disable=no-name-in-module
from gi.repository import Gst, GstAudio
# pylint: enable=no-name-in-module
from gstgva.audio.audio_frame import AudioFrame
from gstgva.audio.audio_event_meta import AudioEventMeta

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import numpy as np

gi.require_version('Gst', '1.0')
from gi.repository import GLib, Gst, GObject
from gi.repository import GLib, Gst, GObject # pylint: disable=no-name-in-module
Comment thread
mholowni marked this conversation as resolved.
Comment thread
mholowni marked this conversation as resolved.
Comment thread
mholowni marked this conversation as resolved.

from gstgva import VideoFrame, Tensor, RegionOfInterest
Gst.init(sys.argv)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/tests_gstgva/test_files/test_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# ==============================================================================
import gi
gi.require_version('Gst', '1.0')
from gi.repository import Gst
from gi.repository import Gst # pylint: disable=no-name-in-module
Comment thread
mholowni marked this conversation as resolved.
Outdated

class MyClass:
def __init__(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import os

from pipeline_runner import TestPipelineRunner
from utils import *
from utils import BBox, get_model_path

SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
IMAGE_PATH = os.path.join(SCRIPT_DIR, "test_files", "dog_bike_car.jpg")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import os

from pipeline_runner import TestPipelineRunner
from utils import *
from utils import get_model_path, BBox

SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
IMAGE_PATH = os.path.join(SCRIPT_DIR, "test_files", "dog_bike_car.jpg")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import os

from pipeline_runner import TestPipelineRunner
from utils import *
from utils import BBox, get_model_path

SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
IMAGE_PATH = os.path.join(SCRIPT_DIR, "test_files", "dog_bike_car.jpg")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import os

from pipeline_runner import TestPipelineRunner
from utils import *
from utils import BBox, get_model_path, get_model_proc_path

SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
IMAGE_PATH = os.path.join(SCRIPT_DIR, "test_files", "face_detection.png")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@

import gi
gi.require_version("Gst", "1.0")
from gi.repository import Gst
from gi.repository import Gst # pylint: disable=no-name-in-module
Comment thread
mholowni marked this conversation as resolved.
Outdated

from pipeline_runner import TestGenericPipelineRunner
from utils import *
from pipeline_runner import TestGenericPipelineRunner # pylint: disable=wrong-import-position

SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@
import os

from pipeline_runner import TestGenericPipelineRunner
from utils import *

import gi

gi.require_version("Gst", "1.0")
gi.require_version("GLib", "2.0")
from gi.repository import Gst, GLib
from gi.repository import Gst, GLib # pylint: disable=no-name-in-module
Comment thread
mholowni marked this conversation as resolved.

SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import os

from pipeline_runner import TestPipelineRunner
from utils import *
from utils import BBox, get_model_path

SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
IMAGE_PATH = os.path.join(SCRIPT_DIR, "test_files", "dog_bike_car.jpg")
Expand Down
1 change: 0 additions & 1 deletion tests/unit_tests/tests_gstgva/test_pipeline_gvapython.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import os

from pipeline_runner import TestGenericPipelineRunner
from utils import *

SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
IMAGE_PATH = os.path.join(SCRIPT_DIR, "test_files", "dog_bike_car.jpg")
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/tests_gstgva/test_pipeline_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# ==============================================================================

import unittest
from optimizer import get_optimized_pipeline
from optimizer import get_optimized_pipeline # pylint: disable=no-name-in-module
from utils import get_model_path

class TestOptimizer(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/tests_gstgva/test_region_of_interest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from gstgva.region_of_interest import RegionOfInterest, Tensor
from gstgva.util import VideoRegionOfInterestMeta, libgst
from gstgva.video_frame import VideoFrame
from gi.repository import GstVideo, GLib, GObject, Gst
from gi.repository import GstVideo, GLib, GObject, Gst # pylint: disable=no-name-in-module
Comment thread
mholowni marked this conversation as resolved.
Comment thread
mholowni marked this conversation as resolved.
Comment thread
mholowni marked this conversation as resolved.

Gst.init(sys.argv)

Expand Down
Loading
Loading