From cc1db316e64b874254b026bd2a681b8c46fa21c7 Mon Sep 17 00:00:00 2001 From: Alessandro Berti Date: Wed, 15 Nov 2023 12:41:28 +0100 Subject: [PATCH] refactor(pm4py): removed triggered exception --- pm4py/analysis.py | 8 ------ pm4py/conformance.py | 10 -------- pm4py/convert.py | 10 -------- pm4py/discovery.py | 61 -------------------------------------------- pm4py/filtering.py | 19 -------------- pm4py/llm.py | 5 ---- pm4py/ml.py | 7 ----- pm4py/org.py | 6 ----- pm4py/stats.py | 20 --------------- pm4py/utils.py | 4 --- pm4py/vis.py | 19 -------------- pm4py/write.py | 1 - 12 files changed, 170 deletions(-) diff --git a/pm4py/analysis.py b/pm4py/analysis.py index 63cf6553b..0028caa89 100644 --- a/pm4py/analysis.py +++ b/pm4py/analysis.py @@ -191,8 +191,6 @@ def cluster_log(log: Union[EventLog, EventStream, pd.DataFrame], sklearn_cluster for clust_log in pm4py.cluster_log(df): print(clust_log) """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception( - "the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) properties = get_properties(log, activity_key=activity_key, case_id_key=case_id_key, timestamp_key=timestamp_key) @@ -221,8 +219,6 @@ def insert_artificial_start_end(log: Union[EventLog, pd.DataFrame], activity_key dataframe = pm4py.insert_artificial_start_end(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception( - "the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) properties = get_properties(log, activity_key=activity_key, case_id_key=case_id_key, timestamp_key=timestamp_key) @@ -262,8 +258,6 @@ def insert_case_service_waiting_time(log: Union[EventLog, pd.DataFrame], service dataframe = pm4py.insert_case_service_waiting_time(dataframe, activity_key='concept:name', timestamp_key='time:timestamp', case_id_key='case:concept:name', start_timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception( - "the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) properties = get_properties(log, activity_key=activity_key, case_id_key=case_id_key, timestamp_key=timestamp_key) @@ -297,8 +291,6 @@ def insert_case_arrival_finish_rate(log: Union[EventLog, pd.DataFrame], arrival_ dataframe = pm4py.insert_case_arrival_finish_rate(dataframe, activity_key='concept:name', timestamp_key='time:timestamp', case_id_key='case:concept:name', start_timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception( - "the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) properties = get_properties(log, activity_key=activity_key, case_id_key=case_id_key, timestamp_key=timestamp_key) diff --git a/pm4py/conformance.py b/pm4py/conformance.py index 2018be7c7..2b7ec1235 100644 --- a/pm4py/conformance.py +++ b/pm4py/conformance.py @@ -64,7 +64,6 @@ def conformance_diagnostics_token_based_replay(log: Union[EventLog, pd.DataFrame net, im, fm = pm4py.discover_petri_net_inductive(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') tbr_diagnostics = pm4py.conformance_diagnostics_token_based_replay(dataframe, net, im, fm, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) if check_is_pandas_dataframe(log): @@ -127,7 +126,6 @@ def conformance_diagnostics_alignments(log: Union[EventLog, pd.DataFrame], *args net, im, fm = pm4py.discover_petri_net_inductive(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') alignments_diagnostics = pm4py.conformance_diagnostics_alignments(dataframe, net, im, fm, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) if check_is_pandas_dataframe(log): @@ -225,7 +223,6 @@ def fitness_token_based_replay(log: Union[EventLog, pd.DataFrame], petri_net: Pe net, im, fm = pm4py.discover_petri_net_inductive(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') fitness_tbr = pm4py.fitness_token_based_replay(dataframe, net, im, fm, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) if check_is_pandas_dataframe(log): @@ -275,7 +272,6 @@ def fitness_alignments(log: Union[EventLog, pd.DataFrame], petri_net: PetriNet, net, im, fm = pm4py.discover_petri_net_inductive(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') fitness_alignments = pm4py.fitness_alignments(dataframe, net, im, fm, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) if check_is_pandas_dataframe(log): @@ -322,7 +318,6 @@ def precision_token_based_replay(log: Union[EventLog, pd.DataFrame], petri_net: net, im, fm = pm4py.discover_petri_net_inductive(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') precision_tbr = pm4py.precision_token_based_replay(dataframe, net, im, fm, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) if check_is_pandas_dataframe(log): @@ -372,7 +367,6 @@ def precision_alignments(log: Union[EventLog, pd.DataFrame], petri_net: PetriNet net, im, fm = pm4py.discover_petri_net_inductive(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') precision_alignments = pm4py.precision_alignments(dataframe, net, im, fm, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) if check_is_pandas_dataframe(log): @@ -650,7 +644,6 @@ def conformance_temporal_profile(log: Union[EventLog, pd.DataFrame], temporal_pr temporal_profile = pm4py.discover_temporal_profile(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') conformance_temporal_profile = pm4py.conformance_temporal_profile(dataframe, temporal_profile, zeta=1, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) if check_is_pandas_dataframe(log): @@ -691,8 +684,6 @@ def conformance_declare(log: Union[EventLog, pd.DataFrame], declare_model: Dict[ declare_model = pm4py.discover_declare(log) conf_result = pm4py.conformance_declare(log, declare_model) """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception( - "the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) if check_is_pandas_dataframe(log): @@ -753,7 +744,6 @@ def conformance_log_skeleton(log: Union[EventLog, pd.DataFrame], log_skeleton: D log_skeleton = pm4py.discover_log_skeleton(dataframe, noise_threshold=0.1, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') conformance_lsk = pm4py.conformance_log_skeleton(dataframe, log_skeleton, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) if check_is_pandas_dataframe(log): diff --git a/pm4py/convert.py b/pm4py/convert.py index b49f1222c..80a959124 100644 --- a/pm4py/convert.py +++ b/pm4py/convert.py @@ -39,7 +39,6 @@ def convert_to_event_log(obj: Union[pd.DataFrame, EventStream], case_id_key: str dataframe = pm4py.format_dataframe(dataframe, case_id_column='case:concept:name', activity_column='concept:name', timestamp_column='time:timestamp') log = pm4py.convert_to_event_log(dataframe) """ - if type(obj) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") if check_is_pandas_dataframe(obj): check_pandas_dataframe_columns(obj, case_id_key=case_id_key) @@ -72,8 +71,6 @@ def convert_to_event_stream(obj: Union[EventLog, pd.DataFrame], case_id_key: str event_stream = pm4py.convert_to_event_stream(log) """ - if type(obj) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") - if check_is_pandas_dataframe(obj): check_pandas_dataframe_columns(obj, case_id_key=case_id_key) @@ -103,8 +100,6 @@ def convert_to_dataframe(obj: Union[EventStream, EventLog], **kwargs) -> pd.Data log = pm4py.read_xes("tests/input_data/running-example.xes") dataframe = pm4py.convert_to_dataframe(log) """ - if type(obj) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") - if check_is_pandas_dataframe(obj): check_pandas_dataframe_columns(obj) @@ -283,9 +278,6 @@ def convert_log_to_ocel(log: Union[EventLog, EventStream, pd.DataFrame], activit ocel = pm4py.convert_log_to_ocel(log, activity_column='concept:name', timestamp_column='time:timestamp', object_types=['case:concept:name']) """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: - raise Exception( - "the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) if isinstance(log, EventStream): @@ -376,8 +368,6 @@ def convert_log_to_time_intervals(log: Union[EventLog, pd.DataFrame], filter_act time_intervals = pm4py.convert_log_to_time_intervals(log, ('Confirmation of receipt', 'T02 Check confirmation of receipt')) print(len(time_intervals)) """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception( - "the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) properties = get_properties(log, activity_key=activity_key, case_id_key=case_id_key, timestamp_key=timestamp_key) diff --git a/pm4py/discovery.py b/pm4py/discovery.py index 44e57ac3c..cbb22f938 100644 --- a/pm4py/discovery.py +++ b/pm4py/discovery.py @@ -43,9 +43,6 @@ def discover_dfg(log: Union[EventLog, pd.DataFrame], activity_key: str = "concep dfg, start_activities, end_activities = pm4py.discover_dfg(dataframe, case_id_key='case:concept:name', activity_key='concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: - raise Exception( - "the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) properties = get_properties( @@ -78,10 +75,6 @@ def discover_dfg(log: Union[EventLog, pd.DataFrame], activity_key: str = "concep def discover_directly_follows_graph(log: Union[EventLog, pd.DataFrame], activity_key: str = "concept:name", timestamp_key: str = "time:timestamp", case_id_key: str = "case:concept:name") -> Tuple[dict, dict, dict]: - if type(log) not in [pd.DataFrame, EventLog, EventStream]: - raise Exception( - "the method can be applied only to a traditional event log!") - return discover_dfg(log, activity_key=activity_key, timestamp_key=timestamp_key, case_id_key=case_id_key) @@ -147,9 +140,6 @@ def discover_performance_dfg(log: Union[EventLog, pd.DataFrame], business_hours: performance_dfg, start_activities, end_activities = pm4py.discover_performance_dfg(dataframe, case_id_key='case:concept:name', activity_key='concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: - raise Exception( - "the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) properties = get_properties( @@ -200,9 +190,6 @@ def discover_petri_net_alpha(log: Union[EventLog, pd.DataFrame], activity_key: s net, im, fm = pm4py.discover_petri_net_alpha(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: - raise Exception( - "the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) if check_is_pandas_dataframe(log): @@ -230,9 +217,6 @@ def discover_petri_net_ilp(log: Union[EventLog, pd.DataFrame], alpha: float = 1. net, im, fm = pm4py.discover_petri_net_ilp(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: - raise Exception( - "the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) if check_is_pandas_dataframe(log): @@ -263,9 +247,6 @@ def discover_petri_net_alpha_plus(log: Union[EventLog, pd.DataFrame], activity_k net, im, fm = pm4py.discover_petri_net_alpha_plus(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: - raise Exception( - "the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) if check_is_pandas_dataframe(log): @@ -300,9 +281,6 @@ def discover_petri_net_inductive(log: Union[EventLog, pd.DataFrame, DFG], multi_ net, im, fm = pm4py.discover_petri_net_inductive(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream, DFG]: - raise Exception( - "the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) if check_is_pandas_dataframe(log): @@ -338,9 +316,6 @@ def discover_petri_net_heuristics(log: Union[EventLog, pd.DataFrame], dependency net, im, fm = pm4py.discover_petri_net_heuristics(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: - raise Exception( - "the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) from pm4py.algo.discovery.heuristics.variants import classic as heuristics_miner @@ -382,9 +357,6 @@ def discover_process_tree_inductive(log: Union[EventLog, pd.DataFrame, DFG], noi process_tree = pm4py.discover_process_tree_inductive(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream, DFG]: - raise Exception( - "the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) if check_is_pandas_dataframe(log): @@ -432,9 +404,6 @@ def discover_heuristics_net(log: Union[EventLog, pd.DataFrame], dependency_thres heu_net = pm4py.discover_heuristics_net(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: - raise Exception( - "the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) from pm4py.algo.discovery.heuristics.variants import classic as heuristics_miner @@ -474,9 +443,6 @@ def derive_minimum_self_distance(log: Union[DataFrame, EventLog, EventStream], a msd = pm4py.derive_minimum_self_distance(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: - raise Exception( - "the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) if check_is_pandas_dataframe(log): @@ -525,9 +491,6 @@ def discover_eventually_follows_graph(log: Union[EventLog, pd.DataFrame], activi efg = pm4py.discover_eventually_follows_graph(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: - raise Exception( - "the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) properties = get_properties( @@ -566,9 +529,6 @@ def discover_bpmn_inductive(log: Union[EventLog, pd.DataFrame, DFG], noise_thres bpmn_graph = pm4py.discover_bpmn_inductive(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream, DFG]: - raise Exception( - "the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) if check_is_pandas_dataframe(log): @@ -601,9 +561,6 @@ def discover_transition_system(log: Union[EventLog, pd.DataFrame], direction: st transition_system = pm4py.discover_transition_system(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: - raise Exception( - "the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) if check_is_pandas_dataframe(log): @@ -636,9 +593,6 @@ def discover_prefix_tree(log: Union[EventLog, pd.DataFrame], activity_key: str = prefix_tree = pm4py.discover_prefix_tree(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: - raise Exception( - "the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) if check_is_pandas_dataframe(log): @@ -682,9 +636,6 @@ def discover_temporal_profile(log: Union[EventLog, pd.DataFrame], activity_key: temporal_profile = pm4py.discover_temporal_profile(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: - raise Exception( - "the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) if check_is_pandas_dataframe(log): @@ -735,9 +686,6 @@ def discover_log_skeleton(log: Union[EventLog, pd.DataFrame], noise_threshold: f log_skeleton = pm4py.discover_log_skeleton(dataframe, noise_threshold=0.1, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: - raise Exception( - "the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) if check_is_pandas_dataframe(log): @@ -775,9 +723,6 @@ def discover_declare(log: Union[EventLog, pd.DataFrame], allowed_templates: Opti declare_model = pm4py.discover_declare(log) """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: - raise Exception( - "the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) if check_is_pandas_dataframe(log): @@ -816,9 +761,6 @@ def discover_powl(log: Union[EventLog, pd.DataFrame], activity_key: str = "conce powl_model = pm4py.discover_powl(log, activity_key='concept:name') print(powl_model) """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: - raise Exception( - "the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) if check_is_pandas_dataframe(log): @@ -876,9 +818,6 @@ def discover_batches(log: Union[EventLog, pd.DataFrame], merge_distance: int = 1 batches = pm4py.discover_log_skeleton(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp', resource_key='org:resource') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: - raise Exception( - "the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) if check_is_pandas_dataframe(log): diff --git a/pm4py/filtering.py b/pm4py/filtering.py index 0d7ab6f88..6c369b7aa 100644 --- a/pm4py/filtering.py +++ b/pm4py/filtering.py @@ -35,7 +35,6 @@ def filter_log_relative_occurrence_event_attribute(log: Union[EventLog, pd.DataF filtered_dataframe = pm4py.filter_log_relative_occurrence_event_attribute(dataframe, 0.5, level='cases', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) parameters = get_properties(log, timestamp_key=timestamp_key, case_id_key=case_id_key, activity_key=attribute_key) @@ -71,7 +70,6 @@ def filter_start_activities(log: Union[EventLog, pd.DataFrame], activities: Unio filtered_dataframe = pm4py.filter_start_activities(dataframe, ['Act. A'], activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) parameters = get_properties(log, activity_key=activity_key, timestamp_key=timestamp_key, case_id_key=case_id_key) @@ -107,7 +105,6 @@ def filter_end_activities(log: Union[EventLog, pd.DataFrame], activities: Union filtered_dataframe = pm4py.filter_end_activities(dataframe, ['Act. Z'], activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) parameters = get_properties(log, activity_key=activity_key, timestamp_key=timestamp_key, case_id_key=case_id_key) @@ -143,7 +140,6 @@ def filter_event_attribute_values(log: Union[EventLog, pd.DataFrame], attribute_ filtered_dataframe = pm4py.filter_event_attribute_values(dataframe, 'concept:name', ['Act. A', 'Act. Z'], case_id_key='case:concept:name') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) parameters = get_properties(log, case_id_key=case_id_key) @@ -187,7 +183,6 @@ def filter_trace_attribute_values(log: Union[EventLog, pd.DataFrame], attribute_ filtered_dataframe = pm4py.filter_trace_attribute_values(dataframe, 'case:creator', ['Mike'], case_id_key='case:concept:name') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) parameters = get_properties(log, case_id_key=case_id_key) @@ -223,7 +218,6 @@ def filter_variants(log: Union[EventLog, pd.DataFrame], variants: Union[Set[str filtered_dataframe = pm4py.filter_variants(dataframe, [('Act. A', 'Act. B', 'Act. Z'), ('Act. A', 'Act. C', 'Act. Z')], activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) from pm4py.util import variants_util @@ -262,7 +256,6 @@ def filter_directly_follows_relation(log: Union[EventLog, pd.DataFrame], relatio filtered_dataframe = pm4py.filter_directly_follows_relation(dataframe, [('A','B'),('A','C')], activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) parameters = get_properties(log, activity_key=activity_key, timestamp_key=timestamp_key, case_id_key=case_id_key) @@ -360,7 +353,6 @@ def filter_time_range(log: Union[EventLog, pd.DataFrame], dt1: str, dt2: str, mo filtered_dataframe1 = pm4py.filter_time_range(dataframe, '2010-01-01 00:00:00', '2011-01-01 00:00:00', mode='traces_intersecting', case_id_key='case:concept:name', timestamp_key='time:timestamp') filtered_dataframe1 = pm4py.filter_time_range(dataframe, '2010-01-01 00:00:00', '2011-01-01 00:00:00', mode='events', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) properties = get_properties(log, timestamp_key=timestamp_key, case_id_key=case_id_key) @@ -426,7 +418,6 @@ def filter_between(log: Union[EventLog, pd.DataFrame], act1: str, act2: str, act filtered_dataframe = pm4py.filter_between(dataframe, 'A', 'D', activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) parameters = get_properties(log, activity_key=activity_key, timestamp_key=timestamp_key, case_id_key=case_id_key) @@ -456,7 +447,6 @@ def filter_case_size(log: Union[EventLog, pd.DataFrame], min_size: int, max_size filtered_dataframe = pm4py.filter_case_size(dataframe, 5, 10, case_id_key='case:concept:name') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) parameters = get_properties(log, case_id_key=case_id_key) @@ -489,7 +479,6 @@ def filter_case_performance(log: Union[EventLog, pd.DataFrame], min_performance: filtered_dataframe = pm4py.filter_case_performance(dataframe, 3600.0, 86400.0, timestamp_key='time:timestamp', case_id_key='case:concept:name') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) parameters = get_properties(log, timestamp_key=timestamp_key, case_id_key=case_id_key) @@ -520,7 +509,6 @@ def filter_activities_rework(log: Union[EventLog, pd.DataFrame], activity: str, filtered_dataframe = pm4py.filter_activities_rework(dataframe, 'Approve Order', 2, activity_key='concept:name', timestamp_key='time:timestamp', case_id_key='case:concept:name') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) parameters = get_properties(log, activity_key=activity_key, timestamp_key=timestamp_key, case_id_key=case_id_key) @@ -556,7 +544,6 @@ def filter_paths_performance(log: Union[EventLog, pd.DataFrame], path: Tuple[str filtered_dataframe = pm4py.filter_paths_performance(dataframe, ('A', 'D'), 3600.0, 86400.0, activity_key='concept:name', timestamp_key='time:timestamp', case_id_key='case:concept:name') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) parameters = get_properties(log, activity_key=activity_key, timestamp_key=timestamp_key, case_id_key=case_id_key) @@ -590,7 +577,6 @@ def filter_variants_top_k(log: Union[EventLog, pd.DataFrame], k: int, activity_k filtered_dataframe = pm4py.filter_variants_top_k(dataframe, 5, activity_key='concept:name', timestamp_key='time:timestamp', case_id_key='case:concept:name') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) parameters = get_properties(log, activity_key=activity_key, timestamp_key=timestamp_key, case_id_key=case_id_key) @@ -623,7 +609,6 @@ def filter_variants_by_coverage_percentage(log: Union[EventLog, pd.DataFrame], m filtered_dataframe = pm4py.filter_variants_by_coverage_percentage(dataframe, 0.1, activity_key='concept:name', timestamp_key='time:timestamp', case_id_key='case:concept:name') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) parameters = get_properties(log, activity_key=activity_key, timestamp_key=timestamp_key, case_id_key=case_id_key) @@ -665,7 +650,6 @@ def filter_prefixes(log: Union[EventLog, pd.DataFrame], activity: str, strict=Tr filtered_dataframe = pm4py.filter_prefixes(dataframe, 'Act. C', activity_key='concept:name', timestamp_key='time:timestamp', case_id_key='case:concept:name') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) parameters = get_properties(log, activity_key=activity_key, timestamp_key=timestamp_key, case_id_key=case_id_key) @@ -710,7 +694,6 @@ def filter_suffixes(log: Union[EventLog, pd.DataFrame], activity: str, strict=Tr filtered_dataframe = pm4py.filter_prefixes(dataframe, 'Act. C', activity_key='concept:name', timestamp_key='time:timestamp', case_id_key='case:concept:name') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) parameters = get_properties(log, activity_key=activity_key, timestamp_key=timestamp_key, case_id_key=case_id_key) @@ -894,7 +877,6 @@ def filter_four_eyes_principle(log: Union[EventLog, pd.DataFrame], activity1: st filtered_dataframe = pm4py.filter_four_eyes_principle(dataframe, 'Act. A', 'Act. B', activity_key='concept:name', resource_key='org:resource', timestamp_key='time:timestamp', case_id_key='case:concept:name') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) properties = get_properties(log, activity_key=activity_key, timestamp_key=timestamp_key, case_id_key=case_id_key, resource_key=resource_key) @@ -928,7 +910,6 @@ def filter_activity_done_different_resources(log: Union[EventLog, pd.DataFrame], filtered_dataframe = pm4py.filter_activity_done_different_resources(dataframe, 'Act. A', activity_key='concept:name', resource_key='org:resource', timestamp_key='time:timestamp', case_id_key='case:concept:name') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) properties = get_properties(log, activity_key=activity_key, timestamp_key=timestamp_key, case_id_key=case_id_key, resource_key=resource_key) diff --git a/pm4py/llm.py b/pm4py/llm.py index 04f9e264e..abaf9413b 100644 --- a/pm4py/llm.py +++ b/pm4py/llm.py @@ -56,7 +56,6 @@ def abstract_dfg(log_obj: Union[pd.DataFrame, EventLog, EventStream], max_len: i log = pm4py.read_xes("tests/input_data/roadtraffic100traces.xes") print(pm4py.llm.abstract_dfg(log)) """ - if type(log_obj) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log_obj) parameters = get_properties( @@ -95,7 +94,6 @@ def abstract_variants(log_obj: Union[pd.DataFrame, EventLog, EventStream], max_l log = pm4py.read_xes("tests/input_data/roadtraffic100traces.xes") print(pm4py.llm.abstract_variants(log)) """ - if type(log_obj) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log_obj) parameters = get_properties( @@ -208,7 +206,6 @@ def abstract_event_stream(log_obj: Union[pd.DataFrame, EventLog, EventStream], m log = pm4py.read_xes("tests/input_data/roadtraffic100traces.xes") print(pm4py.llm.abstract_event_stream(log)) """ - if type(log_obj) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log_obj) parameters = get_properties( @@ -262,7 +259,6 @@ def abstract_log_attributes(log_obj: Union[pd.DataFrame, EventLog, EventStream], log = pm4py.read_xes("tests/input_data/roadtraffic100traces.xes") print(pm4py.llm.abstract_log_attributes(log)) """ - if type(log_obj) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log_obj) parameters = get_properties( @@ -291,7 +287,6 @@ def abstract_log_features(log_obj: Union[pd.DataFrame, EventLog, EventStream], m log = pm4py.read_xes("tests/input_data/roadtraffic100traces.xes") print(pm4py.llm.abstract_log_features(log)) """ - if type(log_obj) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log_obj) parameters = get_properties( diff --git a/pm4py/ml.py b/pm4py/ml.py index 783810b12..b9b70986c 100644 --- a/pm4py/ml.py +++ b/pm4py/ml.py @@ -31,7 +31,6 @@ def split_train_test(log: Union[EventLog, pd.DataFrame], train_percentage: float train_df, test_df = pm4py.split_train_test(dataframe, train_percentage=0.75) """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) if check_is_pandas_dataframe(log): @@ -70,7 +69,6 @@ def get_prefixes_from_log(log: Union[EventLog, pd.DataFrame], length: int, case_ trimmed_df = pm4py.get_prefixes_from_log(dataframe, length=5, case_id_key='case:concept:name') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) if check_is_pandas_dataframe(log): @@ -104,8 +102,6 @@ def extract_outcome_enriched_dataframe(log: Union[EventLog, pd.DataFrame], activ enriched_df = pm4py.extract_outcome_enriched_dataframe(log, activity_key='concept:name', timestamp_key='time:timestamp', case_id_key='case:concept:name', start_timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception( - "the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) properties = get_properties(log, activity_key=activity_key, case_id_key=case_id_key, timestamp_key=timestamp_key) @@ -143,7 +139,6 @@ def extract_features_dataframe(log: Union[EventLog, pd.DataFrame], str_tr_attr=N features_df = pm4py.extract_features_dataframe(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) parameters = {} @@ -250,7 +245,6 @@ def extract_temporal_features_dataframe(log: Union[EventLog, pd.DataFrame], grou temporal_features_df = pm4py.extract_temporal_features_dataframe(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) parameters = get_properties(log, activity_key=activity_key, timestamp_key=timestamp_key, case_id_key=case_id_key) @@ -289,7 +283,6 @@ def extract_target_vector(log: Union[EventLog, pd.DataFrame], variant: str, acti vector_rem_time, class_rem_time = pm4py.extract_target_vector(log, 'remaining_time', activity_key='concept:name', timestamp_key='time:timestamp', case_id_key='case:concept:name') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) parameters = get_properties(log, activity_key=activity_key, timestamp_key=timestamp_key, case_id_key=case_id_key) diff --git a/pm4py/org.py b/pm4py/org.py index 3962d513b..da465f11e 100644 --- a/pm4py/org.py +++ b/pm4py/org.py @@ -34,7 +34,6 @@ def discover_handover_of_work_network(log: Union[EventLog, pd.DataFrame], beta=0 metric = pm4py.discover_handover_of_work_network(dataframe, resource_key='org:resource', timestamp_key='time:timestamp', case_id_key='case:concept:name') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) from pm4py.algo.organizational_mining.sna import algorithm as sna @@ -63,7 +62,6 @@ def discover_working_together_network(log: Union[EventLog, pd.DataFrame], resour metric = pm4py.discover_working_together_network(dataframe, resource_key='org:resource', timestamp_key='time:timestamp', case_id_key='case:concept:name') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) properties = get_properties(log, resource_key=resource_key, timestamp_key=timestamp_key, case_id_key=case_id_key) @@ -92,7 +90,6 @@ def discover_activity_based_resource_similarity(log: Union[EventLog, pd.DataFram act_res_sim = pm4py.discover_activity_based_resource_similarity(dataframe, resource_key='org:resource', activity_key='concept:name', timestamp_key='time:timestamp', case_id_key='case:concept:name') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) properties = get_properties(log, activity_key=activity_key, resource_key=resource_key, timestamp_key=timestamp_key, case_id_key=case_id_key) @@ -121,7 +118,6 @@ def discover_subcontracting_network(log: Union[EventLog, pd.DataFrame], n=2, res metric = pm4py.discover_subcontracting_network(dataframe, resource_key='org:resource', timestamp_key='time:timestamp', case_id_key='case:concept:name') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) from pm4py.algo.organizational_mining.sna import algorithm as sna @@ -155,7 +151,6 @@ def discover_organizational_roles(log: Union[EventLog, pd.DataFrame], activity_k roles = pm4py.discover_organizational_roles(dataframe, resource_key='org:resource', activity_key='concept:name', timestamp_key='time:timestamp', case_id_key='case:concept:name') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) properties = get_properties(log, activity_key=activity_key, resource_key=resource_key, timestamp_key=timestamp_key, case_id_key=case_id_key) @@ -210,7 +205,6 @@ def discover_network_analysis(log: Union[pd.DataFrame, EventLog, EventStream], o net_ana = pm4py.discover_network_analysis(dataframe, out_column='case:concept:name', in_column='case:concept:name', node_column_source='org:resource', node_column_target='org:resource', edge_column='concept:name') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) if check_is_pandas_dataframe(log): diff --git a/pm4py/stats.py b/pm4py/stats.py index ac120e662..b17093e43 100644 --- a/pm4py/stats.py +++ b/pm4py/stats.py @@ -33,7 +33,6 @@ def get_start_activities(log: Union[EventLog, pd.DataFrame], activity_key: str = start_activities = pm4py.get_start_activities(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) properties = get_properties(log, activity_key=activity_key, timestamp_key=timestamp_key, case_id_key=case_id_key) @@ -63,7 +62,6 @@ def get_end_activities(log: Union[EventLog, pd.DataFrame], activity_key: str = " end_activities = pm4py.get_end_activities(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) properties = get_properties(log, activity_key=activity_key, timestamp_key=timestamp_key, case_id_key=case_id_key) @@ -90,7 +88,6 @@ def get_event_attributes(log: Union[EventLog, pd.DataFrame]) -> List[str]: event_attributes = pm4py.get_event_attributes(dataframe) """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) if check_is_pandas_dataframe(log): @@ -114,7 +111,6 @@ def get_trace_attributes(log: Union[EventLog, pd.DataFrame]) -> List[str]: trace_attributes = pm4py.get_trace_attributes(dataframe) """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) from pm4py.util import constants @@ -142,7 +138,6 @@ def get_event_attribute_values(log: Union[EventLog, pd.DataFrame], attribute: st activities = pm4py.get_event_attribute_values(dataframe, 'concept:name', case_id_key='case:concept:name') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) parameters = get_properties(log, case_id_key=case_id_key) @@ -171,7 +166,6 @@ def get_trace_attribute_values(log: Union[EventLog, pd.DataFrame], attribute: st tr_attr_values = pm4py.get_trace_attribute_values(dataframe, 'case:attribute', case_id_key='case:concept:name') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) parameters = get_properties(log, case_id_key=case_id_key) @@ -233,7 +227,6 @@ def get_variants_as_tuples(log: Union[EventLog, pd.DataFrame], activity_key: str variants = pm4py.get_variants_as_tuples(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) properties = get_properties(log, activity_key=activity_key, timestamp_key=timestamp_key, case_id_key=case_id_key) @@ -275,8 +268,6 @@ def split_by_process_variant(log: Union[EventLog, pd.DataFrame], activity_key: s print(variant) print(subdf) """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception( - "the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) import pm4py @@ -336,8 +327,6 @@ def get_variants_paths_duration(log: Union[EventLog, pd.DataFrame], activity_key var_paths_durs = pm4py.get_variants_paths_duration(dataframe) print(var_paths_durs) """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception( - "the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) check_pandas_dataframe_columns(log, activity_key=activity_key, timestamp_key=timestamp_key, case_id_key=case_id_key) @@ -423,7 +412,6 @@ def get_minimum_self_distances(log: Union[EventLog, pd.DataFrame], activity_key: msd = pm4py.get_minimum_self_distances(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') ''' - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) if check_is_pandas_dataframe(log): @@ -456,7 +444,6 @@ def get_minimum_self_distance_witnesses(log: Union[EventLog, pd.DataFrame], acti msd_wit = pm4py.get_minimum_self_distance_witnesses(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) if check_is_pandas_dataframe(log): @@ -483,7 +470,6 @@ def get_case_arrival_average(log: Union[EventLog, pd.DataFrame], activity_key: s case_arr_avg = pm4py.get_case_arrival_average(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) properties = get_properties(log, activity_key=activity_key, timestamp_key=timestamp_key, case_id_key=case_id_key) @@ -516,7 +502,6 @@ def get_rework_cases_per_activity(log: Union[EventLog, pd.DataFrame], activity_k rework = pm4py.get_rework_cases_per_activity(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) properties = get_properties(log, activity_key=activity_key, timestamp_key=timestamp_key, case_id_key=case_id_key) @@ -547,7 +532,6 @@ def get_case_overlap(log: Union[EventLog, pd.DataFrame], activity_key: str = "co overlap = pm4py.get_case_overlap(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) properties = get_properties(log, activity_key=activity_key, timestamp_key=timestamp_key, case_id_key=case_id_key) @@ -588,7 +572,6 @@ def get_cycle_time(log: Union[EventLog, pd.DataFrame], activity_key: str = "conc cycle_time = pm4py.get_cycle_time(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) properties = get_properties(log, activity_key=activity_key, timestamp_key=timestamp_key, case_id_key=case_id_key) @@ -620,7 +603,6 @@ def get_all_case_durations(log: Union[EventLog, pd.DataFrame], business_hours: b case_durations = pm4py.get_all_case_durations(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) properties = get_properties(log, activity_key=activity_key, timestamp_key=timestamp_key, case_id_key=case_id_key) @@ -655,7 +637,6 @@ def get_case_duration(log: Union[EventLog, pd.DataFrame], case_id: str, business duration = pm4py.get_case_duration(dataframe, 'case 1', activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) properties = get_properties(log, activity_key=activity_key, timestamp_key=timestamp_key, case_id_key=case_id_key) @@ -693,7 +674,6 @@ def get_activity_position_summary(log: Union[EventLog, pd.DataFrame], activity: act_pos = pm4py.get_activity_position_summary(dataframe, 'Act. A', activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) if check_is_pandas_dataframe(log): diff --git a/pm4py/utils.py b/pm4py/utils.py index 4663deb97..f18ad88de 100644 --- a/pm4py/utils.py +++ b/pm4py/utils.py @@ -44,8 +44,6 @@ def format_dataframe(df: pd.DataFrame, case_id: str = constants.CASE_CONCEPT_NAM dataframe = pd.read_csv('event_log.csv') dataframe = pm4py.format_dataframe(dataframe, case_id_key='case:concept:name', activity_key='concept:name', timestamp_key='time:timestamp', start_timestamp_key='start_timestamp', timest_format='%Y-%m-%d %H:%M:%S') """ - if type(df) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") - if timest_format is None: timest_format = constants.DEFAULT_TIMESTAMP_PARSE_FORMAT @@ -334,7 +332,6 @@ def set_classifier(log, classifier, classifier_attribute=constants.DEFAULT_CLASS :param classifier_attribute: The attribute of the event that should store the concatenation of the attribute values for the given classifier :rtype: ``Union[EventLog, pd.DataFrame]`` """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) if type(classifier) is list: @@ -438,7 +435,6 @@ def project_on_event_attribute(log: Union[EventLog, pd.DataFrame], attribute_key list_list_activities = pm4py.project_on_event_attribute(dataframe, 'concept:name') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) output = [] diff --git a/pm4py/vis.py b/pm4py/vis.py index 0db8adce6..957d847a3 100644 --- a/pm4py/vis.py +++ b/pm4py/vis.py @@ -365,8 +365,6 @@ def __dotted_attribute_selection(log: Union[EventLog, pd.DataFrame], attributes) """ Default attribute selection for the dotted chart """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") - if check_is_pandas_dataframe(log): check_pandas_dataframe_columns(log) @@ -417,8 +415,6 @@ def view_dotted_chart(log: Union[EventLog, pd.DataFrame], format: str = "png", a """ format = str(format).lower() - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") - if check_is_pandas_dataframe(log): check_pandas_dataframe_columns(log) @@ -467,7 +463,6 @@ def save_vis_dotted_chart(log: Union[EventLog, pd.DataFrame], file_path: str, at pm4py.save_vis_dotted_chart(dataframe, 'dotted.png', attributes=['time:timestamp', 'concept:name', 'org:resource']) """ file_path = str(file_path) - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") if check_is_pandas_dataframe(log): check_pandas_dataframe_columns(log) @@ -563,8 +558,6 @@ def view_case_duration_graph(log: Union[EventLog, pd.DataFrame], format: str = " """ format = str(format).lower() - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") - if check_is_pandas_dataframe(log): check_pandas_dataframe_columns(log, activity_key=activity_key, case_id_key=case_id_key, timestamp_key=timestamp_key) from pm4py.statistics.traces.generic.pandas import case_statistics @@ -595,7 +588,6 @@ def save_vis_case_duration_graph(log: Union[EventLog, pd.DataFrame], file_path: pm4py.save_vis_case_duration_graph(dataframe, 'duration.png', activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ file_path = str(file_path) - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") if check_is_pandas_dataframe(log): check_pandas_dataframe_columns(log, activity_key=activity_key, case_id_key=case_id_key, timestamp_key=timestamp_key) @@ -629,8 +621,6 @@ def view_events_per_time_graph(log: Union[EventLog, pd.DataFrame], format: str = """ format = str(format).lower() - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") - if check_is_pandas_dataframe(log): check_pandas_dataframe_columns(log, activity_key=activity_key, case_id_key=case_id_key, timestamp_key=timestamp_key) from pm4py.statistics.attributes.pandas import get as attributes_get @@ -661,7 +651,6 @@ def save_vis_events_per_time_graph(log: Union[EventLog, pd.DataFrame], file_path pm4py.save_vis_events_per_time_graph(dataframe, 'ev_time.png', activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ file_path = str(file_path) - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") if check_is_pandas_dataframe(log): check_pandas_dataframe_columns(log, activity_key=activity_key, case_id_key=case_id_key, timestamp_key=timestamp_key) @@ -703,8 +692,6 @@ def view_performance_spectrum(log: Union[EventLog, pd.DataFrame], activities: Li """ format = str(format).lower() - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") - if check_is_pandas_dataframe(log): check_pandas_dataframe_columns(log, activity_key=activity_key, case_id_key=case_id_key, timestamp_key=timestamp_key) @@ -741,7 +728,6 @@ def save_vis_performance_spectrum(log: Union[EventLog, pd.DataFrame], activities pm4py.save_vis_performance_spectrum(dataframe, ['Act. A', 'Act. C', 'Act. D'], 'perf_spec.png', activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ file_path = str(file_path) - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") if check_is_pandas_dataframe(log): check_pandas_dataframe_columns(log, activity_key=activity_key, case_id_key=case_id_key, timestamp_key=timestamp_key) @@ -761,8 +747,6 @@ def __builds_events_distribution_graph(log: Union[EventLog, pd.DataFrame], param """ Internal method to build the events distribution graph """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") - if distr_type == "days_month": title = "Distribution of the Events over the Days of a Month"; x_axis = "Day of month"; @@ -822,8 +806,6 @@ def view_events_distribution_graph(log: Union[EventLog, pd.DataFrame], distr_typ """ format = str(format).lower() - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") - if check_is_pandas_dataframe(log): check_pandas_dataframe_columns(log, activity_key=activity_key, case_id_key=case_id_key, timestamp_key=timestamp_key) @@ -859,7 +841,6 @@ def save_vis_events_distribution_graph(log: Union[EventLog, pd.DataFrame], file_ pm4py.save_vis_events_distribution_graph(dataframe, 'ev_distr_graph.png', distr_type='days_week', activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') """ file_path = str(file_path) - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") if check_is_pandas_dataframe(log): check_pandas_dataframe_columns(log, activity_key=activity_key, case_id_key=case_id_key, timestamp_key=timestamp_key) diff --git a/pm4py/write.py b/pm4py/write.py index 1baed986a..d3a9c25c7 100644 --- a/pm4py/write.py +++ b/pm4py/write.py @@ -31,7 +31,6 @@ def write_xes(log: Union[EventLog, pd.DataFrame], file_path: str, case_id_key: s pm4py.write_xes(log, '', case_id_key='case:concept:name') """ - if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!") __event_log_deprecation_warning(log) if check_is_pandas_dataframe(log):