Meiga

Latest version: v1.9.7

Safety actively analyzes 630052 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 7 of 8

1.1.2

* Added `throw`

1.1.1

1.1.0

* Added `unwrap_and`
* Refactored `handle`. Now it returns itself.

python
def on_success(value):
print(f"on_success: {value}")

def on_failure(value):
print(f"on_failure: {value}")

result = Success("Hi!")
value = result.handle(on_success, on_failure).unwrap()

1.0.0

* Functions refactor and stabilization

Properties

| Properties | Definition |
| --------------- |:--------------------------------------------------------------|
| `value` | Returns the encapsulated value whether it's success or failure |
| `is_success` | Returns true if this instance represents successful outcome. In this case is_failure returns false.|
| `is_failure` | Returns true if this instance represents failed outcome. In this case is_success returns false |

Functions

| Functions | Definition |
| --------------------------------|:-------------------------------------------------------------------------------------------- |
| `unwrap()` | Returns the encapsulated value if this instance represents success or None if it is failure. |
| `unwrap_or(failure_value)` | Returns the encapsulated value if this instance represents success or the selected `failure_value` if it is failure. |
| `unwrap_or_throw()` | Returns the encapsulated value if this instance represents success or throws the encapsulated exception if it is failure. |
| `unwrap_or_else(on_failure)` | Returns the encapsulated value if this instance represents success or execute the `on_failure` function when it is failure. |
| `handle(on_success,on_failure)` | Returns itself and execute the `on_success`function when the instance represemts success and the `on_failure` function when it is failure. |
| `map(transform)` | Returns a transformed result applying `transform` function applied to encapsulated value if this instance represents success or failure |

0.1.4

0.1.3

Page 7 of 8

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.