diff --git a/README.md b/README.md index 8352c04..e3fc588 100644 --- a/README.md +++ b/README.md @@ -59,11 +59,12 @@ node-blue launch --flow=examples/flows/mqtt-to-cratedb.yaml import asyncio from node_blue.core import NodeBlue + async def launch_blue(): """ Launch a Node-BLUE instance. """ - + # Configure Node-BLUE instance with Node-RED flow. blue = NodeBlue(flow="https://github.com/daq-tools/node-blue/raw/main/examples/flows/http-html-templating.json") @@ -73,6 +74,7 @@ async def launch_blue(): # Wait until termination. await blue.forever() + if __name__ == "__main__": asyncio.run(launch_blue()) ``` diff --git a/droste/nodejs/basic.py b/droste/nodejs/basic.py index 87741c5..aadc9de 100644 --- a/droste/nodejs/basic.py +++ b/droste/nodejs/basic.py @@ -2,7 +2,6 @@ from munch import munchify, unmunchify - logger = logging.getLogger(__name__) @@ -18,7 +17,7 @@ def receiver(kwargs): # logger.info("EVALUATE!") # locals().update(munchify(kwargs)) ns = munchify(kwargs) - exec(code, {}, ns) + exec(code, {}, ns) # noqa: S102 # return locals() return unmunchify(ns) diff --git a/droste/nodejs/python_host.py b/droste/nodejs/python_host.py index 8fb7a9a..5ad3834 100644 --- a/droste/nodejs/python_host.py +++ b/droste/nodejs/python_host.py @@ -3,8 +3,8 @@ """ import logging -import typing as t import textwrap +import typing as t from node_blue.util import setup_logging diff --git a/node_blue/cli.py b/node_blue/cli.py index 48e370e..aa5a4d5 100644 --- a/node_blue/cli.py +++ b/node_blue/cli.py @@ -6,7 +6,7 @@ import click -from node_blue.core import launch_blue, NodeBlue +from node_blue.core import NodeBlue, launch_blue from node_blue.util import boot_click, docstring_format_verbatim, make_sync logger = logging.getLogger(__name__) @@ -22,7 +22,7 @@ def help_launch(): node-blue launch \\ --flow=https://github.com/daq-tools/node-blue/raw/main/examples/flows/http-html-templating.json - """ # noqa: E501 + """ def help_setup(): @@ -30,7 +30,7 @@ def help_setup(): Set up Node-BLUE. node-blue setup - """ # noqa: E501 + """ @click.group() diff --git a/node_blue/core.py b/node_blue/core.py index 55ba271..00babe0 100644 --- a/node_blue/core.py +++ b/node_blue/core.py @@ -3,18 +3,17 @@ import asyncio import importlib.resources import logging +import typing as t from pathlib import Path from types import ModuleType import funcy import javascript import javascript.connection -import typing as t - import tabulate from node_blue.hal import NodeBlueContext, jsrun -from node_blue.util import run_later, wait, acquire_text_resource +from node_blue.util import acquire_text_resource, run_later, wait logger = logging.getLogger(__name__) diff --git a/node_blue/hal.py b/node_blue/hal.py index 265533e..0729b96 100644 --- a/node_blue/hal.py +++ b/node_blue/hal.py @@ -1,9 +1,9 @@ # Copyright (c) 2023, The Panodata developers and contributors. # Distributed under the terms of the Apache-2.0 license, see LICENSE. +import asyncio import dataclasses import threading import typing as t -import asyncio from pathlib import Path import javascript diff --git a/pyproject.toml b/pyproject.toml index 54be65e..6b1978a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -100,7 +100,7 @@ optional-dependencies.develop = [ "mypy<2.4", "poethepoet<1", "pyproject-fmt<3", - "ruff<0.16", + "ruff<0.17", "types-tabulate", ] optional-dependencies.release = [ @@ -135,6 +135,7 @@ extend-exclude = [ # Temporary "workbench.py", ] +lint.select = [ "E4", "E7", "E9", "F" ] lint.ignore = [ "E722", # Do not use bare `except` ] @@ -162,8 +163,8 @@ ini_options.log_cli = true # Enable to receive way more log details on stdout. ini_options.log_cli_level = "DEBUG" [tool.coverage] -run.branch = false run.source = [ "droste", "node_blue" ] +run.branch = false report.fail_under = 0 report.show_missing = true diff --git a/tests/test_core.py b/tests/test_core.py index aa4551b..594eb97 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -8,7 +8,7 @@ import requests from pytest_mqtt import MqttMessage -from node_blue.core import NodeBlue, FlowManager +from node_blue.core import FlowManager, NodeBlue from node_blue.util import wait