Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/hotfixes' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
fit-alessandro-berti committed Mar 4, 2024
2 parents f695e72 + 9ecebe4 commit e83f918
Show file tree
Hide file tree
Showing 10 changed files with 171 additions and 32 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Changelog of pm4py

## pm4py 2.7.11 (2024.02.23)
## pm4py 2.7.11 (2024.03.01)

### Added
* 0fcb1dc2939db30b7129f62bda0d235bd5242428
* improved string representation of hierarchical models

### Changed
* 56799b618ad1ab727705e24f40aa13a793552326
Expand Down Expand Up @@ -31,6 +33,8 @@
* fixed incongruency in BPMN visualizer
* b40821da2612ae1921aec30da2333dc4e1151f1a
* fixed exception handling in OpenAI requests
* e8f0b84bc7de65f090e0e96799486acaaad7572f
* fixed incongruency between filter on EventLog

### Removed

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN apt-get -y install libtool flex bison pkg-config g++ libssl-dev automake
RUN apt-get -y install libjemalloc-dev libboost-dev libboost-filesystem-dev libboost-system-dev libboost-regex-dev python3-dev autoconf flex bison cmake
RUN apt-get -y install libxml2-dev libxslt-dev libfreetype6-dev libsuitesparse-dev
RUN pip install -U wheel six pytest
RUN pip install colorama==0.4.6 contourpy==1.2.0 cycler==0.12.1 deprecation==2.1.0 fonttools==4.47.2 graphviz==0.20.1 intervaltree==3.1.0 kiwisolver==1.4.5 lxml==5.1.0 matplotlib==3.8.2 networkx==3.2.1 numpy==1.26.3 packaging==23.2 pandas==2.2.0 pillow==10.2.0 pydotplus==2.0.2 pyparsing==3.1.1 python-dateutil==2.8.2 pytz==2023.4 scipy==1.12.0 six==1.16.0 sortedcontainers==2.4.0 StringDist==1.0.9 tqdm==4.66.1 tzdata==2023.4
RUN pip install colorama==0.4.6 contourpy==1.2.0 cycler==0.12.1 deprecation==2.1.0 fonttools==4.49.0 graphviz==0.20.1 intervaltree==3.1.0 kiwisolver==1.4.5 lxml==5.1.0 matplotlib==3.8.3 networkx==3.2.1 numpy==1.26.4 packaging==23.2 pandas==2.2.1 pillow==10.2.0 pydotplus==2.0.2 pyparsing==3.1.1 python-dateutil==2.9.0.post0 pytz==2024.1 scipy==1.12.0 six==1.16.0 sortedcontainers==2.4.0 StringDist==1.0.9 tqdm==4.66.2 tzdata==2024.1

COPY . /app
RUN cd /app && python setup.py install
22 changes: 20 additions & 2 deletions pm4py/algo/filtering/log/between/between_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
along with PM4Py. If not, see <https://www.gnu.org/licenses/>.
'''
from enum import Enum
from copy import copy
from typing import Optional, Dict, Any, Union

from pm4py.objects.log.obj import EventLog, Trace
Expand All @@ -24,6 +25,17 @@

class Parameters(Enum):
ACTIVITY_KEY = constants.PARAMETER_CONSTANT_ACTIVITY_KEY
CASE_ID_KEY = constants.PARAMETER_CONSTANT_CASEID_KEY
SUBCASE_CONCAT_STR = "subcase_concat_str"


def __fix_trace_attributes(trace_attributes, idx, rel_count, case_id_key, subcase_concat_str):
trace_attributes = copy(trace_attributes)
if case_id_key in trace_attributes:
trace_attributes[case_id_key] = trace_attributes[case_id_key] + subcase_concat_str + str(rel_count)
else:
trace_attributes[case_id_key] = str(idx) + subcase_concat_str + str(rel_count)
return trace_attributes


def apply(log: EventLog, act1: str, act2: str, parameters: Optional[Dict[Union[str, Parameters], Any]] = None) -> EventLog:
Expand Down Expand Up @@ -54,25 +66,31 @@ def apply(log: EventLog, act1: str, act2: str, parameters: Optional[Dict[Union[s
log = log_converter.apply(log, variant=log_converter.Variants.TO_EVENT_LOG, parameters=parameters)

activity_key = exec_utils.get_param_value(Parameters.ACTIVITY_KEY, parameters, xes_constants.DEFAULT_NAME_KEY)
case_id_key = exec_utils.get_param_value(Parameters.CASE_ID_KEY, parameters, xes_constants.DEFAULT_TRACEID_KEY)
subcase_concat_str = exec_utils.get_param_value(Parameters.SUBCASE_CONCAT_STR, parameters, "##@@")

filtered_log = EventLog(attributes=log.attributes, extensions=log.extensions, omni_present=log.omni_present,
classifiers=log.classifiers, properties=log.properties)

for trace in log:
for idx, trace in enumerate(log):
act1_encountered = False
filt_trace = None

rel_count = 0
i = 0
while i < len(trace):
if not act1_encountered and trace[i][activity_key] == act1:
act1_encountered = True
filt_trace = Trace(attributes=trace.attributes)
filt_trace = Trace(attributes=__fix_trace_attributes(trace.attributes, idx, rel_count, case_id_key,
subcase_concat_str))
filt_trace.append(trace[i])
elif act1_encountered and trace[i][activity_key] == act2:
filt_trace.append(trace[i])
filtered_log.append(filt_trace)
rel_count += 1
act1_encountered = False
filt_trace = None

elif filt_trace is not None:
filt_trace.append(trace[i])

Expand Down
2 changes: 1 addition & 1 deletion pm4py/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
'''

