1
0
mirror of https://github.com/JoelBender/bacpypes synced 2025-09-28 22:15:23 +08:00

add __lt__ function to make tasks orderable (so heappush is happy in py34), update metaclass syntax in py34 singleton

This commit is contained in:
Joel Bender 2015-08-09 23:26:03 -04:00
parent bbcf3c2bc0
commit 11caa8a18a
5 changed files with 15 additions and 6 deletions

View File

@ -92,6 +92,9 @@ class _Task(DebugContents, Logging):
_task_manager.resume_task(self)
def __lt__(self, other):
return id(self) < id(other)
#
# OneShotTask
#

View File

@ -92,6 +92,9 @@ class _Task(DebugContents, Logging):
_task_manager.resume_task(self)
def __lt__(self, other):
return id(self) < id(other)
#
# OneShotTask
#

View File

@ -56,18 +56,18 @@ class _SingletonMetaclass(type):
# Singleton
#
class Singleton(object):
class Singleton(metaclass=_SingletonMetaclass):
__metaclass__ = _SingletonMetaclass
pass
#
# _SingletonLoggingMetaclass
#
class _SingletonLoggingMetaclass(_SingletonMetaclass, debugging._LoggingMetaclass):
pass
class SingletonLogging(object):
__metaclass__ = _SingletonLoggingMetaclass
class SingletonLogging(metaclass=_SingletonLoggingMetaclass):
pass

View File

@ -92,6 +92,9 @@ class _Task(DebugContents, Logging):
_task_manager.resume_task(self)
def __lt__(self, other):
return id(self) < id(other)
#
# OneShotTask
#