Skip to content
This repository was archived by the owner on Nov 23, 2024. It is now read-only.
This repository was archived by the owner on Nov 23, 2024. It is now read-only.

Missing NonLocalVariableRead and NonLocalVariableWrite in @property functions #300

@lukarade

Description

@lukarade

Describe the bug

In (some) @property functions, the access to other properties of the class are not detected as reasons for impurity.

Examples:

# seaborn_v0.12.2.external.version.is_devrelease.334.4
@property
def is_devrelease(self) -> bool:
    return self.dev is not None # Impure Read from property dev is not detected
# pandas_v2.0.3.core.arrays.sparse.array.nbytes.667.4
@property
def nbytes(self) -> int:
    return self.sp_values.nbytes + self.sp_index.nbytes # Impure Read from property sp_values and sp_index is not detected

To Reproduce

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

Expected behavior

Access of propertys are impure and therefore must be detected as impure.
Therefore a special case needs to be implemented to deal with that.

Screenshots (optional)

No response

Additional Context (optional)

Since the tests were only done for a sample of functions, there could be more functions with the same problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🪲Something isn't workingpurityInferring the purity of functions

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions