diff --git a/.dockerignore b/.dockerignore index eb19c59dfd..7e1c1dee24 100644 --- a/.dockerignore +++ b/.dockerignore @@ -94,6 +94,7 @@ data-storage/hm-keydb/dump.rdb data-storage/hm-protobuf/data data-transformation/dbt/projects/*/dbt_packages data-transformation/dbt/projects/*/logs +data-visualization/grafana/hm-dashboard/output data-visualization/grafana/hm-panel-plugin/.config # data-visualization/metabase/plugins desktop-qt/CMakeLists.txt.user diff --git a/.gitignore b/.gitignore index 9146d5f00d..7299ba3b6e 100644 --- a/.gitignore +++ b/.gitignore @@ -94,6 +94,7 @@ data-storage/hm-keydb/modules/**/* data-storage/hm-protobuf/data/**/* data-transformation/dbt/projects/*/dbt_packages/**/* data-transformation/dbt/projects/*/logs/**/* +data-visualization/grafana/hm-dashboard/output/**/* # data-visualization/grafana/hm-panel-plugin/.config/**/* data-visualization/metabase/plugins/**/* desktop-qt/CMakeLists.txt.user diff --git a/.markdownlint-cli2.jsonc b/.markdownlint-cli2.jsonc index 4ca54a954a..97e7085f2c 100644 --- a/.markdownlint-cli2.jsonc +++ b/.markdownlint-cli2.jsonc @@ -102,6 +102,7 @@ "data-storage/hm-protobuf/data", "data-transformation/dbt/projects/*/dbt_packages", "data-transformation/dbt/projects/*/logs", + "data-visualization/grafana/hm-dashboard/output", "data-visualization/grafana/hm-panel-plugin/.config", "data-visualization/metabase/plugins", "desktop-qt/CMakeLists.txt.user", diff --git a/.prettierignore b/.prettierignore index 8266378743..c56117c476 100644 --- a/.prettierignore +++ b/.prettierignore @@ -94,6 +94,7 @@ data-storage/hm-keydb/modules data-storage/hm-protobuf/data data-transformation/dbt/projects/*/dbt_packages data-transformation/dbt/projects/*/logs +data-visualization/grafana/hm-dashboard/output data-visualization/grafana/hm-panel-plugin/.config data-visualization/metabase/plugins desktop-qt/CMakeLists.txt.user diff --git a/.rubocop.yml b/.rubocop.yml index 9ad3ae38d1..5e2f78496c 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -99,6 +99,7 @@ AllCops: - 'data-storage/hm-protobuf/data/**/*' - 'data-transformation/dbt/projects/*/dbt_packages/**/*' - 'data-transformation/dbt/projects/*/logs/**/*' + - 'data-visualization/grafana/hm-dashboard/output/**/*' - 'data-visualization/grafana/hm-panel-plugin/.config/**/*' - 'data-visualization/metabase/plugins/**/*' - 'desktop-qt/CMakeLists.txt.user' diff --git a/.ruff.toml b/.ruff.toml index b7aebe9a2d..6013f7c345 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -93,6 +93,7 @@ exclude = [ "data-storage/hm-protobuf/data", "data-transformation/dbt/projects/*/dbt_packages", "data-transformation/dbt/projects/*/logs", + "data-visualization/grafana/hm-dashboard/output", "data-visualization/grafana/hm-panel-plugin/.config", "data-visualization/metabase/plugins", "desktop-qt/CMakeLists.txt.user", @@ -188,10 +189,12 @@ select = [ "PGH", # pygrep-hooks "PL", # Pylint "RUF", # Ruff + "S", # flake8-bandit "TRY", # tryceratops "UP", # pyupgrade ] ignore = [ + "S101", "D100", "D101", "D102", diff --git a/.solhintignore b/.solhintignore index 856c66d177..fa1906cf88 100644 --- a/.solhintignore +++ b/.solhintignore @@ -92,6 +92,7 @@ data-storage/hm-keydb/modules data-storage/hm-protobuf/data data-transformation/dbt/projects/*/dbt_packages data-transformation/dbt/projects/*/logs +data-visualization/grafana/hm-dashboard/output data-visualization/grafana/hm-panel-plugin/.config data-visualization/metabase/plugins desktop-qt/CMakeLists.txt.user diff --git a/.sqlfluffignore b/.sqlfluffignore index 370d9c8c65..aad4d2d1ad 100644 --- a/.sqlfluffignore +++ b/.sqlfluffignore @@ -94,6 +94,7 @@ data-storage/hm-keydb/modules data-storage/hm-protobuf/data data-transformation/dbt/projects/*/dbt_packages data-transformation/dbt/projects/*/logs +data-visualization/grafana/hm-dashboard/output data-visualization/grafana/hm-panel-plugin/.config data-visualization/metabase/plugins desktop-qt/CMakeLists.txt.user diff --git a/.stylelintignore b/.stylelintignore index c2af1498cf..4942f34a7e 100644 --- a/.stylelintignore +++ b/.stylelintignore @@ -94,6 +94,7 @@ data-storage/hm-keydb/modules data-storage/hm-protobuf/data data-transformation/dbt/projects/*/dbt_packages data-transformation/dbt/projects/*/logs +data-visualization/grafana/hm-dashboard/output data-visualization/grafana/hm-panel-plugin/.config data-visualization/metabase/plugins desktop-qt/CMakeLists.txt.user diff --git a/.textlintignore b/.textlintignore index 769ba75f68..0748e1f2ef 100644 --- a/.textlintignore +++ b/.textlintignore @@ -94,6 +94,7 @@ data-storage/hm-keydb/modules/**/* data-storage/hm-protobuf/data/**/* data-transformation/dbt/projects/*/dbt_packages/**/* data-transformation/dbt/projects/*/logs/**/* +data-visualization/grafana/hm-dashboard/output/**/* data-visualization/grafana/hm-panel-plugin/.config/**/* data-visualization/metabase/plugins/**/* desktop-qt/CMakeLists.txt.user diff --git a/.yamllint.yaml b/.yamllint.yaml index 97fb042124..8f250983da 100644 --- a/.yamllint.yaml +++ b/.yamllint.yaml @@ -99,6 +99,7 @@ ignore: | data-storage/hm-protobuf/data data-transformation/dbt/projects/*/dbt_packages data-transformation/dbt/projects/*/logs + data-visualization/grafana/hm-dashboard/output data-visualization/grafana/hm-panel-plugin/.config data-visualization/metabase/plugins desktop-qt/CMakeLists.txt.user diff --git a/api-python/routers/motor.py b/api-python/routers/motor.py index 77076ef63f..8e2aa62c6c 100644 --- a/api-python/routers/motor.py +++ b/api-python/routers/motor.py @@ -1,6 +1,6 @@ import asyncio import json -import random +import secrets import time from typing import Annotated @@ -28,9 +28,9 @@ async def generate_motor_data( for _ in range(5): data = { "timestamp": time.time() * 1000, - "current": random.uniform(0, 10), - "voltage": random.uniform(0, 20), - "temperature": random.uniform(0, 50) + 25, + "current": secrets.SystemRandom().uniform(0, 10), + "voltage": secrets.SystemRandom().uniform(0, 20), + "temperature": secrets.SystemRandom().uniform(0, 50) + 25, } producer.poll(0) producer.produce( diff --git a/computer-vision/hm-imagebind/src/main.py b/computer-vision/hm-imagebind/src/main.py index 02c525d4d0..0e768dd20d 100644 --- a/computer-vision/hm-imagebind/src/main.py +++ b/computer-vision/hm-imagebind/src/main.py @@ -80,7 +80,7 @@ def initialize_database( {"text": a, "audio_path": str(b), "image_path": str(c)} for a, b, c in zip(TEXT_LIST, audio_paths, image_paths) ] - db = lancedb.connect("/tmp/lancedb") + db = lancedb.connect("data/lancedb") self.table = db.create_table( "imagebind", schema=MultimodalSearchSchema, diff --git a/computer-vision/hm-supervision/detect-objects/src/main.py b/computer-vision/hm-supervision/detect-objects/src/main.py index 0a5017515e..d86c174104 100644 --- a/computer-vision/hm-supervision/detect-objects/src/main.py +++ b/computer-vision/hm-supervision/detect-objects/src/main.py @@ -1,5 +1,5 @@ import logging -import random +import secrets from pathlib import Path import cv2 @@ -12,9 +12,9 @@ def generate_random_color() -> tuple[int, int, int]: - r = random.randint(0, 255) - g = random.randint(0, 255) - b = random.randint(0, 255) + r = secrets.randbelow(256) + g = secrets.randbelow(256) + b = secrets.randbelow(256) return r, g, b diff --git a/computer-vision/open-clip/src/main.py b/computer-vision/open-clip/src/main.py index 67826f4439..ce68460a8e 100644 --- a/computer-vision/open-clip/src/main.py +++ b/computer-vision/open-clip/src/main.py @@ -28,7 +28,7 @@ class Pets(LanceModel): def main(): - db = lancedb.connect("/tmp/lancedb") + db = lancedb.connect("data/lancedb") # Create or get the table if "pets" in db: diff --git a/data-orchestration/hm-airflow/dags/s3_download.py b/data-orchestration/hm-airflow/dags/s3_download.py index b5201bea70..d7bc0d0891 100644 --- a/data-orchestration/hm-airflow/dags/s3_download.py +++ b/data-orchestration/hm-airflow/dags/s3_download.py @@ -31,6 +31,6 @@ def rename_file(file_path: str, new_file_name: str) -> None: file_name = download_from_s3( bucket="hm-production-bucket", key="hm-airflow/taxi.csv", - local_path="/tmp/", + local_path="/tmp/", # noqa: S108 ) rename_file(file_name, "taxi.csv") diff --git a/data-orchestration/hm-prefect/workflows/calculate/src/main.py b/data-orchestration/hm-prefect/workflows/calculate/src/main.py index 152246a946..6363ac8a85 100644 --- a/data-orchestration/hm-prefect/workflows/calculate/src/main.py +++ b/data-orchestration/hm-prefect/workflows/calculate/src/main.py @@ -1,4 +1,4 @@ -import random +import secrets import time from prefect import flow, get_run_logger, task @@ -11,31 +11,31 @@ class Model(BaseModel): @task def expand(n: int) -> list[int]: - time.sleep(random.uniform(0.5, 5)) + time.sleep(secrets.SystemRandom().uniform(0.5, 5)) return [*range(n)] @task def power(a: int, b: int) -> int: - time.sleep(random.uniform(0.5, 2)) + time.sleep(secrets.SystemRandom().uniform(0.5, 2)) return a**b @task def multiply(a: int, b: int) -> int: - time.sleep(random.uniform(0.5, 2)) + time.sleep(secrets.SystemRandom().uniform(0.5, 2)) return a * b @task def add(a: int, b: int) -> int: - time.sleep(random.uniform(0.5, 2)) + time.sleep(secrets.SystemRandom().uniform(0.5, 2)) return a + b @task def sum_up(nums: list[int]) -> int: - time.sleep(random.uniform(0.5, 2)) + time.sleep(secrets.SystemRandom().uniform(0.5, 2)) return sum(nums) diff --git a/data-storage/delta-lake/read-delta-lake-by-trino/src/main.py b/data-storage/delta-lake/read-delta-lake-by-trino/src/main.py index 78dd4bdae2..af1444ab8a 100644 --- a/data-storage/delta-lake/read-delta-lake-by-trino/src/main.py +++ b/data-storage/delta-lake/read-delta-lake-by-trino/src/main.py @@ -51,7 +51,7 @@ def main(): join te on t0._time = te._time join tf on t0._time = tf._time order by _time asc - """, + """, # noqa: S608 ) res = conn.execute(sql_query, {"event_id": event_id}) df = pd.DataFrame(res.fetchall(), columns=res.keys()) diff --git a/data-storage/hm-duckdb/query-lance/data/.gitkeep b/data-storage/hm-duckdb/query-lance/data/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/data-storage/hm-duckdb/query-lance/src/main.py b/data-storage/hm-duckdb/query-lance/src/main.py index 653b9874fd..3ed7eba3a1 100644 --- a/data-storage/hm-duckdb/query-lance/src/main.py +++ b/data-storage/hm-duckdb/query-lance/src/main.py @@ -47,5 +47,5 @@ def main(database_path: Path) -> None: format="%(asctime)s - %(levelname)s - %(message)s", ) - database_path = Path("/tmp/lancedb/products") + database_path = Path("data/lancedb/products") main(database_path) diff --git a/data-storage/hm-duckdb/query-parquet/src/main.py b/data-storage/hm-duckdb/query-parquet/src/main.py index de0a39454e..c259f0c136 100644 --- a/data-storage/hm-duckdb/query-parquet/src/main.py +++ b/data-storage/hm-duckdb/query-parquet/src/main.py @@ -11,7 +11,7 @@ def main(parquet_path: Path) -> None: query = f""" select * from read_parquet('{parquet_path}') - """ + """ # noqa: S608 df = conn.execute(query).pl() logger.info(df) diff --git a/data-storage/hm-lancedb/data/.gitkeep b/data-storage/hm-lancedb/data/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/data-storage/hm-lancedb/src/main.py b/data-storage/hm-lancedb/src/main.py index 5c552e3faf..90199ef5ec 100644 --- a/data-storage/hm-lancedb/src/main.py +++ b/data-storage/hm-lancedb/src/main.py @@ -32,7 +32,7 @@ def perform_semantic_search(table: lancedb.table.Table, query: str) -> pl.DataFr def main(): url = "https://raw.githubusercontent.com/Abhiram970/RickBot/refs/heads/main/Rick_and_Morty.csv" df = pl.read_csv(url) - db = lancedb.connect("/tmp/lancedb") + db = lancedb.connect("data/lancedb") table = create_and_populate_table(db, df) query = "What is the meaning of life?" diff --git a/data-storage/hm-protobuf/src/main.py b/data-storage/hm-protobuf/src/main.py index 4402c58343..1e186bdd4d 100644 --- a/data-storage/hm-protobuf/src/main.py +++ b/data-storage/hm-protobuf/src/main.py @@ -1,5 +1,5 @@ import logging -import random +import secrets import struct import time from pathlib import Path @@ -70,13 +70,14 @@ def generate_motor_data(point_number: int) -> list[motor_pb2.Motor]: for i in range(point_number): timestamp_ns: int = start_time_ns + (i * interval_ns) motor = motor_pb2.Motor() - motor.id = random.choice(motors) + system_random = secrets.SystemRandom() + motor.id = system_random.choice(motors) motor.timestamp_ns = timestamp_ns - motor.temperature1 = random.uniform(10.0, 100.0) - motor.temperature2 = random.uniform(10.0, 100.0) - motor.temperature3 = random.uniform(10.0, 100.0) - motor.temperature4 = random.uniform(10.0, 100.0) - motor.temperature5 = random.uniform(10.0, 100.0) + motor.temperature1 = system_random.uniform(10.0, 100.0) + motor.temperature2 = system_random.uniform(10.0, 100.0) + motor.temperature3 = system_random.uniform(10.0, 100.0) + motor.temperature4 = system_random.uniform(10.0, 100.0) + motor.temperature5 = system_random.uniform(10.0, 100.0) data.append(motor) return data diff --git a/data-storage/lance/data/.gitkeep b/data-storage/lance/data/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/data-storage/lance/src/main.py b/data-storage/lance/src/main.py index c94a3fd9ff..aec8eb9482 100644 --- a/data-storage/lance/src/main.py +++ b/data-storage/lance/src/main.py @@ -1,4 +1,5 @@ import logging +from pathlib import Path import lance import numpy as np @@ -25,7 +26,7 @@ def main() -> None: vector_table = vec_to_table(vectors) # Save to Lance dataset - uri = "/tmp/lancedb/vectors.lance" + uri = Path("data/lancedb/vectors.lance") dataset = lance.write_dataset(vector_table, uri, mode="overwrite") logger.info( "Dataset saved to %s with %d vectors of dimension %d", diff --git a/data-visualization/grafana/hm-dashboard/output/.gitkeep b/data-visualization/grafana/hm-dashboard/output/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/data-visualization/grafana/hm-dashboard/pyproject.toml b/data-visualization/grafana/hm-dashboard/pyproject.toml index dc7a475f8e..4a26dda531 100644 --- a/data-visualization/grafana/hm-dashboard/pyproject.toml +++ b/data-visualization/grafana/hm-dashboard/pyproject.toml @@ -4,7 +4,7 @@ version = "1.0.0" requires-python = "~=3.13.0" dependencies = [ "grafanalib==0.7.1", - "requests==2.32.3", + "httpx==0.28.1", ] [dependency-groups] @@ -21,5 +21,5 @@ package = false test = "pytest --verbose --verbose" test-coverage = "pytest --cov=. --cov-report=xml" -generate-dashboard = "generate-dashboard --output=frontend.json hm.dashboard.py" -upload-dashboard = "python upload_dashboard.py" +generate-dashboard = "generate-dashboard src/hm.dashboard.py --output=output/frontend.json" +upload-dashboard = "python src/upload_dashboard.py" diff --git a/data-visualization/grafana/hm-dashboard/config.py b/data-visualization/grafana/hm-dashboard/src/config.py similarity index 100% rename from data-visualization/grafana/hm-dashboard/config.py rename to data-visualization/grafana/hm-dashboard/src/config.py diff --git a/data-visualization/grafana/hm-dashboard/dummy_test.py b/data-visualization/grafana/hm-dashboard/src/dummy_test.py similarity index 100% rename from data-visualization/grafana/hm-dashboard/dummy_test.py rename to data-visualization/grafana/hm-dashboard/src/dummy_test.py diff --git a/data-visualization/grafana/hm-dashboard/hm.dashboard.py b/data-visualization/grafana/hm-dashboard/src/hm.dashboard.py similarity index 100% rename from data-visualization/grafana/hm-dashboard/hm.dashboard.py rename to data-visualization/grafana/hm-dashboard/src/hm.dashboard.py diff --git a/data-visualization/grafana/hm-dashboard/upload_dashboard.py b/data-visualization/grafana/hm-dashboard/src/upload_dashboard.py similarity index 66% rename from data-visualization/grafana/hm-dashboard/upload_dashboard.py rename to data-visualization/grafana/hm-dashboard/src/upload_dashboard.py index 624059db98..997b821146 100644 --- a/data-visualization/grafana/hm-dashboard/upload_dashboard.py +++ b/data-visualization/grafana/hm-dashboard/src/upload_dashboard.py @@ -4,7 +4,7 @@ import pathlib import config -import requests +import httpx from grafanalib._gen import DashboardEncoder from grafanalib.core import Dashboard @@ -20,17 +20,17 @@ def upload_to_grafana(dashboard: Dashboard) -> None: }, cls=DashboardEncoder, ) - res = requests.post( - f"{config.GRAFANA_SERVER_URL}/api/dashboards/db", - data=dashboard_json, - headers={ - "Authorization": f"Bearer {config.GRAFANA_SERVICE_ACCOUNT_TOKEN}", - "Content-Type": "application/json", - }, - verify=True, - ) - logger.info(res.status_code) - logger.info(res.content) + with httpx.Client() as client: + res = client.post( + f"{config.GRAFANA_SERVER_URL}/api/dashboards/db", + content=dashboard_json, + headers={ + "Authorization": f"Bearer {config.GRAFANA_SERVICE_ACCOUNT_TOKEN}", + "Content-Type": "application/json", + }, + ) + logger.info(res.status_code) + logger.info(res.content) if __name__ == "__main__": diff --git a/data-visualization/grafana/hm-dashboard/uv.lock b/data-visualization/grafana/hm-dashboard/uv.lock index a7e40304a0..c03e626c03 100644 --- a/data-visualization/grafana/hm-dashboard/uv.lock +++ b/data-visualization/grafana/hm-dashboard/uv.lock @@ -1,6 +1,19 @@ version = 1 requires-python = ">=3.13.0, <3.14" +[[package]] +name = "anyio" +version = "4.8.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "idna" }, + { name = "sniffio" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/a3/73/199a98fc2dae33535d6b8e8e6ec01f8c1d76c9adb096c6b7d64823038cde/anyio-4.8.0.tar.gz", hash = "sha256:1d9fe889df5212298c0c0723fa20479d1b94883a2df44bd3897aa91083316f7a", size = 181126 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/46/eb/e7f063ad1fec6b3178a3cd82d1a3c4de82cccf283fc42746168188e1cdd5/anyio-4.8.0-py3-none-any.whl", hash = "sha256:b5011f270ab5eb0abf13385f851315585cc37ef330dd88e27ec3d34d651fd47a", size = 96041 }, +] + [[package]] name = "attrs" version = "24.3.0" @@ -19,28 +32,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/a5/32/8f6669fc4798494966bf446c8c4a162e0b5d893dff088afddf76414f70e1/certifi-2024.12.14-py3-none-any.whl", hash = "sha256:1275f7a45be9464efc1173084eaa30f866fe2e47d389406136d332ed4967ec56", size = 164927 }, ] -[[package]] -name = "charset-normalizer" -version = "3.4.1" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/16/b0/572805e227f01586461c80e0fd25d65a2115599cc9dad142fee4b747c357/charset_normalizer-3.4.1.tar.gz", hash = "sha256:44251f18cd68a75b56585dd00dae26183e102cd5e0f9f1466e6df5da2ed64ea3", size = 123188 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/38/94/ce8e6f63d18049672c76d07d119304e1e2d7c6098f0841b51c666e9f44a0/charset_normalizer-3.4.1-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:aabfa34badd18f1da5ec1bc2715cadc8dca465868a4e73a0173466b688f29dda", size = 195698 }, - { url = "https://files.pythonhosted.org/packages/24/2e/dfdd9770664aae179a96561cc6952ff08f9a8cd09a908f259a9dfa063568/charset_normalizer-3.4.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:22e14b5d70560b8dd51ec22863f370d1e595ac3d024cb8ad7d308b4cd95f8313", size = 140162 }, - { url = "https://files.pythonhosted.org/packages/24/4e/f646b9093cff8fc86f2d60af2de4dc17c759de9d554f130b140ea4738ca6/charset_normalizer-3.4.1-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8436c508b408b82d87dc5f62496973a1805cd46727c34440b0d29d8a2f50a6c9", size = 150263 }, - { url = "https://files.pythonhosted.org/packages/5e/67/2937f8d548c3ef6e2f9aab0f6e21001056f692d43282b165e7c56023e6dd/charset_normalizer-3.4.1-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2d074908e1aecee37a7635990b2c6d504cd4766c7bc9fc86d63f9c09af3fa11b", size = 142966 }, - { url = "https://files.pythonhosted.org/packages/52/ed/b7f4f07de100bdb95c1756d3a4d17b90c1a3c53715c1a476f8738058e0fa/charset_normalizer-3.4.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:955f8851919303c92343d2f66165294848d57e9bba6cf6e3625485a70a038d11", size = 144992 }, - { url = "https://files.pythonhosted.org/packages/96/2c/d49710a6dbcd3776265f4c923bb73ebe83933dfbaa841c5da850fe0fd20b/charset_normalizer-3.4.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:44ecbf16649486d4aebafeaa7ec4c9fed8b88101f4dd612dcaf65d5e815f837f", size = 147162 }, - { url = "https://files.pythonhosted.org/packages/b4/41/35ff1f9a6bd380303dea55e44c4933b4cc3c4850988927d4082ada230273/charset_normalizer-3.4.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:0924e81d3d5e70f8126529951dac65c1010cdf117bb75eb02dd12339b57749dd", size = 140972 }, - { url = "https://files.pythonhosted.org/packages/fb/43/c6a0b685fe6910d08ba971f62cd9c3e862a85770395ba5d9cad4fede33ab/charset_normalizer-3.4.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:2967f74ad52c3b98de4c3b32e1a44e32975e008a9cd2a8cc8966d6a5218c5cb2", size = 149095 }, - { url = "https://files.pythonhosted.org/packages/4c/ff/a9a504662452e2d2878512115638966e75633519ec11f25fca3d2049a94a/charset_normalizer-3.4.1-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:c75cb2a3e389853835e84a2d8fb2b81a10645b503eca9bcb98df6b5a43eb8886", size = 152668 }, - { url = "https://files.pythonhosted.org/packages/6c/71/189996b6d9a4b932564701628af5cee6716733e9165af1d5e1b285c530ed/charset_normalizer-3.4.1-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:09b26ae6b1abf0d27570633b2b078a2a20419c99d66fb2823173d73f188ce601", size = 150073 }, - { url = "https://files.pythonhosted.org/packages/e4/93/946a86ce20790e11312c87c75ba68d5f6ad2208cfb52b2d6a2c32840d922/charset_normalizer-3.4.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:fa88b843d6e211393a37219e6a1c1df99d35e8fd90446f1118f4216e307e48cd", size = 145732 }, - { url = "https://files.pythonhosted.org/packages/cd/e5/131d2fb1b0dddafc37be4f3a2fa79aa4c037368be9423061dccadfd90091/charset_normalizer-3.4.1-cp313-cp313-win32.whl", hash = "sha256:eb8178fe3dba6450a3e024e95ac49ed3400e506fd4e9e5c32d30adda88cbd407", size = 95391 }, - { url = "https://files.pythonhosted.org/packages/27/f2/4f9a69cc7712b9b5ad8fdb87039fd89abba997ad5cbe690d1835d40405b0/charset_normalizer-3.4.1-cp313-cp313-win_amd64.whl", hash = "sha256:b1ac5992a838106edb89654e0aebfc24f5848ae2547d22c2c3f66454daa11971", size = 102702 }, - { url = "https://files.pythonhosted.org/packages/0e/f6/65ecc6878a89bb1c23a086ea335ad4bf21a588990c3f535a227b9eea9108/charset_normalizer-3.4.1-py3-none-any.whl", hash = "sha256:d98b1668f06378c6dbefec3b92299716b931cd4e6061f3c875a71ced1780ab85", size = 49767 }, -] - [[package]] name = "colorama" version = "0.4.6" @@ -90,13 +81,22 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/d3/6e/825081b0ae89031ec16de0c57bf6dbb06d26b69dc938c3461c831e409c9b/grafanalib-0.7.1-py3-none-any.whl", hash = "sha256:6fab5d7b837a1f2d1322ef762cd52e565ec0422707a7512765c59f668bdceb58", size = 62780 }, ] +[[package]] +name = "h11" +version = "0.14.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/f5/38/3af3d3633a34a3316095b39c8e8fb4853a28a536e55d347bd8d8e9a14b03/h11-0.14.0.tar.gz", hash = "sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d", size = 100418 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/95/04/ff642e65ad6b90db43e668d70ffb6736436c7ce41fcc549f4e9472234127/h11-0.14.0-py3-none-any.whl", hash = "sha256:e3fe4ac4b851c468cc8363d500db52c2ead036020723024a109d37346efaa761", size = 58259 }, +] + [[package]] name = "hm-dashboard" version = "1.0.0" source = { virtual = "." } dependencies = [ { name = "grafanalib" }, - { name = "requests" }, + { name = "httpx" }, ] [package.dev-dependencies] @@ -109,7 +109,7 @@ dev = [ [package.metadata] requires-dist = [ { name = "grafanalib", specifier = "==0.7.1" }, - { name = "requests", specifier = "==2.32.3" }, + { name = "httpx", specifier = "==0.28.1" }, ] [package.metadata.requires-dev] @@ -119,6 +119,34 @@ dev = [ { name = "pytest-cov", specifier = "==6.0.0" }, ] +[[package]] +name = "httpcore" +version = "1.0.7" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "certifi" }, + { name = "h11" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/6a/41/d7d0a89eb493922c37d343b607bc1b5da7f5be7e383740b4753ad8943e90/httpcore-1.0.7.tar.gz", hash = "sha256:8551cb62a169ec7162ac7be8d4817d561f60e08eaa485234898414bb5a8a0b4c", size = 85196 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/87/f5/72347bc88306acb359581ac4d52f23c0ef445b57157adedb9aee0cd689d2/httpcore-1.0.7-py3-none-any.whl", hash = "sha256:a3fff8f43dc260d5bd363d9f9cf1830fa3a458b332856f34282de498ed420edd", size = 78551 }, +] + +[[package]] +name = "httpx" +version = "0.28.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "anyio" }, + { name = "certifi" }, + { name = "httpcore" }, + { name = "idna" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/b1/df/48c586a5fe32a0f01324ee087459e112ebb7224f646c0b5023f5e79e9956/httpx-0.28.1.tar.gz", hash = "sha256:75e98c5f16b0f35b567856f597f06ff2270a374470a5c2392242528e3e3e42fc", size = 141406 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/2a/39/e50c7c3a983047577ee07d2a9e53faf5a69493943ec3f6a384bdc792deb2/httpx-0.28.1-py3-none-any.whl", hash = "sha256:d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad", size = 73517 }, +] + [[package]] name = "idna" version = "3.10" @@ -223,25 +251,10 @@ wheels = [ ] [[package]] -name = "requests" -version = "2.32.3" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "certifi" }, - { name = "charset-normalizer" }, - { name = "idna" }, - { name = "urllib3" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/63/70/2bf7780ad2d390a8d301ad0b550f1581eadbd9a20f896afe06353c2a2913/requests-2.32.3.tar.gz", hash = "sha256:55365417734eb18255590a9ff9eb97e9e1da868d4ccd6402399eaf68af20a760", size = 131218 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/f9/9b/335f9764261e915ed497fcdeb11df5dfd6f7bf257d4a6a2a686d80da4d54/requests-2.32.3-py3-none-any.whl", hash = "sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6", size = 64928 }, -] - -[[package]] -name = "urllib3" -version = "2.3.0" +name = "sniffio" +version = "1.3.1" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/aa/63/e53da845320b757bf29ef6a9062f5c669fe997973f966045cb019c3f4b66/urllib3-2.3.0.tar.gz", hash = "sha256:f8c5449b3cf0861679ce7e0503c7b44b5ec981bec0d1d3795a07f1ba96f0204d", size = 307268 } +sdist = { url = "https://files.pythonhosted.org/packages/a2/87/a6771e1546d97e7e041b6ae58d80074f81b7d5121207425c964ddf5cfdbd/sniffio-1.3.1.tar.gz", hash = "sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc", size = 20372 } wheels = [ - { url = "https://files.pythonhosted.org/packages/c8/19/4ec628951a74043532ca2cf5d97b7b14863931476d117c471e8e2b1eb39f/urllib3-2.3.0-py3-none-any.whl", hash = "sha256:1cee9ad369867bfdbbb48b7dd50374c0967a0bb7710050facf0dd6911440e3df", size = 128369 }, + { url = "https://files.pythonhosted.org/packages/e9/44/75a9c9421471a6c4805dbf2356f7c181a29c1879239abab1ea2cc8f38b40/sniffio-1.3.1-py3-none-any.whl", hash = "sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2", size = 10235 }, ] diff --git a/data-visualization/iads/iads-data-manager/iads-data-reader/src/main.py b/data-visualization/iads/iads-data-manager/iads-data-reader/src/main.py index ddb98a2a13..578799ffd6 100644 --- a/data-visualization/iads/iads-data-manager/iads-data-reader/src/main.py +++ b/data-visualization/iads/iads-data-manager/iads-data-reader/src/main.py @@ -43,7 +43,7 @@ def create_iads_signal_group( group_name: str, ) -> None: signals = ",".join(signal_set) - iads_config.Query(f"update DataGroups set * = |||{group_name}|{signals}|") + iads_config.Query(f"update DataGroups set * = |||{group_name}|{signals}|") # noqa: S608 iads_config.Save() @staticmethod @@ -103,7 +103,7 @@ def export_to_parquet( str(parquet_file_path), ] logger.info(f"Executing command: {' '.join(cmd)}") - result = subprocess.run(cmd, capture_output=True, text=True, check=False) + result = subprocess.run(cmd, capture_output=True, text=True, check=False) # noqa: S603 if result.returncode == 0: return parquet_file_path else: diff --git a/eslint.config.mjs b/eslint.config.mjs index 19ead83508..5331ff7a17 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -106,6 +106,7 @@ export default [ 'data-storage/hm-protobuf/data', 'data-transformation/dbt/projects/*/dbt_packages', 'data-transformation/dbt/projects/*/logs', + 'data-visualization/grafana/hm-dashboard/output', 'data-visualization/grafana/hm-panel-plugin/.config', 'data-visualization/metabase/plugins', 'desktop-qt/CMakeLists.txt.user', diff --git a/machine-learning/dali/src/main.py b/machine-learning/dali/src/main.py index 98aacfed8d..9790cf32be 100644 --- a/machine-learning/dali/src/main.py +++ b/machine-learning/dali/src/main.py @@ -28,7 +28,7 @@ def download_sample_images(data_path: Path) -> None: filepath = class_dir_path / f"image_{i}.jpg" if not filepath.exists(): logger.info(f"Downloading {url} to {filepath}") - urllib.request.urlretrieve(url, str(filepath)) + urllib.request.urlretrieve(url, str(filepath)) # noqa: S310 except Exception: logger.exception(f"Error downloading {url}") diff --git a/machine-learning/stable-diffusion/src/main.py b/machine-learning/stable-diffusion/src/main.py index 7cf5386889..5b0af35164 100644 --- a/machine-learning/stable-diffusion/src/main.py +++ b/machine-learning/stable-diffusion/src/main.py @@ -1,5 +1,5 @@ import logging -import random +import secrets from datetime import datetime from pathlib import Path @@ -68,7 +68,7 @@ def generate_images( # Set up seed for reproducibility if seed is None: - seed = random.randint(0, 2**32 - 1) + seed = secrets.randbelow(2**32) device = StableDiffusionGenerator.get_device() generator = torch.Generator(device).manual_seed(seed) diff --git a/parallel-computing/hm-triton/src/main.py b/parallel-computing/hm-triton/src/main.py index 271f84cb6c..4e4e22aacb 100644 --- a/parallel-computing/hm-triton/src/main.py +++ b/parallel-computing/hm-triton/src/main.py @@ -39,9 +39,6 @@ def vector_add_kernel( def vector_add(x: torch.Tensor, y: torch.Tensor) -> torch.Tensor: - # Assert vectors are same size and on correct device - assert x.shape == y.shape - assert x.is_cuda and y.is_cuda n_elements: int = x.shape[0] # Allocate output diff --git a/robotics/robot-operating-system/src/turtle_robot/turtle_robot/target_control_node.py b/robotics/robot-operating-system/src/turtle_robot/turtle_robot/target_control_node.py index 132113743b..75410deb6b 100644 --- a/robotics/robot-operating-system/src/turtle_robot/turtle_robot/target_control_node.py +++ b/robotics/robot-operating-system/src/turtle_robot/turtle_robot/target_control_node.py @@ -1,5 +1,5 @@ import math -import random +import secrets import rclpy from geometry_msgs.msg import Twist @@ -23,8 +23,8 @@ def control_loop(self): if self._target_pose is None: return - target_x = random.uniform(0.0, 10.0) - target_y = random.uniform(0.0, 10.0) + target_x = secrets.SystemRandom().uniform(0.0, 10.0) + target_y = secrets.SystemRandom().uniform(0.0, 10.0) dist_x = target_x - self._target_pose.x dist_y = target_y - self._target_pose.y diff --git a/robotics/robot-operating-system/src/turtle_robot_launch/launch/turtle_robot.launch.py b/robotics/robot-operating-system/src/turtle_robot_launch/launch/turtle_robot.launch.py index 487df6b1ff..91d0ad3fe5 100644 --- a/robotics/robot-operating-system/src/turtle_robot_launch/launch/turtle_robot.launch.py +++ b/robotics/robot-operating-system/src/turtle_robot_launch/launch/turtle_robot.launch.py @@ -16,16 +16,13 @@ def generate_launch_description(): ) spawn_turtle = ExecuteProcess( cmd=[ - [ - FindExecutable(name="ros2"), - " service call ", - hm_namespace, - "/spawn ", - "turtlesim/srv/Spawn ", - "\"{x: 2.0, y: 2.0, theta: 0.0, name: 'turtle_robot'}\"", - ], + FindExecutable(name="ros2"), + "service", + "call", + f"{hm_namespace}/spawn", + "turtlesim/srv/Spawn", + '{"x": 2.0, "y": 2.0, "theta": 0.0, "name": "turtle_robot"}', ], - shell=True, ) target_control_node = Node(