semvec/pypi-packages huggingface dataset:
fastencode 1.4
An easy way to use different encoding: bytes, hex, ascii array, binary, long, base64
License: MIT
Keywords: encoding,hex,bytes,binary representation,decoding,ascii,base64

# Fast Encode - Encoding Made Easy

With Fast Encode you can create **a single object** that automatically uses many encoding types.

## Overview

The Fast Encode module provides the following features:

- A single object that abstracts the following encodings: hex, ascii array, string, bytes, binary and long number.
- Many helper functions that makes changing encoding easier.

## Getting Started

- [ ] First, you need to download it from pip. `pip install fastencode`

- [ ] Then import it to your project.

```python
from fastencode import DataObj as D
```

## Creating and Using an Object

For each encoding type, there is factory function that creates a DataObj object from it.
The factory functions are: `fromHex`, `fromAsc`, `fromStr`, `fromBin`, `fromNum` and `fromBytes`.

```python
plaintext = D.fromStr('secret_msg') # This creates a Data object from a plain string
key = D.fromHex('deadbeef1234')# This creates a Data object from hex
```

Printing the DataObj will show a lot of different encoding at once:

```python
print(f'Output - {plaintext}')

Output - Hex: 7365637265745f6d7367, Ascii: [115, 101, 99, 114, 101, 116, 95, 109, 115, 103],
  String: secret_msg, Number: 544942432582961455788903
  Binary: 01110011011001010110001101110010011001010111010001011111011011010111001101100111
```

We can get to a specific encoding by using the DataObj fields: `hex`, `asc`, `str`, `bytes`, `bin` and `num`.

```python
print(key.bytes)
# prints b'\xde\xad\xbe\xef\x124'

print(key.asc) # asc is shorthand for ascii, and is a list of integer of the indvidual ascii value of every byte.
# prints [222, 173, 190, 239, 18, 52]
```

## Simple XOR exmaple

Let's take a look at a simple example of XOR-ing 2 strings. We will see how simple it is to do with fastencode.

```python
from fastencode import DataObj as D

plaintext = D.fromStr('secret_msg')
key = D.fromStr('secret_key')

xored_integer_value = plaintext.num ^ key.num # ^ is the python operand for xor
print(xored_integer_value) # prints 398878

ciphertext = D.fromNum(xored_integer_value) # Creating another Data object from the result of the xor
print(ciphertext) # prints Hex: 6161e, ascii: [97, 97, 14], String: aa, Number: 398878 Binary: 011000010110000100001110
```

_Note: In the example the result is only 3-bytes long - as expected - because the first 7 bytes match and are therefore removed._

## Forking and Contribution Ideas

- Creating a genreal function that automatically detects the type of the encoding.
- Adding base64 and base32 encodings.
whereval 0.1.8
Tool for parsing SQL like where expressions and evaluating against live data 
License: MIT
Requires Python: >=3.7.9,<4.0.0

## WherEval

Tool for parsing SQL like where expressions and evaluating against live data 

### Installation

```
python3 -m pip install whereval
```

### Inspiration
This tool will scratch an itch I've had for some cli tools where I want to pass complex filter expressions to control output / processing.
For instance with my `histstat` fork, I would like to have better filtering of networking information to be output to sqlite. See: https://github.com/JavaScriptDude/histstat

Another usecase for this is a tool I've wanted to write where I can write a `tail -f` wrapper in python where I can define a filter in cli parameters to limit output to the console. Have not written this yet but its on my todo now that I've got this API.

### API Example

#### (Ex1) Basic Concept:
```python3
from datetime import date
from whereval import Where, util as wutil

print("\n(Ex1) Basic Idea")

sw = wutil.StopWatch()

# Where query (terse example)
qry = "(f0>=2+f1=1+f2='s')|(f3~'foo%')"

# Field and type spec
spec = {'f0': int,'f1': bool,'f2': str,'f3': str, 'f4': dt_date}

# Instantiate Where
#  - Parses query and uses data to form rules for data types and fields
wher = Where(query=qry, spec=spec)


print(f"Query:\n . raw:\t{qry}\n . compiled: {wher}\n\nTests:")

def _print(wher, data, tup): 
	(ok, result, issues) = tup
	if not ok:
		print(f"Eval failed for {wher}. Issues: {issues}")
	else:
		print(f"\t{result}\tw/ data: {data}")

# Evaluate expression against real data
data = {'f0': 2, 'f1': True ,'f2': 's', 'f3': 'foobar'}
_print(wher, data, wher.evaluate(data))

# For different data
data['f3'] = 'bazbar'
_print(wher, data, wher.evaluate(data))

# For different data
data['f0'] = 1
_print(wher, data, wher.evaluate(data))

print(f"Completed. Elapsed: {sw.elapsed(3)}s")
```

