semvec/pypi-packages huggingface dataset:
unisafe 0.1.0
Read text files with unknown or mixed encodings into UTF-8.
License: MIT
Requires Python: >=3.7

# unisafe

[![Build](https://github.com/ionite34/unisafe/actions/workflows/push-main.yml/badge.svg)](https://github.com/ionite34/unisafe/actions/workflows/push-main.yml)
[![codecov](https://codecov.io/gh/ionite34/unisafe/branch/main/graph/badge.svg?token=359D2BXVEM)](https://codecov.io/gh/ionite34/unisafe)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fionite34%2Funisafe.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fionite34%2Funisafe?ref=badge_shield)

A stand-in replacement for `builtins.open` to read unknown or mixed text file encodings into UTF-8.
Optionally automatically converts UTF-8 or Windows-1252 smart quotes into UTF-8 or ASCII.


```python
from unisafe import uread

# API is same as builtins.open, use read() for all lines
with uread('file.csv') as f:
    lines = f.read()

# Use an iterator to get each text line
with uread('file.csv') as f:
    for line in f:
        print(line)
```

The `uread` function returns a [TextIOWrapper](https://docs.python.org/3/library/io.html#io.TextIOWrapper), just like Python's built-in [open](https://docs.python.org/3/library/functions.html#open)
(when using the 'r' mode). API behavior is exactly the same as the built-in method, besides the additional runtime encoding detection and conversions.
A file handle will opened in the 'rb' or read binary mode. Writing is not supported.

```python
from unisafe import uread

f1 = open('test.txt', 'r', encoding='utf-8')
type(f1)
# -> _io.TextIOWrapper

f2 = uread('test.txt')
type(f2)
# -> _io.TextIOWrapper
```

Works with the [csv](https://docs.python.org/3/library/csv.html) library and third party libraries such
as [pandas](https://github.com/pandas-dev/pandas)

```python
from unisafe import uread
import pandas as pd
import csv

with uread('file.csv') as f:
    table = csv.reader(f)
    
with uread('file.csv') as f:
    df = pd.read_csv(f, encoding='utf-8')
```

## License

The code in this project is released under the [MIT License](LICENSE).

[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fionite34%2Funisafe.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fionite34%2Funisafe?ref=badge_large)
eth-web3 6.0.1
Web3.py
License: MIT
Requires Python: >=3.7.2
Keywords: ethereum

# Web3.py

[![Documentation Status](https://readthedocs.org/projects/web3py/badge/?version=latest)](https://web3py.readthedocs.io/en/latest/?badge=latest)
[![Discord](https://img.shields.io/discord/809793915578089484?color=blue&label=chat&logo=discord&logoColor=white)](https://discord.gg/GHryRvPB84)
[![Build Status](https://circleci.com/gh/ethereum/web3.py.svg?style=shield)](https://circleci.com/gh/ethereum/web3.py)

A Python library for interacting with Ethereum, inspired by [web3.js](https://github.com/ethereum/web3.js).

* Python 3.7.2+ support

---

## Quickstart

[Get started in 5 minutes](https://web3py.readthedocs.io/en/latest/quickstart.html) or
[take a tour](https://web3py.readthedocs.io/en/latest/overview.html) of the library.

## Documentation

For additional guides, examples, and APIs, see the [documentation](https://web3py.readthedocs.io/en/latest/).

## Want to help?

Want to file a bug, contribute some code, or improve documentation? Excellent! Read up on our
guidelines for [contributing](https://web3py.readthedocs.io/en/latest/contributing.html),
then check out issues that are labeled
[Good First Issue](https://github.com/ethereum/web3.py/issues?q=is%3Aissue+is%3Aopen+label%3A%22Good+First+Issue%22).

---
#### Questions on implementation or usage? Join the conversation on [discord](https://discord.gg/GHryRvPB84).