From a725d78af5c1aec7224dea4f355fd085e1cc56a7 Mon Sep 17 00:00:00 2001 From: "Christian Tremblay, ing." Date: Fri, 26 Jan 2024 21:37:32 -0500 Subject: [PATCH] Ruff removed unused imports... --- BAC0/core/devices/Points.py | 8 +----- BAC0/core/devices/Trends.py | 2 -- BAC0/core/devices/local/decorator.py | 6 ++--- BAC0/core/devices/local/factory.py | 7 +++-- BAC0/core/devices/local/legacy/object.py | 2 +- BAC0/core/devices/local/object.py | 2 -- BAC0/core/functions/Alias.py | 3 --- BAC0/core/functions/Calendar.py | 4 +-- BAC0/core/functions/EventEnrollment.py | 4 +-- BAC0/core/functions/Schedule.py | 4 +-- BAC0/core/functions/Text.py | 5 +--- BAC0/core/functions/TimeSync.py | 1 - BAC0/core/functions/legacy/Discover.py | 4 +-- BAC0/core/io/Read.py | 21 ++++----------- BAC0/core/io/Write.py | 9 ------- BAC0/core/io/legacy/Read.py | 4 +-- BAC0/core/proprietary_objects/jci.py | 1 - .../core/proprietary_objects/legacy/object.py | 2 +- BAC0/db/influxdb.py | 4 +-- BAC0/db/sql.py | 2 +- BAC0/scripts/Base.py | 24 ----------------- BAC0/scripts/Lite.py | 3 --- BAC0/scripts/legacy/Base.py | 2 +- BAC0/tasks/TaskManager.py | 3 +-- BAC0/tasks/__init__.py | 1 - doc/source/conf.py | 1 - samples/excel_from_discovered_devices.py | 1 - tests/conftest.py | 7 +---- .../legacy/broken_test_proprietaryobjects.py | 27 ------------------- tests/legacy/manual_test_create_objects.py | 15 ----------- tests/manual_test_create_device.py | 16 +++-------- tests/manual_test_schedule_datatype.py | 5 ++-- tests/manualtest_cov.py | 1 - tests/old_BAC0_web.py | 1 - tests/test_AsyncRead.py | 1 - tests/test_BAC0_async.py | 2 -- tests/test_WhoHasIHave.py | 1 - tests/test_Write.py | 1 - 38 files changed, 34 insertions(+), 173 deletions(-) diff --git a/BAC0/core/devices/Points.py b/BAC0/core/devices/Points.py index 0092b6f5..0b53bc01 100644 --- a/BAC0/core/devices/Points.py +++ b/BAC0/core/devices/Points.py @@ -399,13 +399,7 @@ async def write(self, value, *, prop="presentValue", priority=""): try: await self.properties.device.properties.network.write( - "{} {} {} {} {} {}".format( - Address(self.properties.device.properties.address), - ObjectIdentifier(self.properties.type, self.properties.address), - PropertyIdentifier(prop), - value, - priority, - ), + f"{Address(self.properties.device.properties.address)} {ObjectIdentifier(self.properties.type, self.properties.address)} {PropertyIdentifier(prop)} {value} - {priority}", vendor_id=self.properties.device.properties.vendor_id, ) except NoResponseFromController: diff --git a/BAC0/core/devices/Trends.py b/BAC0/core/devices/Trends.py index 1824aaa7..227ee831 100755 --- a/BAC0/core/devices/Trends.py +++ b/BAC0/core/devices/Trends.py @@ -14,12 +14,10 @@ except ImportError: _PANDAS = False -import asyncio from collections import namedtuple from bacpypes3.primitivedata import Date, Time -from ...tasks.TaskManager import Task # --- this application's modules --- from ..utils.notes import note_and_log diff --git a/BAC0/core/devices/local/decorator.py b/BAC0/core/devices/local/decorator.py index a1de9bd8..7eaeacbf 100644 --- a/BAC0/core/devices/local/decorator.py +++ b/BAC0/core/devices/local/decorator.py @@ -1,9 +1,9 @@ from functools import wraps -from bacpypes3.basetypes import EngineeringUnits, PriorityValue -from bacpypes3.local.cmd import Commandable, PriorityArray +from bacpypes3.basetypes import EngineeringUnits +from bacpypes3.local.cmd import Commandable from bacpypes3.local.oos import OutOfService -from bacpypes3.object import TrendLogObject, Object as _Object +from bacpypes3.object import TrendLogObject from bacpypes3.primitivedata import CharacterString _SHOULD_BE_COMMANDABLE = ["relinquishDefault", "outOfService", "lowLimit", "highLimit"] diff --git a/BAC0/core/devices/local/factory.py b/BAC0/core/devices/local/factory.py index ad7e2619..79f291ef 100644 --- a/BAC0/core/devices/local/factory.py +++ b/BAC0/core/devices/local/factory.py @@ -2,14 +2,10 @@ from collections import namedtuple from bacpypes3.basetypes import ( - Boolean, Date, DateTime, - EventState, LogRecord, Polarity, - PriorityArray, - Reliability, Time, Unsigned, ) @@ -30,6 +26,7 @@ MultiStateOutputObject, MultiStateValueObject, ) +from bacpypes3.local.cov import COVIncrementCriteria from bacpypes3.primitivedata import CharacterString from colorama import Fore @@ -156,6 +153,8 @@ def _create(objectType, instance, objectName, presentValue, description): self.objects[objectName]._local = LocalTrendLog( self.objects[objectName], datatype=_localTrendLogDataType ) # this will need to be fed by another process. + else: + self.objects[objectName]._cov_criteria = COVIncrementCriteria def validate_instance(self, objectType, instance): _warning = True diff --git a/BAC0/core/devices/local/legacy/object.py b/BAC0/core/devices/local/legacy/object.py index 8e20f302..7fca3bea 100644 --- a/BAC0/core/devices/local/legacy/object.py +++ b/BAC0/core/devices/local/legacy/object.py @@ -72,7 +72,7 @@ def __init__( if not isinstance(presentValue, pv_datatype): try: presentValue = pv_datatype(presentValue) - except: + except Exception: raise ValueError( f"Wrong datatype provided for presentValue for {objectType} of type {type(objectType)}" ) diff --git a/BAC0/core/devices/local/object.py b/BAC0/core/devices/local/object.py index 96425e0c..e37fb56d 100644 --- a/BAC0/core/devices/local/object.py +++ b/BAC0/core/devices/local/object.py @@ -1,5 +1,3 @@ -from bacpypes3.constructeddata import ArrayOf, ListOf -from bacpypes3.local.cov import COVIncrementCriteria from bacpypes3.local.object import Object as _Object from bacpypes3.object import CharacterStringValueObject as _CharacterStringValueObject diff --git a/BAC0/core/functions/Alias.py b/BAC0/core/functions/Alias.py index c80fde0c..58ee4fe4 100644 --- a/BAC0/core/functions/Alias.py +++ b/BAC0/core/functions/Alias.py @@ -1,9 +1,6 @@ import asyncio -import typing as t from bacpypes3.app import Application -from bacpypes3.pdu import Address -from bacpypes3.primitivedata import ObjectIdentifier from BAC0.core.app.asyncApp import BAC0Application diff --git a/BAC0/core/functions/Calendar.py b/BAC0/core/functions/Calendar.py index dc24a1bf..c878d3e3 100644 --- a/BAC0/core/functions/Calendar.py +++ b/BAC0/core/functions/Calendar.py @@ -8,7 +8,7 @@ import datetime import typing as t -from bacpypes3.apdu import SimpleAckPDU, WritePropertyRequest +from bacpypes3.apdu import WritePropertyRequest from bacpypes3.app import Application from bacpypes3.basetypes import CalendarEntry, DateRange from bacpypes3.constructeddata import Any, ArrayOf @@ -18,8 +18,6 @@ from ...core.app.asyncApp import BAC0Application from ...core.utils.notes import note_and_log -from ..io.IOExceptions import NoResponseFromController -from ..io.Read import find_reason @note_and_log diff --git a/BAC0/core/functions/EventEnrollment.py b/BAC0/core/functions/EventEnrollment.py index 449ff211..c768abd1 100644 --- a/BAC0/core/functions/EventEnrollment.py +++ b/BAC0/core/functions/EventEnrollment.py @@ -1,4 +1,4 @@ -from bacpypes3.apdu import SimpleAckPDU, WritePropertyRequest +from bacpypes3.apdu import WritePropertyRequest from bacpypes3.app import Application from bacpypes3.basetypes import DeviceObjectPropertyReference, EventParameter from bacpypes3.constructeddata import Any @@ -6,8 +6,6 @@ from BAC0.core.app.asyncApp import BAC0Application -from ..io.IOExceptions import NoResponseFromController -from ..io.Read import find_reason # this class follows the same design as schedule/calendar diff --git a/BAC0/core/functions/Schedule.py b/BAC0/core/functions/Schedule.py index 1a4033ca..800cf271 100644 --- a/BAC0/core/functions/Schedule.py +++ b/BAC0/core/functions/Schedule.py @@ -9,7 +9,7 @@ # --- standard Python modules --- from datetime import time as dt_time -from bacpypes3.apdu import SimpleAckPDU, WritePropertyRequest +from bacpypes3.apdu import WritePropertyRequest from bacpypes3.app import Application from bacpypes3.basetypes import DailySchedule, TimeValue from bacpypes3.constructeddata import Any, ArrayOf @@ -20,8 +20,6 @@ from ...core.app.asyncApp import BAC0Application from ...core.utils.notes import note_and_log -from ..io.IOExceptions import NoResponseFromController -from ..io.Read import find_reason @note_and_log diff --git a/BAC0/core/functions/Text.py b/BAC0/core/functions/Text.py index 401a7e17..05d32056 100644 --- a/BAC0/core/functions/Text.py +++ b/BAC0/core/functions/Text.py @@ -1,14 +1,11 @@ -import asyncio -from bacpypes3.apdu import SimpleAckPDU, WritePropertyRequest +from bacpypes3.apdu import WritePropertyRequest from bacpypes3.app import Application from bacpypes3.constructeddata import Any from bacpypes3.pdu import Address from bacpypes3.primitivedata import CharacterString from BAC0.core.app.asyncApp import BAC0Application -from BAC0.core.io.IOExceptions import NoResponseFromController, WritePropertyException -from BAC0.core.io.Read import find_reason class TextMixin: diff --git a/BAC0/core/functions/TimeSync.py b/BAC0/core/functions/TimeSync.py index dcc6fb16..8188cc52 100644 --- a/BAC0/core/functions/TimeSync.py +++ b/BAC0/core/functions/TimeSync.py @@ -8,7 +8,6 @@ TimeSync.py - creation of time synch requests """ -import asyncio # --- standard Python modules --- import datetime as dt diff --git a/BAC0/core/functions/legacy/Discover.py b/BAC0/core/functions/legacy/Discover.py index 82130109..fd6480de 100644 --- a/BAC0/core/functions/legacy/Discover.py +++ b/BAC0/core/functions/legacy/Discover.py @@ -287,7 +287,7 @@ def whois_router_to_network(self, network=None, *, destination=None): ) else: request.pduDestination = LocalBroadcast() - except: + except Exception: self._log.error("WhoIsRouterToNetwork : invalid arguments") return iocb = IOCB((self.this_application.nsap.local_adapter, request)) # make an IOCB @@ -312,7 +312,7 @@ def init_routing_table(self, address): try: request = InitializeRoutingTable() request.pduDestination = Address(address) - except: + except Exception: self._log.error("invalid arguments") return diff --git a/BAC0/core/io/Read.py b/BAC0/core/io/Read.py index 3957f0ab..4e6407dd 100644 --- a/BAC0/core/io/Read.py +++ b/BAC0/core/io/Read.py @@ -20,12 +20,10 @@ def readMultiple() """ -import asyncio import re # --- standard Python modules --- import typing as t -from collections import namedtuple # from bacpypes3.core import deferred # from bacpypes.iocb import IOCB, TimeoutError @@ -37,10 +35,7 @@ def readMultiple() PropertyReference, Range, ReadAccessSpecification, - ReadPropertyACK, - ReadPropertyMultipleACK, ReadPropertyMultipleRequest, - ReadPropertyRequest, ReadRangeACK, ReadRangeRequest, RejectPDU, @@ -49,20 +44,17 @@ def readMultiple() from bacpypes3.app import Application from bacpypes3.basetypes import ( DateTime, - LogRecord, - LogRecordLogDatum, PropertyIdentifier, RangeByPosition, RangeBySequenceNumber, RangeByTime, ) -from bacpypes3.constructeddata import AnyAtomic, Array -from bacpypes3.errors import ExecutionError, ObjectError, PropertyError +from bacpypes3.errors import ObjectError, PropertyError from bacpypes3.object import get_vendor_info # --- 3rd party modules --- from bacpypes3.pdu import Address -from bacpypes3.primitivedata import Date, ObjectIdentifier, Tag, Time, Unsigned +from bacpypes3.primitivedata import Date, ObjectIdentifier, Tag, Time from BAC0.core.app.asyncApp import BAC0Application @@ -71,9 +63,6 @@ def readMultiple() # --- this application's modules --- from .IOExceptions import ( ApplicationNotStarted, - NoResponseFromController, - ReadPropertyException, - ReadPropertyMultipleException, ReadRangeException, SegmentationNotSupported, UnknownObjectError, @@ -151,13 +140,13 @@ async def read( except ErrorRejectAbortNack as err: response = err self._log.error(f"Error : {err}") - except ObjectError as err: + except ObjectError: raise UnknownObjectError(f"Unknown object {args}") # except bufferOverflow # except NoResponseFromController - except PropertyError as err: + except PropertyError: if "description" in args: self._log.warning( "The description property is not implemented in the device. " @@ -862,7 +851,7 @@ def cast_datatype_from_tag(propertyValue, obj_id, prop_id): subtype_tag = propertyValue.tagList.tagList[0].tagList[0].tagNumber datatype = ArrayOf(Tag._app_tag_class[subtype_tag]) value = {f"{obj_id}_{prop_id}": propertyValue.cast_out(datatype)} - except: + except Exception: value = {f"{obj_id}_{prop_id}": propertyValue} return value diff --git a/BAC0/core/io/Write.py b/BAC0/core/io/Write.py index 959bbd2e..81c2596c 100644 --- a/BAC0/core/io/Write.py +++ b/BAC0/core/io/Write.py @@ -26,23 +26,15 @@ def write() SimpleAckPDU, WriteAccessSpecification, WritePropertyMultipleRequest, - WritePropertyRequest, ) from bacpypes3.app import Application from bacpypes3.basetypes import PropertyIdentifier, PropertyValue -from bacpypes3.constructeddata import Any, Array # --- 3rd party modules --- from bacpypes3.debugging import ModuleLogger from bacpypes3.pdu import Address from bacpypes3.primitivedata import ( - Atomic, - Enumerated, - Integer, - Null, ObjectIdentifier, - Real, - Unsigned, ) from ..app.asyncApp import BAC0Application @@ -52,7 +44,6 @@ def write() from .IOExceptions import ( ApplicationNotStarted, NoResponseFromController, - WritePropertyCastError, WritePropertyException, ) from .Read import find_reason diff --git a/BAC0/core/io/legacy/Read.py b/BAC0/core/io/legacy/Read.py index f529c923..fcaf2db4 100644 --- a/BAC0/core/io/legacy/Read.py +++ b/BAC0/core/io/legacy/Read.py @@ -508,7 +508,7 @@ def build_rpm_request( ) else: break - except: + except Exception: break elif prop_id not in ( @@ -862,7 +862,7 @@ def cast_datatype_from_tag(propertyValue, obj_id, prop_id): subtype_tag = propertyValue.tagList.tagList[0].tagList[0].tagNumber datatype = ArrayOf(Tag._app_tag_class[subtype_tag]) value = {"{}_{}".format(obj_id, prop_id): propertyValue.cast_out(datatype)} - except: + except Exception: value = {"{}_{}".format(obj_id, prop_id): propertyValue} return value diff --git a/BAC0/core/proprietary_objects/jci.py b/BAC0/core/proprietary_objects/jci.py index 9f793162..8e995cb3 100644 --- a/BAC0/core/proprietary_objects/jci.py +++ b/BAC0/core/proprietary_objects/jci.py @@ -9,7 +9,6 @@ from bacpypes3.local.analog import AnalogValueObject as _AnalogValueObject from bacpypes3.local.device import DeviceObject as _DeviceObject from bacpypes3.local.networkport import NetworkPortObject as _NetworkPortObject -from bacpypes3.vendor import VendorInfo from bacpypes3.primitivedata import Boolean # Signed, from bacpypes3.primitivedata import ( Atomic, diff --git a/BAC0/core/proprietary_objects/legacy/object.py b/BAC0/core/proprietary_objects/legacy/object.py index f1548561..0ba10858 100644 --- a/BAC0/core/proprietary_objects/legacy/object.py +++ b/BAC0/core/proprietary_objects/legacy/object.py @@ -12,7 +12,7 @@ def create_proprietary_object(params: Dict[str, Any]) -> None: try: _validate_params(params) - except: + except Exception: raise # Prevent breaking change for existing code, since issue #311 try: diff --git a/BAC0/db/influxdb.py b/BAC0/db/influxdb.py index 8b6494a5..254f358e 100644 --- a/BAC0/db/influxdb.py +++ b/BAC0/db/influxdb.py @@ -65,7 +65,7 @@ def connect_to_db(self): ) try: self.health - except: + except Exception: raise ConnectionError("Error connecting to InfluxDB") @property @@ -82,7 +82,7 @@ def clean_value(self, object_type, val, units_state): elif "binary" in object_type: try: _string_value = "{}".format(units_state[int(val.split(":"[0]))]) - except: + except Exception: _string_value = "{}".format(val.split(":")[1]) _value = int(val.split(":")[0]) else: diff --git a/BAC0/db/sql.py b/BAC0/db/sql.py index 68fc191f..b2c55841 100644 --- a/BAC0/db/sql.py +++ b/BAC0/db/sql.py @@ -233,7 +233,7 @@ def _df_to_backup(): try: data = pd.read_sql("SELECT * FROM history", con) df = pd.concat([data, df_to_backup], sort=True) - except: + except Exception: df = df_to_backup sql.to_sql( diff --git a/BAC0/scripts/Base.py b/BAC0/scripts/Base.py index 10e39185..4ca716c4 100644 --- a/BAC0/scripts/Base.py +++ b/BAC0/scripts/Base.py @@ -13,16 +13,9 @@ from collections import defaultdict # --- standard Python modules --- -from bacpypes3.app import Application from bacpypes3.basetypes import ( - BDTEntry, DeviceStatus, HostNPort, - IPMode, - NetworkType, - ProtocolLevel, - Segmentation, - ServicesSupported, ObjectTypesSupported, ) from bacpypes3.json.util import sequence_to_json @@ -33,7 +26,6 @@ from bacpypes3.vendor import VendorInfo, get_vendor_info # --- this application's modules --- -from .. import infos from ..core.app.asyncApp import ( BAC0Application, ) # BAC0BBMDDeviceApplication,; BAC0ForeignDeviceApplication, @@ -45,14 +37,6 @@ # --- 3rd party modules --- - -try: - import pandas - - _COMPLETE = True -except ImportError: - _COMPLETE = False - # ------------------------------------------------------------------------------ @@ -130,14 +114,6 @@ def __init__( self.timehandler = TimeHandler() - if not _COMPLETE: - self._log.debug( - "To be able to run the web server, you must install pandas, bokeh, flask and flask_bootstrap" - ) - self._log.debug( - "Those are not all installed so BAC0 will work in Lite mode only." - ) - self.response = None self._initialized = False self._started = False diff --git a/BAC0/scripts/Lite.py b/BAC0/scripts/Lite.py index 0692242d..1685c451 100755 --- a/BAC0/scripts/Lite.py +++ b/BAC0/scripts/Lite.py @@ -14,7 +14,6 @@ # --- standard Python modules --- import weakref -from collections import namedtuple from BAC0.scripts.Base import Base @@ -22,7 +21,6 @@ from ..core.devices.Points import Point from ..core.devices.Trends import TrendLog from ..core.devices.Virtuals import VirtualPoint -from ..core.functions import Calendar from ..core.functions.Alias import Alias # from ..core.functions.legacy.cov import CoV @@ -44,7 +42,6 @@ UnrecognizedService, ) from ..core.io.Read import ReadProperty -from ..core.io.Simulate import Simulation from ..core.io.Write import WriteProperty # from ..core.io.asynchronous.Write import WriteProperty diff --git a/BAC0/scripts/legacy/Base.py b/BAC0/scripts/legacy/Base.py index e0c863fc..9ec5d8b8 100644 --- a/BAC0/scripts/legacy/Base.py +++ b/BAC0/scripts/legacy/Base.py @@ -283,7 +283,7 @@ def disconnect(self): # Freeing socket try: self.this_application.mux.directPort.handle_close() - except: + except Exception: self.this_application.mux.broadcastPort.handle_close() stopBacnetIPApp() # Stop Core diff --git a/BAC0/tasks/TaskManager.py b/BAC0/tasks/TaskManager.py index 9c6bd666..b358bab4 100644 --- a/BAC0/tasks/TaskManager.py +++ b/BAC0/tasks/TaskManager.py @@ -13,7 +13,6 @@ import time from random import random -from ..core.io.IOExceptions import DeviceNotConnected # --- 3rd party modules --- # --- this application's modules --- @@ -83,7 +82,7 @@ async def execute(self): if self.previous_execution: self._log.debug(f"Previous execution : {self.previous_execution}") else: - self._log.debug(f"First Run") + self._log.debug("First Run") self.average_latency = ( self.average_latency + (_start_time - self.next_execution) diff --git a/BAC0/tasks/__init__.py b/BAC0/tasks/__init__.py index a32cb46a..836e3e88 100644 --- a/BAC0/tasks/__init__.py +++ b/BAC0/tasks/__init__.py @@ -1,3 +1,2 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -from . import Poll, TaskManager diff --git a/doc/source/conf.py b/doc/source/conf.py index 34c092d9..6b0c76bb 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -14,7 +14,6 @@ # serve to show the default. import os -import shlex import sys # Magic: allowing sphinx to find the 'current source' vs the installed BAC0 library. diff --git a/samples/excel_from_discovered_devices.py b/samples/excel_from_discovered_devices.py index c5b288ca..21dbbc5c 100644 --- a/samples/excel_from_discovered_devices.py +++ b/samples/excel_from_discovered_devices.py @@ -1,4 +1,3 @@ -import time import pandas as pd diff --git a/tests/conftest.py b/tests/conftest.py index 52150215..fb119e27 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -6,7 +6,6 @@ """ import asyncio -import time from collections import namedtuple import pytest @@ -14,6 +13,7 @@ import BAC0 from BAC0.core.devices.local.factory import ( + ObjectFactory, analog_input, analog_output, analog_value, @@ -23,16 +23,11 @@ character_string, date_value, datetime_value, - humidity_input, - humidity_value, make_state_text, multistate_input, multistate_output, multistate_value, - temperature_input, - temperature_value, ) -from BAC0.core.devices.local.factory_old import ObjectFactory # All test coroutines will be treated as marked. pytestmark = pytest.mark.asyncio diff --git a/tests/legacy/broken_test_proprietaryobjects.py b/tests/legacy/broken_test_proprietaryobjects.py index ffaf965e..e55948f5 100644 --- a/tests/legacy/broken_test_proprietaryobjects.py +++ b/tests/legacy/broken_test_proprietaryobjects.py @@ -1,36 +1,9 @@ import pytest from bacpypes.constructeddata import ( - Any, Array, - ArrayOf, - Choice, - Element, - List, - ListOf, - Sequence, ) from bacpypes.object import ( - AnalogInputObject, - AnalogOutputObject, - AnalogValueObject, - BinaryInputObject, - BinaryOutputObject, BinaryValueObject, - DeviceObject, - Object, - Property, - register_object_type, -) -from bacpypes.primitivedata import ( - Atomic, - Boolean, - CharacterString, - Date, - Enumerated, - OctetString, - Real, - Time, - Unsigned, ) from BAC0.core.proprietary_objects.legacy.object import create_proprietary_object diff --git a/tests/legacy/manual_test_create_objects.py b/tests/legacy/manual_test_create_objects.py index 85f78ce8..dd82c721 100644 --- a/tests/legacy/manual_test_create_objects.py +++ b/tests/legacy/manual_test_create_objects.py @@ -1,25 +1,10 @@ -import bacpypes -import pytest import BAC0 from BAC0.core.devices.local.factory import ( analog_input, - analog_output, - analog_value, binary_input, - binary_output, - binary_value, - character_string, - date_value, - datetime_value, - humidity_input, - humidity_value, make_state_text, - multistate_input, - multistate_output, multistate_value, - temperature_input, - temperature_value, ) diff --git a/tests/manual_test_create_device.py b/tests/manual_test_create_device.py index 73260016..f81e0210 100644 --- a/tests/manual_test_create_device.py +++ b/tests/manual_test_create_device.py @@ -1,12 +1,9 @@ import asyncio -import time -from collections import namedtuple import BAC0 from BAC0.core.devices.local.factory import ( ObjectFactory, analog_input, - analog_output, analog_value, binary_input, binary_output, @@ -14,14 +11,9 @@ character_string, date_value, datetime_value, - humidity_input, - humidity_value, make_state_text, multistate_input, multistate_output, - multistate_value, - temperature_input, - temperature_value, ) @@ -93,10 +85,10 @@ async def main(): test_device_30 = BAC0.device("{}:47810".format(ip_30), boid_30, bacnet, poll=0) test_device_300 = BAC0.device("{}:47811".format(ip_300), boid_300, bacnet, poll=0) while True: - await asyncio.sleep(10) - print(test_device.points) - (test_device_30.points) - (test_device_300.points) + await asyncio.sleep(0.01) + #print(test_device.points) + #(test_device_30.points) + #(test_device_300.points) if __name__ == "__main__": diff --git a/tests/manual_test_schedule_datatype.py b/tests/manual_test_schedule_datatype.py index 46e1ccd6..f17d5a47 100644 --- a/tests/manual_test_schedule_datatype.py +++ b/tests/manual_test_schedule_datatype.py @@ -1,9 +1,8 @@ from datetime import datetime as dt from datetime import time as dt_time -from bacpypes.basetypes import DailySchedule, DateTime, Time, TimeValue +from bacpypes.basetypes import DailySchedule, Time, TimeValue from bacpypes.constructeddata import ArrayOf -from bacpypes.primitivedata import Atomic, Enumerated, Integer, Null, Real, Unsigned sched = [ { @@ -69,5 +68,5 @@ def to_time_tuple(self, val): return self.to_time_tuple(dt.datetime.strptime(val, "%H:%M:%S").time()) else: raise Exception("Unsupported time format encountered!") - except Exception as e: + except Exception: raise Exception("Error during parsing time format to bacnet!") diff --git a/tests/manualtest_cov.py b/tests/manualtest_cov.py index d2534b20..c5dc00c2 100644 --- a/tests/manualtest_cov.py +++ b/tests/manualtest_cov.py @@ -1,6 +1,5 @@ import time -from bacpypes.primitivedata import Real import BAC0 from BAC0.core.devices.local.models import analog_value diff --git a/tests/old_BAC0_web.py b/tests/old_BAC0_web.py index b9583b72..99b1753b 100644 --- a/tests/old_BAC0_web.py +++ b/tests/old_BAC0_web.py @@ -7,7 +7,6 @@ import time -import pytest import BAC0 diff --git a/tests/test_AsyncRead.py b/tests/test_AsyncRead.py index fb1d35f5..f54db9b9 100644 --- a/tests/test_AsyncRead.py +++ b/tests/test_AsyncRead.py @@ -1,6 +1,5 @@ #!/usr/BIn/env python # -*- coding utf-8 -*- -import pytest """ Test Bacnet communication with another device diff --git a/tests/test_BAC0_async.py b/tests/test_BAC0_async.py index 49bbf3df..84714b74 100644 --- a/tests/test_BAC0_async.py +++ b/tests/test_BAC0_async.py @@ -5,8 +5,6 @@ Test BAC0.lite """ -import asyncio -import time import pytest diff --git a/tests/test_WhoHasIHave.py b/tests/test_WhoHasIHave.py index 0ff7e86b..814e5a2a 100644 --- a/tests/test_WhoHasIHave.py +++ b/tests/test_WhoHasIHave.py @@ -1,6 +1,5 @@ #!/usr/bin/env python -import pytest def test_WhoHas(network_and_devices): diff --git a/tests/test_Write.py b/tests/test_Write.py index c18db8f6..806a0ac3 100644 --- a/tests/test_Write.py +++ b/tests/test_Write.py @@ -7,7 +7,6 @@ import time import pytest -from bacpypes.primitivedata import CharacterString NEWCSVALUE = "New_Test"