semvec/pypi-packages huggingface dataset:
dumb-maybe 0.0.4
A Very Dumb Maybe Type
Requires Python: >=3.8

# A Very Dumb Maybe Type

## What Makes It Dumb?

I does, stupid.

## How Do I Use It?

Please don't.

## OK, But Like, Suppose I Wanted to

Maybe lets you continue to chain calls when they might
fail or return None, without long if-else chains:

```python
>>> from maybe import maybe, get, attr
>>> class Order:
...     def __init__(self, customer):
...         self.customer = customer
... 
>>> order_no_contacts = Order({"fullname": "John Doe"})
>>> order_empty_contacts = Order({"contacts": []})
>>> correct_order = Order({"contacts": [{"type": "email", "address": "user@example.com"}]})
>>> 
>>> def get_contact_address(order):
...     return (
...             maybe(order)
...             .then(attr("customer"))
...             .then(get("contacts"))
...             .then(get(0))
...             .then(get("address"))
...             .value()
...         )
... 
>>> print(get_contact_address(None))
None
>>> print(get_contact_address(order_no_contacts))
None
>>> print(get_contact_address(order_empty_contacts))
None
>>> print(get_contact_address(correct_order))
user@example.com
>>> 
```

It also allows you to act on exceptions:

```python
>>> def get_contact_address(order):
...     return (
...         maybe(order)
...         .then(attr("customer"))
...         # If the order doesn't have .customer, try treating
...         # the order as a customer
...         .catch(AttributeError, lambda e: order)
...         .then(get("contacts"))
...         .then(get(0))
...         .then(get("address"))
...         .value()
...     )
... 
>>> print(get_contact_address({"contacts": [{"type": "email", "address": "second-user@example.com"}]}))
second-user@example.com
>>> print(get_contact_address(correct_order))
user@example.com
>>> 
```

Or on null values:

```python
>>> def get_contact_address(order):
...     return (
...         maybe(order)
...         .then(attr("customer"))
...         .catch(AttributeError, lambda e: order)
...         .then(get("contacts"))
...         .then(get(0))
...         .then(get("address"))
...         .or_else(lambda: "default-address@example.com")
...         .value()
...     )
... 
>>> order_none_contact = Order({"contacts": [{"type": "email", "address": None}]})
>>> print(get_contact_address(None))
default-address@example.com
>>> print(get_contact_address(order_none_contact))
default-address@example.com
>>> print(get_contact_address(correct_order))
user@example.com
```
calculator2004 0.1.0
A simple calculator package
Requires Python: >=3.6

# Calculator Prueba

This project contains a simple arithmetic module that performs basic mathematical operations.

## Arithmetic Module

The `arithmetic` module provides a class `Arithmetic` that can perform the following operations:

- Addition
- Subtraction
- Multiplication
- Division

### Usage

To use the `Arithmetic` class, you need to create an instance of the class with two numbers and then call the desired method.

```python
from calculator_prueba.arithmetic import Arithmetic

# Create an instance of Arithmetic
calc = Arithmetic(10, 5)

# Perform operations
print(calc.add())       # Output: 15
print(calc.subtract())  # Output: 5
print(calc.multiply())  # Output: 50
print(calc.divide())    # Output: 2.0
```

### Division by Zero

The `divide` method raises a `ValueError` if an attempt is made to divide by zero.

```python
calc = Arithmetic(10, 0)
calc.divide()  # Raises ValueError: Cannot divide by zero
```