Fixed docstring of `Event.__init__`.

This commit is contained in:
Fabio Manganiello 2023-03-26 22:53:11 +02:00
parent 276aff757b
commit 30124e7cef
Signed by: blacklight
GPG Key ID: D90FBA7F76362774
1 changed files with 16 additions and 10 deletions

View File

@ -34,13 +34,19 @@ class Event(Message):
**kwargs **kwargs
): ):
""" """
Params: :param target: Target node
target -- Target node [String] :type target: str
origin -- Origin node (default: current node) [String] :param origin: Origin node (default: current node)
id -- Event ID (default: auto-generated) :type origin: str
kwargs -- Additional arguments for the event [kwDict] :param id: Event ID (default: auto-generated)
logging_level -- Logging level that should be applied to these :type id: str
events (default: INFO). :param timestamp: Event timestamp (default: current time)
:type timestamp: float
:param logging_level: Logging level for this event (default:
``logging.INFO``)
:param disable_web_clients_notification: Don't send a notification of
this event to the websocket clients
:param kwargs: Additional arguments for the event
""" """
super().__init__(timestamp=timestamp, logging_level=logging_level) super().__init__(timestamp=timestamp, logging_level=logging_level)
@ -96,7 +102,7 @@ class Event(Message):
if not isinstance(self, condition.type): if not isinstance(self, condition.type):
return result return result
for (attr, value) in condition.args.items(): for attr, value in condition.args.items():
if attr not in self.args: if attr not in self.args:
return result return result
@ -105,7 +111,7 @@ class Event(Message):
if arg_result.is_match: if arg_result.is_match:
match_scores.append(arg_result.score) match_scores.append(arg_result.score)
for (parsed_arg, parsed_value) in arg_result.parsed_args.items(): for parsed_arg, parsed_value in arg_result.parsed_args.items():
result.parsed_args[parsed_arg] = parsed_value result.parsed_args[parsed_arg] = parsed_value
else: else:
return result return result
@ -226,7 +232,7 @@ class EventMatchResult:
def flatten(args): def flatten(args):
if isinstance(args, dict): if isinstance(args, dict):
for (key, value) in args.items(): for key, value in args.items():
if isinstance(value, date): if isinstance(value, date):
args[key] = value.isoformat() args[key] = value.isoformat()
elif isinstance(value, (dict, list)): elif isinstance(value, (dict, list)):