Impure
Bases: PurityResult
Class for impure results.
A function is impure if it has at least one (File-, NonLocalVariable-)Read OR (File-, NonLocalVariable-)Write side effect. An impure function must also have no unknown reasons.
Be aware that a function can be impure because of multiple reasons. Also, Impure != Pure since: not Pure would mean a function is either unknown or has at least one (File-, NonLocalVariable-)Read OR (File-, NonLocalVariable-)Write side effect.
Attributes:
| Name | Type | Description |
|---|---|---|
reasons |
set[ImpurityReason]
|
The reasons why the function is impure. |
is_class |
bool
|
Whether the result is for a class or not. |
Source code in src/library_analyzer/processing/api/purity_analysis/model/_purity.py
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | |
is_class: bool = False
class-attribute
instance-attribute
¶
reasons: set[ImpurityReason]
instance-attribute
¶
__hash__()
¶
__init__(reasons, is_class=False)
¶
__str__()
¶
clone()
¶
to_dict(shorten=False)
¶
Source code in src/library_analyzer/processing/api/purity_analysis/model/_purity.py
update(other)
¶
Update the current result with another result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other |
PurityResult | None
|
The result to update with. |
required |
Returns:
| Type | Description |
|---|---|
PurityResult
|
The updated result. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If the result cannot be updated with the given result. |