Skip to content

Commit

Permalink
fix: Migrate command-line tool config to pyproject.toml (#3205)
Browse files Browse the repository at this point in the history
* chore: Migrate command-line config to pyproject.toml

* fix: Correct files according to the config

* fix: Correct comment length
  • Loading branch information
ittuann authored Sep 3, 2024
1 parent bb8c4a3 commit 09df158
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 10 deletions.
10 changes: 5 additions & 5 deletions streampipes-client-python/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,35 +47,35 @@ repos:
name: pyupgrade
language: python
types: [ python ]
entry: pyupgrade --py38 --keep-runtime-typing
entry: pyupgrade --py38-plus --keep-runtime-typing
verbose: true

- id: autoflake
name: autoflake
language: python
types: [ python ]
entry: autoflake --remove-all-unused-imports --expand-star-imports --in-place --remove-unused-variables --remove-duplicate-keys
entry: autoflake
verbose: true

- id: isort
name: isort
language: python
types: [ python ]
entry: isort --profile black
entry: isort
verbose: true

- id: black
name: black
language: python
types: [ python ]
entry: black --line-length=120
entry: black
verbose: true

- id: blacken-docks
name: blacken-docs
language: python
types: [ python ]
entry: black --line-length=120
entry: black
verbose: true

- id: mypy
Expand Down
10 changes: 10 additions & 0 deletions streampipes-client-python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,16 @@ twine = "5.1.0"
name = "PyPI"
priority = "primary"

[tool.autoflake]
remove-all-unused-imports = true
expand-star-imports = true
in-place = true
remove-unused-variables = true
remove-duplicate-keys = true

[tool.black]
line-length = 120

[tool.interrogate]
ignore-init-method = true
ignore-magic = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ class MeasurementGetQueryConfig(BaseModel):
If provided, the returned data only consists of the given columns.<br>
Please be aware that the column `time` as an index is always included.
end_date: Optional[datetime]
Limits the queried data to only include data that is older than the specified time. In other words, any data that occurred after the end_date will not be included in the query results.
Limits the queried data to only include data that is older than the specified time.
In other words, any data that occurred after the end_date will not be included in the query results.
limit: Optional[int]
Amount of records returned at maximum (default: `1000`) <br>
This needs to be at least `1`
Expand All @@ -69,7 +70,8 @@ class MeasurementGetQueryConfig(BaseModel):
Page number used for paging operation <br>
This needs to be at least `1`
start_date: Optional[datetime]
Limits the queried data to only include data that is newer than the specified time. In other words, any data that occurred before the start_date will not be included in the query results.
Limits the queried data to only include data that is newer than the specified time.
In other words, any data that occurred before the start_date will not be included in the query results.
"""

_regex_comma_separated_string = r"^[0-9a-zA-Z\_]+(,[0-9a-zA-Z\_]+)*$"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ def create_data_stream(
sanitized_stream_id = stream_id.replace(" ", "")

# Assign a default topic name incorporating the unique stream ID to each protocol.
# This ensures the topic name remains consistent across function restarts, avoiding reliance on client-side defaults.
# This ensures the topic name remains consistent across function restarts,
# avoiding reliance on client-side defaults.
for protocol in transport_protocols:
protocol.topic_definition.actual_topic_name = f"org.apache.streampipes.connect.{sanitized_stream_id}"

Expand Down
2 changes: 1 addition & 1 deletion streampipes-client-python/streampipes/model/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from typing import List, Optional
from uuid import uuid4

from pydantic.v1 import BaseModel, Field, StrictBool, StrictInt, StrictStr
from pydantic.v1 import BaseModel, Field, StrictInt, StrictStr

__all__ = [
"BaseElement",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#
from typing import List, Optional

from pydantic.v1 import Field, StrictBool, StrictInt, StrictStr
from pydantic.v1 import Field, StrictBool, StrictStr

from streampipes.model.common import (
ApplicationLink,
Expand Down

0 comments on commit 09df158

Please sign in to comment.