File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111[ -z " $@ " ] && extra=" --cov-fail-under=100"
1212
1313echo " Linting tests..."
14- mypy --ignore-missing-imports " ${testsdir} "
14+ mypy " ${testsdir} "
1515
1616pytest \
1717 --cov=powersensor_local.xlatemsg \
Original file line number Diff line number Diff line change 55
66from datetime import datetime , timezone
77from enum import Enum
8- from pathlib import Path
9- PROJECT_ROOT = str (Path (__file__ ).parents [1 ])
10- if PROJECT_ROOT not in sys .path :
11- sys .path .append (PROJECT_ROOT )
12-
13- # pylint: disable=C0413
14- from powersensor_local .legacy_discovery import LegacyDiscovery
15- from powersensor_local .plug_api import PlugApi
8+
9+ from .legacy_discovery import LegacyDiscovery
10+ from .plug_api import PlugApi
1611
1712EXPIRY_CHECK_INTERVAL_S = 30
1813EXPIRY_TIMEOUT_S = 5 * 60
Original file line number Diff line number Diff line change 55interface in devices.py rather than parsing the output from this script."""
66import typing
77import sys
8- from pathlib import Path
98
10- PROJECT_ROOT = str (Path (__file__ ).parents [1 ])
11- if PROJECT_ROOT not in sys .path :
12- sys .path .append (PROJECT_ROOT )
13-
14- # pylint: disable=C0413
159from powersensor_local .devices import PowersensorDevices
1610from powersensor_local .abstract_event_handler import AbstractEventHandler
1711
Original file line number Diff line number Diff line change 11"""Interface abstraction for Powersensor plugs."""
22import sys
3- from pathlib import Path
4- PROJECT_ROOT = str (Path (__file__ ).parents [1 ])
5- if PROJECT_ROOT not in sys .path :
6- sys .path .append (PROJECT_ROOT )
7-
8- # pylint: disable=C0413
9- from powersensor_local .async_event_emitter import AsyncEventEmitter
10- from powersensor_local .plug_listener_tcp import PlugListenerTcp
11- from powersensor_local .plug_listener_udp import PlugListenerUdp
12- from powersensor_local .xlatemsg import translate_raw_message
3+
4+ from .async_event_emitter import AsyncEventEmitter
5+ from .plug_listener_tcp import PlugListenerTcp
6+ from .plug_listener_udp import PlugListenerUdp
7+ from .xlatemsg import translate_raw_message
138
149class PlugApi (AsyncEventEmitter ):
1510 """
Original file line number Diff line number Diff line change 11"""Internal helper for accessing the event stream from a Powersensor plug."""
22import asyncio
33import json
4-
54import sys
6- from pathlib import Path
7- PROJECT_ROOT = str (Path (__file__ ).parents [1 ])
8- if PROJECT_ROOT not in sys .path :
9- sys .path .append (PROJECT_ROOT )
105
11- # pylint: disable=C0413
126from powersensor_local .async_event_emitter import AsyncEventEmitter
137
148class PlugListenerTcp (AsyncEventEmitter ):
Original file line number Diff line number Diff line change 44import socket
55import sys
66
7- from pathlib import Path
8- PROJECT_ROOT = str (Path (__file__ ).parents [1 ])
9- if PROJECT_ROOT not in sys .path :
10- sys .path .append (PROJECT_ROOT )
11-
12- # pylint: disable=C0413
137from powersensor_local .async_event_emitter import AsyncEventEmitter
148
159# pylint: disable=R0902
Original file line number Diff line number Diff line change 11"""Abstraction for producing a household view."""
22
33import sys
4- from pathlib import Path
54from dataclasses import dataclass
65from typing import Optional
76
8- PROJECT_ROOT = str (Path (__file__ ).parents [1 ])
9- if PROJECT_ROOT not in sys .path :
10- sys .path .append (PROJECT_ROOT )
11-
12- # pylint: disable=C0413
13- from powersensor_local .async_event_emitter import AsyncEventEmitter
14- from powersensor_local .event_buffer import EventBuffer
7+ from .async_event_emitter import AsyncEventEmitter
8+ from .event_buffer import EventBuffer
159
1610KEY_DUR_S = 'duration_s'
1711KEY_RESET = 'summation_resettime_utc'
Original file line number Diff line number Diff line change 5757import asyncio
5858import logging
5959import sys
60- from pathlib import Path
6160from typing import Any
6261
63- PROJECT_ROOT = str (Path (__file__ ).parents [1 ])
64- if PROJECT_ROOT not in sys .path :
65- sys .path .append (PROJECT_ROOT )
66-
67- from powersensor_local .devices import _PowersensorDevicesBase , _LogLevel
62+ from .devices import _PowersensorDevicesBase , _LogLevel
6863
6964_SERVICE_TYPE_UDP = '_powersensor._udp.local.'
7065_SERVICE_TYPE_TCP = '_powersensor._tcp.local.'
You can’t perform that action at this time.
0 commit comments