#### Output of print:
```
(Ex1) Basic Idea
Query:
 . raw:	(f0>=2+f1=1+f2='s')|(f3~'foo%')
 . compiled: ( ( f0 >= 2 AND f1 = 1 AND f2 = 's' ) OR ( f3 like 'foo%' ) )

Tests:
	True	w/ data: {'f0': 2, 'f1': True, 'f2': 's', 'f3': 'foobar'}
	True	w/ data: {'f0': 2, 'f1': True, 'f2': 's', 'f3': 'bazbar'}
	False	w/ data: {'f0': 1, 'f1': True, 'f2': 's', 'f3': 'bazbar'}
Completed. Elapsed: 0.003s
```


### Query Syntax:

```
# General:
#  Query must begin with '(' and end with ')'
#  NOT, IN, BETWEEN must be followed by parenthesis '('
# Boolean Operators:
#   AND, OR, NOT
# Equality Operators:
#  =, !=, <, <=, >, >=, like
# Special:
#   !   -->  NOT
#   +   -->  AND
#   |   -->  OR
#   <>  -->  !=
#   ~   -->  like
```
TelePol 0.0.2
Library for working with Telegram Bot API
License: MIT
Requires Python: >=3.7

# TelePol


**TelePol** is a pretty simple and fully asynchronous framework for [Telegram Bot API](https://core.telegram.org/bots/api) written in Python 3.7 with [asyncio](https://docs.python.org/3/library/asyncio.html) and [aiohttp](https://github.com/aio-libs/aiohttp). It helps you to make your bots faster and simpler.


## Examples
<details>
  <summary>ℹ️ Click to see some basic examples</summary>


**Few steps before getting started...**
- First, you should obtain token for your bot from [BotFather](https://t.me/BotFather).
- Install the latest stable version of telepol, simply running `pip install telepol`

### Simple [`getMe`](https://core.telegram.org/bots/api#getme) request

```python
import asyncio
from telepol import Bot

BOT_TOKEN = ""

async def main():
    bot = Bot(token=BOT_TOKEN)

    try:
        me = await bot.get_me()
        print(f"🤖 Hello, I'm {me.first_name}.\nHave a nice Day!")
    finally:
        await bot.close()

asyncio.run(main())
```

### Poll BotAPI for updates and process updates

```python
import asyncio
from telepol import Bot, Dispatcher, types

BOT_TOKEN = ""

async def start_handler(event: types.Message):
    await event.answer(
        f"Hello, {event.from_user.get_mention(as_html=True)} 👋!",
        parse_mode=types.ParseMode.HTML,
    )

async def main():
    bot = Bot(token=BOT_TOKEN)
    try:
        disp = Dispatcher(bot=bot)
        disp.register_message_handler(start_handler, commands={"start", "restart"})
        await disp.start_polling()
    finally:
        await bot.close()

asyncio.run(main())
```

```
"""
This is a echo bot.
It echoes any incoming text messages.
"""

import logging

from telepol import Bot, Dispatcher, executor, type

API_TOKEN = 'BOT TOKEN HERE'

# Configure logging
logging.basicConfig(level=logging.INFO)

# Initialize bot and dispatcher
bot = Bot(token=API_TOKEN)
dp = Dispatcher(bot)


@dp.handler(commands=['start', 'help'])
async def send_welcome(message: types.Message):
    """
    This handler will be called when user sends `/start` or `/help` command
    """
    await message.reply("Hi!\nI'm EchoBot!\nPowered by aiogram.")

@dp.handler()
async def echo(message: types.Message):
    # old style:
    # await bot.send_message(message.chat.id, message.text)

    await message.answer(message.text)


if __name__ == '__main__':
    executor.start_polling(dp, skip_updates=True)

```

</details>


## Official telepol resources:
 - News: [@telepol_live](https://t.me/telepol_live)
 - Communities:
 - 🇷🇺 [@telepol_ru](https://t.me/telepol_ru)
 - ⬇️ PyPI: [TelePol](https://pypi.python.org/pypi/telepol)
 - 🔓 Source: [Github repo](https://github.com/masah1st/telepol)
 - 🤖 Test bot: [@example_TelePol_bot](https://t.me/example_TelePol_bot)
radiozilla 1.0.0
Python Radio Browser API wrapper with fully Type Hinting and Documentation
License: MIT
Requires Python: >=3.10,<4.0

# radiozilla
📻 Python Radio Browser API wrapper with fully Type Hinting and Documentation

# Installation
`pip install radiozilla`
# Examples
```py
from radiozilla.radios import Radio


radio = Radio()
radio.search("BBC")
```
![](assets/image.png)