__name__ = 'pm4py'
VERSION = '2.7.10.2'
VERSION = '2.7.10.3'
__version__ = VERSION
__doc__ = 'Process mining for Python'
__author__ = 'Fraunhofer Institute for Applied Information Technology FIT'
Expand Down
16 changes: 11 additions & 5 deletions pm4py/objects/powl/obj.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
from pm4py.objects.powl.BinaryRelation import BinaryRelation
from pm4py.objects.powl.constants import STRICT_PARTIAL_ORDER_LABEL
from pm4py.objects.process_tree.obj import ProcessTree, Operator
from pm4py.util import hie_utils
import sys
from typing import List as TList, Optional, Union
from abc import ABC, abstractmethod


class POWL(ProcessTree, ABC):
def __str__(self) -> str:
return self.__repr__()

class POWL(ProcessTree, ABC):
def print(self) -> None:
print(self.__repr__())
print(self.to_string())

def simplify_using_frequent_transitions(self) -> "POWL":
return self
Expand Down Expand Up @@ -156,8 +156,14 @@ def _set_children(self, children: TList[POWL]) -> None:
def get_children(self) -> TList[POWL]:
return self.order.nodes

def to_string(self, level=0, indent=False, max_indent=sys.maxsize) -> str:
model_string = STRICT_PARTIAL_ORDER_LABEL + self.order.__repr__()
if indent:
model_string = "\n".join(hie_utils.indent_representation(model_string, max_indent=max_indent))
return model_string

def __repr__(self) -> str:
return STRICT_PARTIAL_ORDER_LABEL + self.order.__repr__()
return self.to_string()

