src.fairreckitlib.data.ratings.convert_event
This module contains event args and a print function for a rating conversion event.
Classes:
ConvertRatingsEventArgs: event args related to converting dataframe ratings.
Functions:
print_convert_event_args: print rating conversion event arguments.
This program has been developed by students from the bachelor Computer Science at Utrecht University within the Software Project course. © Copyright Utrecht University (Department of Information and Computing Sciences)
1"""This module contains event args and a print function for a rating conversion event. 2 3Classes: 4 5 ConvertRatingsEventArgs: event args related to converting dataframe ratings. 6 7Functions: 8 9 print_convert_event_args: print rating conversion event arguments. 10 11This program has been developed by students from the bachelor Computer Science at 12Utrecht University within the Software Project course. 13© Copyright Utrecht University (Department of Information and Computing Sciences) 14""" 15 16from dataclasses import dataclass 17 18from ...core.events.event_dispatcher import EventArgs 19from .convert_config import ConvertConfig 20 21 22@dataclass 23class ConvertRatingsEventArgs(EventArgs): 24 """Convert Ratings Event Arguments. 25 26 event_id: the unique ID that classifies the rating conversion event. 27 convert_config: the rating conversion configuration that is used. 28 """ 29 30 convert_config: ConvertConfig 31 32 33def print_convert_event_args(event_args: ConvertRatingsEventArgs, elapsed_time: float=None) -> None: 34 """Print convert ratings event arguments. 35 36 It is assumed that the event started when elapsed_time is None and is finished otherwise. 37 38 Args: 39 event_args: the arguments to print. 40 elapsed_time: the time that has passed since the conversion started, expressed in seconds. 41 """ 42 if elapsed_time is None: 43 print('Converting dataframe ratings:', event_args.convert_config.name) 44 else: 45 print(f'Converted dataframe ratings in {elapsed_time:1.4f}s')
23@dataclass 24class ConvertRatingsEventArgs(EventArgs): 25 """Convert Ratings Event Arguments. 26 27 event_id: the unique ID that classifies the rating conversion event. 28 convert_config: the rating conversion configuration that is used. 29 """ 30 31 convert_config: ConvertConfig
Convert Ratings Event Arguments.
event_id: the unique ID that classifies the rating conversion event. convert_config: the rating conversion configuration that is used.
34def print_convert_event_args(event_args: ConvertRatingsEventArgs, elapsed_time: float=None) -> None: 35 """Print convert ratings event arguments. 36 37 It is assumed that the event started when elapsed_time is None and is finished otherwise. 38 39 Args: 40 event_args: the arguments to print. 41 elapsed_time: the time that has passed since the conversion started, expressed in seconds. 42 """ 43 if elapsed_time is None: 44 print('Converting dataframe ratings:', event_args.convert_config.name) 45 else: 46 print(f'Converted dataframe ratings in {elapsed_time:1.4f}s')
Print convert ratings event arguments.
It is assumed that the event started when elapsed_time is None and is finished otherwise.
Args: event_args: the arguments to print. elapsed_time: the time that has passed since the conversion started, expressed in seconds.