Metadata-Version: 2.1
Name: typeconvert
Version: 0.2.0
Summary: Convert various unusual data types into integers and floats
License: # MIT License
        
        Copyright (c) 2022 Jonathan Olsten
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: repository, https://github.com/jolsten/type-convert
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Python: <3.12,>=3.8
Description-Content-Type: text/markdown
License-File: LICENSE.md
Requires-Dist: numpy <1.26,>=1.17
Requires-Dist: numba
Provides-Extra: dev
Requires-Dist: build ; extra == 'dev'
Requires-Dist: setuptools >=45 ; extra == 'dev'
Requires-Dist: setuptools-scm[toml] >=6.2 ; extra == 'dev'
Requires-Dist: wheel ; extra == 'dev'
Requires-Dist: pytest ; extra == 'dev'
Requires-Dist: pytest-cov ; extra == 'dev'

# type-converter
Convert various unsigned integers to non-native Python or Numpy types.

# function types

For each conversion, there are two kinds of functions to import:
 - typeconvert.func:  scalar functions
 - typeconvert.ufunc: numpy universal functions (ufunc)

Choose what kind of function to import:
```python
from typeconvert.func import <function_name_here>
from typeconvert.ufunc import <function_name_here>
```

## scalar functions

The scalar functions take unsigned Python `int` as inputs and return either an `int` or Pytho `float` as appropriate.

## numpy universal functions

The numpy universal functions take the minimum-sized np.uint<> for the given type, and return the minimum-sized np.uint<> or np.float<> for the dynamic range of the output.



# examples

## Two's-Complement

```python
In [1]: from typeconvert.func import twoscomp
In [2]: twoscomp(0x00, 8), twoscomp(0xFF, 8), twoscomp(0x7F, 8), twoscomp(0x80, 8)

Out[2]: (0, -1, 127, -128)
```

## MIL-STD-1750A32

```python
In [3]: from typeconvert.func import milstd1750a32
In [4]: milstd1750a32(0x40000000), milstd1750a32(0x80000000), milstd1750a32(0x9FFFFF04)

Out[4]: (0.5, -1.0, -12.000002)
```
