Safe-DS / Library-Analyzer

Analysis of Python libraries and of code that uses them.
https://library-analyzer.safeds.com
MIT License
5 stars 0 forks source link

Propagation error #299

Open lukarade opened 2 months ago

lukarade commented 2 months ago

Describe the bug

In some cases, the reasons of impurity are not propagated at all. This is undesirable because it will lead to impure functions wrongly being classified as pure. Here are some examples of these cases:

# seaborn_v0.12.2._core.properties.get_mapping.764.4
def get_mapping(self, scale: Scale, data: Series) -> Mapping:
    """Return a function that maps each data value to True or False."""
    boolean_scale = isinstance(scale, Boolean)
    order = getattr(scale, "order", [True, False] if boolean_scale else None) # Impure Builtin not propagated
    levels = categorical_order(data, order)
    values = self._get_values(scale, levels) # Impure Call not propagated
# seaborn_v0.12.2._core.properties._get_nominal_mapping.223.4
def _get_nominal_mapping(self, scale: Nominal, data: Series) -> Mapping:
     """Identify evenly-spaced values using interval or explicit mapping."""
    levels = categorical_order(data, scale.order)
    values = self._get_values(scale, levels) # Impure Call not propagated

Others:

# seaborn_v0.12.2.widgets.choose_colorbrewer_palette.47.0
# pandas_v2.0.3.core._numba.executor.generate_shared_aggregator.16.0
# pandas_v2.0.3.core.window.numba_.generate_manual_numpy_nan_agg_with_axis.243.0

To Reproduce

  1. Run purity analysis on the libraries
  2. Check the result file

Expected behavior

The reasons of impurity must be propagated correctly.

Screenshots (optional)

No response

Additional Context (optional)

There is no pattern detectable in which the reasons are not propagated correctly.