Evaluate a marker. Return the boolean from evaluating the given marker against the environment. environment is an optional argument to override all or part of the determined environment. The environment is determined from the current Python process.
(self, environment: Optional[Dict[str, str]] = None)
| 231 | return str(self) == str(other) |
| 232 | |
| 233 | def evaluate(self, environment: Optional[Dict[str, str]] = None) -> bool: |
| 234 | """Evaluate a marker. |
| 235 | |
| 236 | Return the boolean from evaluating the given marker against the |
| 237 | environment. environment is an optional argument to override all or |
| 238 | part of the determined environment. |
| 239 | |
| 240 | The environment is determined from the current Python process. |
| 241 | """ |
| 242 | current_environment = default_environment() |
| 243 | current_environment["extra"] = "" |
| 244 | if environment is not None: |
| 245 | current_environment.update(environment) |
| 246 | # The API used to allow setting extra to None. We need to handle this |
| 247 | # case for backwards compatibility. |
| 248 | if current_environment["extra"] is None: |
| 249 | current_environment["extra"] = "" |
| 250 | |
| 251 | return _evaluate_markers(self._markers, current_environment) |