semvec/pypi-packages huggingface dataset:
isNullOrEmpty 1.0.0
A simple Python package to check if an object is null or empty.
License: MIT

# is_null_or_empty Package

The `is_null_or_empty` package is a lightweight, versatile Python library designed to simplify and streamline the process of checking whether Python objects are `None` or empty. It supports a wide range of data types, including strings, lists, dictionaries, and more, making nullity and emptiness checks more efficient and readable.

## Key Features

- **Multi-Type Support**: Works seamlessly with strings, lists, dictionaries, and more.
- **Simplicity**: Provides a straightforward API that is easy to use in any project.
- **Efficiency**: Improves code readability by replacing multiple condition checks with a single, intuitive function call.

## Installation

Install `is_null_or_empty` quickly and easily using pip:

```bash
pip install is_null_or_empty
```

## Usage
The is_null_or_empty function can be used to check if an object is None or if it's an empty container (like a string, list, or dictionary). Here are some examples demonstrating its usage:

```bash
from is_null_or_empty import is_null_or_empty

print(is_null_or_empty(""))  # True
print(is_null_or_empty([]))  # True
print(is_null_or_empty({}))  # True
print(is_null_or_empty(None))  # True
print(is_null_or_empty("Some text"))  # False
print(is_null_or_empty([1, 2, 3]))  # False
```

As you can see, `is_null_or_empty` will return True for empty strings, lists, dictionaries, or None objects, and False otherwise, helping you make your code cleaner and more concise.

License
`is_null_or_empty` is licensed under the MIT License. Feel free to use it, modify it, and distribute it as you see fit.
numpy-fn 1.0.0
A decorator for seamless numpy calculations from torch.tensor and pd.DataFrame.
License: MIT
Requires Python: >=3.6
Keywords: numpytorch, pandas

![CI](https://github.com/ywatanabe1989/torch_fn/actions/workflows/pip_install.yml/badge.svg)
![CI](https://github.com/ywatanabe1989/torch_fn/actions/workflows/run_example.yml/badge.svg)

## Installation
``` bash
$ pip install numpy_fn
```

## Usage

``` python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Time-stamp: "2024-04-07 21:56:35 (ywatanabe)"

from numpy_fn import numpy_fn

import numpy as np
import pandas as pd
import scipy
import torch


@numpy_fn
def numpy_softmax(*args, **kwargs):
    return scipy.special.softmax(*args, **kwargs)


def custom_print(x):
    print(type(x), x)


# Test the decorator with different input types
x = [1, 2, 3]
x_list = x
x_array = np.array(x)
x_df = pd.DataFrame({"col1": x})
x_tensor = torch.tensor(x).float()
if torch.cuda.is_available():
    x_tensor_cuda = torch.tensor(x).float().cuda()

custom_print(numpy_softmax(x_list, axis=-1))
# <class 'numpy.ndarray'> [0.09003057 0.24472847 0.66524096]

custom_print(numpy_softmax(x_array, axis=-1))
# <class 'numpy.ndarray'> [0.09003057 0.24472847 0.66524096]

custom_print(numpy_softmax(x_df, axis=-1))
# <class 'numpy.ndarray'> [0.09003057 0.24472847 0.66524096]

custom_print(numpy_softmax(x_tensor, axis=-1))
# /home/ywatanabe/proj/numpy_fn/src/numpy_fn/_numpy_fn.py:57: UserWarning: Converted from  <class 'numpy.ndarray'> to <class 'torch.Tensor'> (cpu)
#   warnings.warn(
# <class 'torch.Tensor'> tensor([0.0900, 0.2447, 0.6652])

if torch.cuda.is_available():
    custom_print(numpy_softmax(x_tensor_cuda, axis=-1))
# /home/ywatanabe/proj/numpy_fn/src/numpy_fn/_numpy_fn.py:57: UserWarning: Converted from  <class 'numpy.ndarray'> to <class 'torch.Tensor'> (cuda:0)
#   warnings.warn(
# <class 'torch.Tensor'> tensor([0.0900, 0.2447, 0.6652], device='cuda:0')
```