mirror of
https://github.com/JoelBender/bacpypes
synced 2025-09-28 22:15:23 +08:00
finish the conversion from py25 to py27 in #75 by using decorators
This commit is contained in:
parent
fc6e1e7187
commit
cd2246c228
|
@ -51,6 +51,7 @@ test_application = None
|
|||
# SubscriptionList
|
||||
#
|
||||
|
||||
@bacpypes_debugging
|
||||
class SubscriptionList:
|
||||
|
||||
def __init__(self):
|
||||
|
@ -93,7 +94,6 @@ class SubscriptionList:
|
|||
for cov in self.cov_subscriptions:
|
||||
yield cov
|
||||
|
||||
bacpypes_debugging(SubscriptionList)
|
||||
|
||||
#
|
||||
# Subscription
|
||||
|
@ -881,6 +881,7 @@ class SubscribeCOVApplication(COVApplicationMixin, BIPSimpleApplication):
|
|||
# COVConsoleCmd
|
||||
#
|
||||
|
||||
@bacpypes_debugging
|
||||
class COVConsoleCmd(ConsoleCmd):
|
||||
|
||||
def do_subscribe(self, args):
|
||||
|
@ -1091,8 +1092,6 @@ class COVConsoleCmd(ConsoleCmd):
|
|||
except Exception as err:
|
||||
print("exception: %s" % (err,))
|
||||
|
||||
bacpypes_debugging(COVConsoleCmd)
|
||||
|
||||
|
||||
def main():
|
||||
global test_application
|
||||
|
|
|
@ -23,6 +23,7 @@ this_console = None
|
|||
# ConsoleCmdTemplate
|
||||
#
|
||||
|
||||
@bacpypes_debugging
|
||||
class ConsoleCmdTemplate(ConsoleCmd):
|
||||
|
||||
def do_echo(self, args):
|
||||
|
@ -32,8 +33,6 @@ class ConsoleCmdTemplate(ConsoleCmd):
|
|||
|
||||
sys.stdout.write(' '.join(args) + '\n')
|
||||
|
||||
bacpypes_debugging(ConsoleCmdTemplate)
|
||||
|
||||
|
||||
def main():
|
||||
global this_console
|
||||
|
|
|
@ -36,6 +36,7 @@ this_console = None
|
|||
# ReadPropertyApplication
|
||||
#
|
||||
|
||||
@bacpypes_debugging
|
||||
class ReadPropertyApplication(BIPSimpleApplication):
|
||||
|
||||
def __init__(self, *args):
|
||||
|
@ -86,12 +87,12 @@ class ReadPropertyApplication(BIPSimpleApplication):
|
|||
value.debug_contents(file=sys.stdout)
|
||||
sys.stdout.flush()
|
||||
|
||||
bacpypes_debugging(ReadPropertyApplication)
|
||||
|
||||
#
|
||||
# ReadPropertyConsoleCmd
|
||||
#
|
||||
|
||||
@bacpypes_debugging
|
||||
class ReadPropertyConsoleCmd(ConsoleCmd):
|
||||
|
||||
def do_read(self, args):
|
||||
|
@ -130,7 +131,6 @@ class ReadPropertyConsoleCmd(ConsoleCmd):
|
|||
except Exception as error:
|
||||
ReadPropertyConsoleCmd._exception("exception: %r", error)
|
||||
|
||||
bacpypes_debugging(ReadPropertyConsoleCmd)
|
||||
|
||||
#
|
||||
# __main__
|
||||
|
|
|
@ -36,6 +36,7 @@ this_console = None
|
|||
# ReadPropertyAnyApplication
|
||||
#
|
||||
|
||||
@bacpypes_debugging
|
||||
class ReadPropertyAnyApplication(BIPSimpleApplication):
|
||||
|
||||
def __init__(self, *args):
|
||||
|
@ -88,12 +89,12 @@ class ReadPropertyAnyApplication(BIPSimpleApplication):
|
|||
|
||||
sys.stdout.flush()
|
||||
|
||||
bacpypes_debugging(ReadPropertyAnyApplication)
|
||||
|
||||
#
|
||||
# ReadPropertyAnyConsoleCmd
|
||||
#
|
||||
|
||||
@bacpypes_debugging
|
||||
class ReadPropertyAnyConsoleCmd(ConsoleCmd):
|
||||
|
||||
def do_read(self, args):
|
||||
|
@ -131,7 +132,6 @@ class ReadPropertyAnyConsoleCmd(ConsoleCmd):
|
|||
except Exception as error:
|
||||
ReadPropertyAnyConsoleCmd._exception("exception: %r", error)
|
||||
|
||||
bacpypes_debugging(ReadPropertyAnyConsoleCmd)
|
||||
|
||||
#
|
||||
# __main__
|
||||
|
|
|
@ -33,6 +33,7 @@ this_application = None
|
|||
# SampleApplication
|
||||
#
|
||||
|
||||
@bacpypes_debugging
|
||||
class SampleApplication(BIPSimpleApplication):
|
||||
|
||||
def __init__(self, device, address):
|
||||
|
@ -55,7 +56,6 @@ class SampleApplication(BIPSimpleApplication):
|
|||
if _debug: SampleApplication._debug("confirmation %r", apdu)
|
||||
BIPSimpleApplication.confirmation(self, apdu)
|
||||
|
||||
bacpypes_debugging(SampleApplication)
|
||||
|
||||
#
|
||||
# __main__
|
||||
|
|
|
@ -29,6 +29,7 @@ this_console = None
|
|||
# SampleApplication
|
||||
#
|
||||
|
||||
@bacpypes_debugging
|
||||
class SampleApplication(BIPSimpleApplication):
|
||||
|
||||
def __init__(self, device, address):
|
||||
|
@ -51,12 +52,12 @@ class SampleApplication(BIPSimpleApplication):
|
|||
if _debug: SampleApplication._debug("confirmation %r", apdu)
|
||||
BIPSimpleApplication.confirmation(self, apdu)
|
||||
|
||||
bacpypes_debugging(SampleApplication)
|
||||
|
||||
#
|
||||
# SampleConsoleCmd
|
||||
#
|
||||
|
||||
@bacpypes_debugging
|
||||
class SampleConsoleCmd(ConsoleCmd):
|
||||
|
||||
def do_nothing(self, args):
|
||||
|
@ -64,7 +65,6 @@ class SampleConsoleCmd(ConsoleCmd):
|
|||
args = args.split()
|
||||
if _debug: SampleConsoleCmd._debug("do_nothing %r", args)
|
||||
|
||||
bacpypes_debugging(SampleConsoleCmd)
|
||||
|
||||
#
|
||||
# __main__
|
||||
|
|
|
@ -40,6 +40,7 @@ rsvp = (True, None, None)
|
|||
# SubscribeCOVApplication
|
||||
#
|
||||
|
||||
@bacpypes_debugging
|
||||
class SubscribeCOVApplication(BIPSimpleApplication):
|
||||
|
||||
def __init__(self, *args):
|
||||
|
@ -95,12 +96,12 @@ class SubscribeCOVApplication(BIPSimpleApplication):
|
|||
def do_UnconfirmedCOVNotificationRequest(self, apdu):
|
||||
if _debug: SubscribeCOVApplication._debug("do_UnconfirmedCOVNotificationRequest %r", apdu)
|
||||
|
||||
bacpypes_debugging(SubscribeCOVApplication)
|
||||
|
||||
#
|
||||
# SubscribeCOVConsoleCmd
|
||||
#
|
||||
|
||||
@bacpypes_debugging
|
||||
class SubscribeCOVConsoleCmd(ConsoleCmd):
|
||||
|
||||
def do_subscribe(self, args):
|
||||
|
@ -188,7 +189,6 @@ class SubscribeCOVConsoleCmd(ConsoleCmd):
|
|||
|
||||
rsvp = (False, None, args[0])
|
||||
|
||||
bacpypes_debugging(SubscribeCOVConsoleCmd)
|
||||
|
||||
#
|
||||
# __main__
|
||||
|
|
|
@ -31,6 +31,7 @@ default_server_port = 9000
|
|||
# MiddleMan
|
||||
#
|
||||
|
||||
@bacpypes_debugging
|
||||
class MiddleMan(Client, Server):
|
||||
"""
|
||||
An instance of this class sits between the TCPClientDirector and the
|
||||
|
@ -57,12 +58,12 @@ class MiddleMan(Client, Server):
|
|||
# pass it along
|
||||
self.response(pdu)
|
||||
|
||||
bacpypes_debugging(MiddleMan)
|
||||
|
||||
#
|
||||
# MiddleManASE
|
||||
#
|
||||
|
||||
@bacpypes_debugging
|
||||
class MiddleManASE(ApplicationServiceElement):
|
||||
|
||||
def indication(self, addPeer=None, delPeer=None):
|
||||
|
@ -84,8 +85,6 @@ class MiddleManASE(ApplicationServiceElement):
|
|||
if _debug: MiddleManASE._debug(" - quitting")
|
||||
stop()
|
||||
|
||||
bacpypes_debugging(MiddleManASE)
|
||||
|
||||
|
||||
def main():
|
||||
"""
|
||||
|
|
|
@ -32,6 +32,7 @@ default_server_port = 9000
|
|||
# EchoMaster
|
||||
#
|
||||
|
||||
@bacpypes_debugging
|
||||
class EchoMaster(Client):
|
||||
|
||||
def confirmation(self, pdu):
|
||||
|
@ -39,12 +40,12 @@ class EchoMaster(Client):
|
|||
|
||||
self.request(PDU(pdu.pduData, destination=pdu.pduSource))
|
||||
|
||||
bacpypes_debugging(EchoMaster)
|
||||
|
||||
#
|
||||
# MiddleManASE
|
||||
#
|
||||
|
||||
@bacpypes_debugging
|
||||
class MiddleManASE(ApplicationServiceElement):
|
||||
|
||||
def indication(self, addPeer=None, delPeer=None):
|
||||
|
@ -61,7 +62,6 @@ class MiddleManASE(ApplicationServiceElement):
|
|||
if delPeer:
|
||||
if _debug: MiddleManASE._debug(" - delete peer %s", delPeer)
|
||||
|
||||
bacpypes_debugging(MiddleManASE)
|
||||
|
||||
#
|
||||
# __main__
|
||||
|
|
|
@ -34,6 +34,7 @@ this_console = None
|
|||
# WhoIsIAmApplication
|
||||
#
|
||||
|
||||
@bacpypes_debugging
|
||||
class WhoIsIAmApplication(BIPSimpleApplication):
|
||||
|
||||
def __init__(self, *args):
|
||||
|
@ -84,12 +85,12 @@ class WhoIsIAmApplication(BIPSimpleApplication):
|
|||
# forward it along
|
||||
BIPSimpleApplication.indication(self, apdu)
|
||||
|
||||
bacpypes_debugging(WhoIsIAmApplication)
|
||||
|
||||
#
|
||||
# WhoIsIAmConsoleCmd
|
||||
#
|
||||
|
||||
@bacpypes_debugging
|
||||
class WhoIsIAmConsoleCmd(ConsoleCmd):
|
||||
|
||||
def do_whois(self, args):
|
||||
|
@ -156,7 +157,6 @@ class WhoIsIAmConsoleCmd(ConsoleCmd):
|
|||
# pass along to the service access point
|
||||
this_application.nsap.add_router_references(adapter, router_address, network_list)
|
||||
|
||||
bacpypes_debugging(WhoIsIAmConsoleCmd)
|
||||
|
||||
#
|
||||
# __main__
|
||||
|
|
|
@ -34,6 +34,7 @@ this_console = None
|
|||
# WhoIsIAmApplication
|
||||
#
|
||||
|
||||
@bacpypes_debugging
|
||||
class WhoIsIAmApplication(BIPForeignApplication):
|
||||
|
||||
def __init__(self, *args):
|
||||
|
@ -84,12 +85,12 @@ class WhoIsIAmApplication(BIPForeignApplication):
|
|||
# forward it along
|
||||
BIPForeignApplication.indication(self, apdu)
|
||||
|
||||
bacpypes_debugging(WhoIsIAmApplication)
|
||||
|
||||
#
|
||||
# WhoIsIAmConsoleCmd
|
||||
#
|
||||
|
||||
@bacpypes_debugging
|
||||
class WhoIsIAmConsoleCmd(ConsoleCmd):
|
||||
|
||||
def do_whois(self, args):
|
||||
|
@ -156,7 +157,6 @@ class WhoIsIAmConsoleCmd(ConsoleCmd):
|
|||
# pass along to the service access point
|
||||
this_application.nsap.add_router_references(adapter, router_address, network_list)
|
||||
|
||||
bacpypes_debugging(WhoIsIAmConsoleCmd)
|
||||
|
||||
#
|
||||
# main
|
||||
|
|
Loading…
Reference in New Issue
Block a user