def __lt__(self, other: object) -> bool:
if isinstance(other, StrictPartialOrder):
Expand Down
41 changes: 29 additions & 12 deletions pm4py/objects/process_tree/obj.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
along with PM4Py. If not, see <https://www.gnu.org/licenses/>.
'''
from enum import Enum
from pm4py.util import hie_utils
import sys


class Operator(Enum):
Expand Down Expand Up @@ -153,33 +155,48 @@ def __eq__(self, other):
return False
return False

def __repr__(self):
def to_string(self, level=0, indent=False, max_indent=sys.maxsize):
"""
Returns a string representation of the process tree
Represents a process tree model as a string.
Returns
------------
stri
String representation of the process tree
Parameters
-----------------
indent
Enable the indentation of the resulting string
max_indent
Maximum level of indentation
"""
if self.operator is not None:
rep = str(self._operator) + '( '
for i in range(0, len(self._children)):
child = self._children[i]
if len(child.children) == 0:
if child.label is not None:
rep += '\'' + str(child) + '\'' + ', ' if i < len(self._children) - 1 else '\'' + str(
child) + '\''
rep += '\'' + child.to_string(level=level+1) + '\'' + ', ' if i < len(self._children) - 1 else '\'' + child.to_string(level=level+1) + '\''
else:
rep += str(child) + ', ' if i < len(self._children) - 1 else str(child)
rep += child.to_string(level=level+1) + ', ' if i < len(self._children) - 1 else child.to_string(level=level+1)
else:
rep += str(child) + ', ' if i < len(self._children) - 1 else str(child)
return rep + ' )'
rep += child.to_string(level=level+1) + ', ' if i < len(self._children) - 1 else child.to_string(level=level+1)
stru = rep + ' )'
if level == 0 and indent:
stru = "\n".join(hie_utils.indent_representation(stru, max_indent=max_indent))
return stru
elif self.label is not None:
return self.label
else:
return 'tau'

def __repr__(self):
"""
Returns a string representation of the process tree
Returns
------------
stri
String representation of the process tree
"""
return self.to_string()

def __str__(self):
"""
Returns a string representation of the process tree
Expand All @@ -189,7 +206,7 @@ def __str__(self):
stri
String representation of the process tree
"""
return self.__repr__()
return self.to_string()

@staticmethod
def model_description() -> str:
Expand Down
4 changes: 2 additions & 2 deletions requirements_stable.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ matplotlib==3.8.3
networkx==3.2.1
numpy==1.26.4
packaging==23.2
pandas==2.2.0
pandas==2.2.1
pillow==10.2.0
pydotplus==2.0.2
pyparsing==3.1.1
python-dateutil==2.8.2
python-dateutil==2.9.0.post0
pytz==2024.1
scipy==1.12.0
six==1.16.0
Expand Down
47 changes: 47 additions & 0 deletions safety_checks/20240301
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
+==============================================================================+

/$$$$$$ /$$
/$$__ $$ | $$
/$$$$$$$ /$$$$$$ | $$ \__//$$$$$$ /$$$$$$ /$$ /$$
/$$_____/ |____ $$| $$$$ /$$__ $$|_ $$_/ | $$ | $$
| $$$$$$ /$$$$$$$| $$_/ | $$$$$$$$ | $$ | $$ | $$
\____ $$ /$$__ $$| $$ | $$_____/ | $$ /$$| $$ | $$
/$$$$$$$/| $$$$$$$| $$ | $$$$$$$ | $$$$/| $$$$$$$
|_______/ \_______/|__/ \_______/ \___/ \____ $$
/$$ | $$
| $$$$$$/
by pyup.io \______/

+==============================================================================+

REPORT

Safety is using PyUp's free open-source vulnerability database. This
data is 30 days old and limited.
For real-time enhanced vulnerability data, fix recommendations, severity
reporting, cybersecurity support, team and project policy management and more
sign up at https://pyup.io or email sales@pyup.io

Safety v2.3.5 is scanning for Vulnerabilities...
Scanning dependencies in your files:

-> requirements_stable.txt

Using non-commercial database
Found and scanned 25 packages
Timestamp 2024-03-01 07:48:36
0 vulnerabilities found
0 vulnerabilities ignored
+==============================================================================+

No known security vulnerabilities found.

+==============================================================================+

Safety is using PyUp's free open-source vulnerability database. This
data is 30 days old and limited.
For real-time enhanced vulnerability data, fix recommendations, severity
reporting, cybersecurity support, team and project policy management and more
sign up at https://pyup.io or email sales@pyup.io

+==============================================================================+
47 changes: 47 additions & 0 deletions safety_checks/20240304
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
+==============================================================================+

/$$$$$$ /$$
/$$__ $$ | $$
/$$$$$$$ /$$$$$$ | $$ \__//$$$$$$ /$$$$$$ /$$ /$$
/$$_____/ |____ $$| $$$$ /$$__ $$|_ $$_/ | $$ | $$
| $$$$$$ /$$$$$$$| $$_/ | $$$$$$$$ | $$ | $$ | $$
\____ $$ /$$__ $$| $$ | $$_____/ | $$ /$$| $$ | $$
/$$$$$$$/| $$$$$$$| $$ | $$$$$$$ | $$$$/| $$$$$$$
|_______/ \_______/|__/ \_______/ \___/ \____ $$
/$$ | $$
| $$$$$$/
by pyup.io \______/

+==============================================================================+

REPORT

Safety is using PyUp's free open-source vulnerability database. This
data is 30 days old and limited.
For real-time enhanced vulnerability data, fix recommendations, severity
reporting, cybersecurity support, team and project policy management and more
sign up at https://pyup.io or email sales@pyup.io

Safety v2.3.5 is scanning for Vulnerabilities...
Scanning dependencies in your files:

-> requirements_stable.txt

Using non-commercial database
Found and scanned 25 packages
Timestamp 2024-03-04 11:38:54
0 vulnerabilities found
0 vulnerabilities ignored
+==============================================================================+

No known security vulnerabilities found.

+==============================================================================+

Safety is using PyUp's free open-source vulnerability database. This
data is 30 days old and limited.
For real-time enhanced vulnerability data, fix recommendations, severity
reporting, cybersecurity support, team and project policy management and more
sign up at https://pyup.io or email sales@pyup.io

+==============================================================================+
16 changes: 8 additions & 8 deletions third_party/LICENSES_TRANSITIVE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@ libraries are added/removed.
| contourpy | https://pypi.org/project/contourpy | BSD License | 1.2.0 |
| cycler | https://pypi.org/project/cycler | BSD License | 0.12.1 |
| deprecation | https://pypi.org/project/deprecation | Apache Software License (Apache 2) | 2.1.0 |
| fonttools | https://pypi.org/project/fonttools | MIT License (MIT) | 4.47.2 |
| fonttools | https://pypi.org/project/fonttools | MIT License (MIT) | 4.49.0 |
| graphviz | https://pypi.org/project/graphviz | MIT License (MIT) | 0.20.1 |
| intervaltree | https://pypi.org/project/intervaltree | Apache Software License (Apache License, Version 2.0) | 3.1.0 |
| kiwisolver | https://pypi.org/project/kiwisolver | BSD License | 1.4.5 |
| lxml | https://pypi.org/project/lxml | BSD License (BSD-3-Clause) | 5.1.0 |
| matplotlib | https://pypi.org/project/matplotlib | Python Software Foundation License (PSF) | 3.8.2 |
| matplotlib | https://pypi.org/project/matplotlib | Python Software Foundation License (PSF) | 3.8.3 |
| networkx | https://pypi.org/project/networkx | BSD License | 3.2.1 |
| numpy | https://pypi.org/project/numpy | BSD License | 1.26.3 |
| numpy | https://pypi.org/project/numpy | BSD License | 1.26.4 |
| packaging | https://pypi.org/project/packaging | Apache Software License, BSD License | 23.2 |
| pandas | https://pypi.org/project/pandas | BSD License | 2.2.0 |
| pandas | https://pypi.org/project/pandas | BSD License | 2.2.1 |
| pillow | https://pypi.org/project/pillow | Historical Permission Notice and Disclaimer (HPND) (HPND) | 10.2.0 |
| pydotplus | https://pypi.org/project/pydotplus | MIT License (UNKNOWN) | 2.0.2 |
| pyparsing | https://pypi.org/project/pyparsing | MIT License | 3.1.1 |
| python-dateutil | https://pypi.org/project/python-dateutil | Apache Software License, BSD License (Dual License) | 2.8.2 |
| pytz | https://pypi.org/project/pytz | MIT License (MIT) | 2023.4 |
| python-dateutil | https://pypi.org/project/python-dateutil | Apache Software License, BSD License (Dual License) | 2.9.0.post0 |
| pytz | https://pypi.org/project/pytz | MIT License (MIT) | 2024.1 |
| scipy | https://pypi.org/project/scipy | BSD License | 1.12.0 |
| six | https://pypi.org/project/six | MIT License (MIT) | 1.16.0 |
| sortedcontainers | https://pypi.org/project/sortedcontainers | Apache Software License (Apache 2.0) | 2.4.0 |
| StringDist | https://pypi.org/project/StringDist | MIT License (MIT) | 1.0.9 |
| tqdm | https://pypi.org/project/tqdm | MIT License, Mozilla Public License 2.0 (MPL 2.0) (MPL-2.0 AND MIT) | 4.66.1 |
| tzdata | https://pypi.org/project/tzdata | Apache Software License (Apache-2.0) | 2023.4 |
| tqdm | https://pypi.org/project/tqdm | MIT License, Mozilla Public License 2.0 (MPL 2.0) (MPL-2.0 AND MIT) | 4.66.2 |
| tzdata | https://pypi.org/project/tzdata | Apache Software License (Apache-2.0) | 2024.1 |

0 comments on commit e83f918

Please sign in to comment.