mirror of
https://github.com/onyx-and-iris/vban-cmd-python.git
synced 2024-11-15 17:10:46 +00:00
base renamed to vbancmd
misc renamed to event info message fixed if no events subbed to now using logging module in Event class
This commit is contained in:
parent
f46abedf12
commit
1169435104
@ -1,13 +1,19 @@
|
|||||||
|
import logging
|
||||||
|
|
||||||
|
|
||||||
class Event:
|
class Event:
|
||||||
|
logger = logging.getLogger("event.event")
|
||||||
|
|
||||||
def __init__(self, subs: dict):
|
def __init__(self, subs: dict):
|
||||||
self.subs = subs
|
self.subs = subs
|
||||||
|
|
||||||
def info(self, msg):
|
def info(self, msg):
|
||||||
info = (
|
info = (f"{msg} events",)
|
||||||
f"{msg} events",
|
if self.any():
|
||||||
f"Now listening for {', '.join(self.get())} events",
|
info += (f"now listening for {', '.join(self.get())} events",)
|
||||||
)
|
else:
|
||||||
print("\n".join(info))
|
info += (f"not listening for any events",)
|
||||||
|
self.logger.info(", ".join(info))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def pdirty(self):
|
def pdirty(self):
|
@ -3,7 +3,7 @@ import time
|
|||||||
from abc import ABCMeta, abstractmethod
|
from abc import ABCMeta, abstractmethod
|
||||||
from typing import Iterable, Optional, Union
|
from typing import Iterable, Optional, Union
|
||||||
|
|
||||||
from .misc import Event
|
from .event import Event
|
||||||
from .packet import RequestHeader
|
from .packet import RequestHeader
|
||||||
from .subject import Subject
|
from .subject import Subject
|
||||||
from .util import Socket, comp, script
|
from .util import Socket, comp, script
|
||||||
@ -122,8 +122,8 @@ class VbanCmd(metaclass=ABCMeta):
|
|||||||
strip levels in PREFADER mode.
|
strip levels in PREFADER mode.
|
||||||
"""
|
"""
|
||||||
return (
|
return (
|
||||||
tuple(val for val in packet.inputlevels),
|
tuple(((1 << 16) - 1) - val for val in packet.inputlevels),
|
||||||
tuple(val for val in packet.outputlevels),
|
tuple(((1 << 16) - 1) - val for val in packet.outputlevels),
|
||||||
)
|
)
|
||||||
|
|
||||||
def apply(self, data: dict):
|
def apply(self, data: dict):
|
Loading…
Reference in New Issue
Block a user