clean up
This commit is contained in:
1 parent
b0d924f63a
commit
02cbacabe0
10 files changed
+47
-44
No files matched your search
+15
-14
@@ -1,14 +1,15 @@
|
||||
list_autos # unused function (/home/ari/Projects/Shortumation/api/src/api/routes/automations.py:17)
|
||||
upsert_auto # unused function (/home/ari/Projects/Shortumation/api/src/api/routes/automations.py:28)
|
||||
delete_auto # unused function (/home/ari/Projects/Shortumation/api/src/api/routes/automations.py:32)
|
||||
read_details # unused function (/home/ari/Projects/Shortumation/api/src/api/routes/details.py:10)
|
||||
read_ping # unused function (/home/ari/Projects/Shortumation/api/src/api/routes/ping.py:10)
|
||||
websocket_endpoint # unused function (/home/ari/Projects/Shortumation/api/src/api/routes/socket.py:9)
|
||||
params # unused variable (/home/ari/Projects/Shortumation/api/src/api/types.py:18)
|
||||
total_items # unused variable (/home/ari/Projects/Shortumation/api/src/api/types.py:19)
|
||||
id # unused variable (/home/ari/Projects/Shortumation/api/src/automations/types.py:8)
|
||||
alias # unused variable (/home/ari/Projects/Shortumation/api/src/automations/types.py:9)
|
||||
description # unused variable (/home/ari/Projects/Shortumation/api/src/automations/types.py:10)
|
||||
trigger_variables # unused variable (/home/ari/Projects/Shortumation/api/src/automations/types.py:11)
|
||||
mode # unused variable (/home/ari/Projects/Shortumation/api/src/automations/types.py:12)
|
||||
json_dumps # unused function (/home/ari/Projects/Shortumation/api/src/json_serializer.py:5)
|
||||
get_index # unused function (src/api/app.py:43)
|
||||
list_autos # unused function (src/api/routes/automations.py:18)
|
||||
upsert_auto # unused function (src/api/routes/automations.py:29)
|
||||
delete_auto # unused function (src/api/routes/automations.py:37)
|
||||
read_details # unused function (src/api/routes/details.py:10)
|
||||
read_ping # unused function (src/api/routes/ping.py:10)
|
||||
websocket_endpoint # unused function (src/api/routes/socket.py:13)
|
||||
params # unused variable (src/api/types.py:18)
|
||||
total_items # unused variable (src/api/types.py:19)
|
||||
trigger_variables # unused variable (src/automations/types.py:11)
|
||||
_.reload # unused method (src/automations_v2/manager.py:29)
|
||||
_.upsert # unused method (src/automations_v2/manager.py:54)
|
||||
trigger_variables # unused variable (src/automations_v2/types.py:12)
|
||||
action # unused variable (src/automations_v2/types.py:16)
|
||||
json_dumps # unused function (src/json_serializer.py:5)
|
||||
+4
-1
@@ -45,4 +45,7 @@ start-docker:
|
||||
tar -xvf ../development_config.tar.gz -C ./
|
||||
cp ./development_config/.env .env.api
|
||||
docker-compose down
|
||||
docker-compose up
|
||||
docker-compose up
|
||||
|
||||
update-vulture-whitelist:
|
||||
$(VENV_BIN)/vulture --make-whitelist src > .vulture_whitelist
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
from fastapi.responses import RedirectResponse
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
|
||||
from src.automations.manager import AutomationManager
|
||||
from src.env import API_PREFIX, ORIGIN, ROOT_FOLDER
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import base64
|
||||
import json
|
||||
import sqlite3
|
||||
import base64
|
||||
|
||||
from contextlib import contextmanager
|
||||
from pathlib import Path
|
||||
from typing import Iterable, Iterator, List, Optional
|
||||
|
||||
from src.logger import get_logger
|
||||
from .types import ExtenededAutomation
|
||||
|
||||
from .errors import DBDataError, DBError, DBNoAutomationFound
|
||||
from .types import ExtenededAutomation
|
||||
|
||||
logger = get_logger(__file__)
|
||||
|
||||
@@ -99,19 +99,6 @@ class AutomationDBConnection:
|
||||
""",
|
||||
)
|
||||
|
||||
def delete_automations(self, automations: List[ExtenededAutomation]):
|
||||
with self.get_cur() as cur:
|
||||
cur.executemany(
|
||||
f"DELETE FROM {automations_tbl} WHERE id = ?", [(a.id,) for a in automations]
|
||||
)
|
||||
|
||||
def delete_automations_in_source_file(self, source_file: Path):
|
||||
with self.get_cur() as cur:
|
||||
cur.execute(
|
||||
f"DELETE FROM {automations_tbl} WHERE source_file = ?",
|
||||
(str(source_file.absolute()),),
|
||||
)
|
||||
|
||||
def get_automation(self, automation_id: str) -> ExtenededAutomation:
|
||||
with self.get_cur() as cur:
|
||||
cur.execute(
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
from pathlib import Path
|
||||
from typing import Any, Iterator, Tuple, Union
|
||||
from ..hass_config.loader import HassConfig
|
||||
|
||||
from src.json_serializer import normalize_obj
|
||||
from src.logger import get_logger
|
||||
from src.utils import extract_files
|
||||
from src.yaml_serializer import load_yaml
|
||||
from src.yaml_serializer.types import IncludedYaml, IncludedYamlDir
|
||||
from src.utils import extract_files
|
||||
|
||||
from ..hass_config.loader import HassConfig
|
||||
from .errors import InvalidAutomationFile
|
||||
from .types import ExtenededAutomation
|
||||
|
||||
|
||||
@@ -2,17 +2,19 @@ from pathlib import Path
|
||||
from tempfile import mktemp
|
||||
from typing import Optional, Union
|
||||
|
||||
from ..errors import ErrorSet
|
||||
|
||||
from ..logger import get_logger
|
||||
from .errors import AttemptingToOverwriteAnIncompatibleFileError, DBError, InvalidAutomationFile
|
||||
|
||||
from src.hass_config.loader import HassConfig
|
||||
from src.yaml_serializer import dump_yaml, load_yaml
|
||||
|
||||
from ..errors import ErrorSet
|
||||
from ..logger import get_logger
|
||||
from .db import AutomationDBConnection
|
||||
from .errors import (
|
||||
AttemptingToOverwriteAnIncompatibleFileError,
|
||||
DBError,
|
||||
InvalidAutomationFile,
|
||||
)
|
||||
from .loader import extract_automation_paths, load_automation_path
|
||||
from .types import ExtenededAutomation
|
||||
from .db import AutomationDBConnection
|
||||
|
||||
logger = get_logger(__file__)
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
from pathlib import Path
|
||||
|
||||
from src.automations_v2.types import ExtenededAutomation
|
||||
|
||||
from .utils import TestWithDB
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,10 @@ from pathlib import Path
|
||||
from tempfile import mktemp
|
||||
from unittest import TestCase
|
||||
|
||||
from src.automations_v2.loader import extract_automation_paths, load_automation_path
|
||||
from src.automations_v2.loader import (
|
||||
extract_automation_paths,
|
||||
load_automation_path,
|
||||
)
|
||||
from src.automations_v2.types import ExtenededAutomation
|
||||
from src.hass_config.loader import HassConfig
|
||||
from tests.utils import (
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
from pathlib import Path
|
||||
|
||||
from src import yaml_serializer
|
||||
from src.automations_v2.errors import (
|
||||
AttemptingToOverwriteAnIncompatibleFileError,
|
||||
DBNoAutomationFound,
|
||||
InvalidAutomationFile,
|
||||
)
|
||||
from src.automations_v2.manager import AutomationManager
|
||||
from src.automations_v2.types import ExtenededAutomation
|
||||
from src.errors import ErrorSet
|
||||
from src.hass_config.loader import HassConfig
|
||||
from src.automations_v2.manager import AutomationManager
|
||||
from tests.utils import (
|
||||
HA_CONFIG6_EXAMPLE,
|
||||
HA_CONFIG_EXAMPLE,
|
||||
create_copy_of_example_config,
|
||||
)
|
||||
|
||||
from tests.utils import HA_CONFIG6_EXAMPLE, HA_CONFIG_EXAMPLE, create_copy_of_example_config
|
||||
from .utils import TestWithDB
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from pathlib import Path
|
||||
from unittest import TestCase
|
||||
from tempfile import mktemp
|
||||
from unittest import TestCase
|
||||
|
||||
from src.automations_v2.db import AutomationDBConnection
|
||||
|
||||
|
||||
Reference in new issue
Block a user