You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ze...@apache.org on 2024/08/13 06:15:43 UTC

(streampipes) branch dev updated: Update pre-commit hooks (#3129)

This is an automated email from the ASF dual-hosted git repository.

zehnder pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/streampipes.git


The following commit(s) were added to refs/heads/dev by this push:
     new 13fa4945f5 Update pre-commit hooks (#3129)
13fa4945f5 is described below

commit 13fa4945f5a60b30e4f91f6cfd09c13e6a156c45
Author: airwish <it...@outlook.com>
AuthorDate: Tue Aug 13 14:15:38 2024 +0800

    Update pre-commit hooks (#3129)
    
    Signed-off-by: ittuann <it...@outlook.com>
---
 streampipes-client-python/.pre-commit-config.yaml                | 5 +++--
 streampipes-client-python/streampipes/client/config.py           | 2 --
 .../streampipes/endpoint/api/data_lake_measure.py                | 2 +-
 .../streampipes/function_zoo/river_function.py                   | 2 +-
 .../streampipes/functions/utils/data_stream_generator.py         | 6 ++----
 .../tests/functions/test_function_handler.py                     | 9 ++-------
 streampipes-client-python/tests/functions/test_river_function.py | 2 +-
 7 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/streampipes-client-python/.pre-commit-config.yaml b/streampipes-client-python/.pre-commit-config.yaml
index 3c27eede8a..38b2663762 100644
--- a/streampipes-client-python/.pre-commit-config.yaml
+++ b/streampipes-client-python/.pre-commit-config.yaml
@@ -17,10 +17,11 @@
 files: streampipes/|tests/
 repos:
   - repo: https://github.com/pre-commit/pre-commit-hooks
-    rev: v4.2.0
+    rev: v4.6.0
     hooks:
       - id: check-json
       - id: check-yaml
+      - id: check-toml
       - id: end-of-file-fixer
       - id: trailing-whitespace
       - id: mixed-line-ending
@@ -89,4 +90,4 @@ repos:
         language: python
         types: [ python ]
         entry: flake8 --max-line-length 120
-        verbose: true
\ No newline at end of file
+        verbose: true
diff --git a/streampipes-client-python/streampipes/client/config.py b/streampipes-client-python/streampipes/client/config.py
index 336bcf5ece..36b0618ad9 100644
--- a/streampipes-client-python/streampipes/client/config.py
+++ b/streampipes-client-python/streampipes/client/config.py
@@ -64,5 +64,3 @@ class StreamPipesClientConfig:
     https_disabled: Optional[bool] = False
     port: Optional[int] = 80
     additional_headers: Optional[Dict[str, str]] = field(default_factory=dict)
-
-
diff --git a/streampipes-client-python/streampipes/endpoint/api/data_lake_measure.py b/streampipes-client-python/streampipes/endpoint/api/data_lake_measure.py
index 5d61e50417..ebb2584651 100644
--- a/streampipes-client-python/streampipes/endpoint/api/data_lake_measure.py
+++ b/streampipes-client-python/streampipes/endpoint/api/data_lake_measure.py
@@ -326,7 +326,7 @@ class DataLakeMeasureEndpoint(APIEndpoint):
     @property
     def _container_cls(self) -> Type[ResourceContainer]:
         """Defines the model container class the endpoint refers to.
-        
+
         Returns
         -------
         [DataLakeMeasures][streampipes.model.container.DataLakeMeasures]
diff --git a/streampipes-client-python/streampipes/function_zoo/river_function.py b/streampipes-client-python/streampipes/function_zoo/river_function.py
index 55c057cf35..910097eef2 100644
--- a/streampipes-client-python/streampipes/function_zoo/river_function.py
+++ b/streampipes-client-python/streampipes/function_zoo/river_function.py
@@ -178,7 +178,7 @@ class OnlineML:
             name="prediction",
             attributes=attributes,
             broker=get_broker_description(client.dataStreamApi.get(stream_ids[0])),  # type: ignore
-            stream_id=stream_ids[0]
+            stream_id=stream_ids[0],
         )
         function_definition = FunctionDefinition(consumed_streams=stream_ids).add_output_data_stream(output_stream)
         self.sp_function = RiverFunction(
diff --git a/streampipes-client-python/streampipes/functions/utils/data_stream_generator.py b/streampipes-client-python/streampipes/functions/utils/data_stream_generator.py
index 11b333d412..fc2491051d 100644
--- a/streampipes-client-python/streampipes/functions/utils/data_stream_generator.py
+++ b/streampipes-client-python/streampipes/functions/utils/data_stream_generator.py
@@ -16,7 +16,7 @@
 #
 
 from enum import Enum
-from typing import Dict, Optional
+from typing import Dict
 
 from streampipes.functions.broker import SupportedBroker
 from streampipes.model.common import (
@@ -112,9 +112,7 @@ def create_data_stream(
         protocol.topic_definition.actual_topic_name = f"org.apache.streampipes.connect.{sanitized_stream_id}"
 
     data_stream = DataStream(
-        name=name,
-        event_schema=event_schema,
-        event_grounding=EventGrounding(transport_protocols=transport_protocols)
+        name=name, event_schema=event_schema, event_grounding=EventGrounding(transport_protocols=transport_protocols)
     )
 
     data_stream.element_id = sanitized_stream_id
diff --git a/streampipes-client-python/tests/functions/test_function_handler.py b/streampipes-client-python/tests/functions/test_function_handler.py
index c4968539e0..d7fa3348aa 100644
--- a/streampipes-client-python/tests/functions/test_function_handler.py
+++ b/streampipes-client-python/tests/functions/test_function_handler.py
@@ -373,9 +373,7 @@ class TestFunctionHandler(TestCase):
             )
         )
 
-        output_stream = create_data_stream("test",
-                                           attributes={"number": RuntimeType.INTEGER.value},
-                                           stream_id='a1d')
+        output_stream = create_data_stream("test", attributes={"number": RuntimeType.INTEGER.value}, stream_id="a1d")
         test_function = TestFunctionOutput(
             function_definition=FunctionDefinition(
                 consumed_streams=["urn:streampipes.apache.org:eventstream:uPDKLI"]
@@ -438,10 +436,7 @@ class TestFunctionHandler(TestCase):
         )
 
         output_stream = create_data_stream(
-            "test",
-            stream_id='a1c',
-            attributes={"number": RuntimeType.INTEGER.value},
-            broker=SupportedBroker.KAFKA
+            "test", stream_id="a1c", attributes={"number": RuntimeType.INTEGER.value}, broker=SupportedBroker.KAFKA
         )
         test_function = TestFunctionOutput(
             function_definition=FunctionDefinition(
diff --git a/streampipes-client-python/tests/functions/test_river_function.py b/streampipes-client-python/tests/functions/test_river_function.py
index 73f5a52fa1..4d0e09e70b 100644
--- a/streampipes-client-python/tests/functions/test_river_function.py
+++ b/streampipes-client-python/tests/functions/test_river_function.py
@@ -58,7 +58,7 @@ class TestRiverFunction(TestCase):
         self.data_stream = create_data_stream(
             "test",
             attributes={"number": RuntimeType.FLOAT.value, "bool": RuntimeType.BOOLEAN.value},
-            stream_id="sample-stream"
+            stream_id="sample-stream",
         ).to_dict()
 
         self.test_stream_data = [