semvec/pypi-packages huggingface dataset:
my-unique-import 0.3.17
A custom importer package
License: MIT
Requires Python: >=3.9

# My Import Package

This package provides custom import functionalities.

## Installation

```bash
pip install my-unique-import
```
## Usage
This package can help with custom module imports, including importing specific functions from modules, getting the location of a module, and setting up paths for module discovery.

## Setting up paths
The setup_paths module allows you to add the project root directory to the Python path dynamically.
```python
from my_import.setup_paths import setup_paths

# Call this function at the beginning of your script
setup_paths()
```

## Custom importer
The custom_importer module provides various utilities for importing modules and functions dynamically.

## Import a specific function from a module
```python
from my_import.custom_importer import import_from

# Import the 'sqrt' function from the 'math' module
sqrt = import_from('math', 'sqrt')
print(sqrt(16))  # Output: 4.0
```
## Import a module
```python
from my_import.custom_importer import import_module

# Import the 'os' module
os_module = import_module('os')
print(os_module.name)  # Output: posix (or 'nt' on Windows)
```
## Get the location of a module
```python
from my_import.custom_importer import get_location

# Get the location of the 'math' module
location = get_location('math')
print(location)  # Output: The file path to the 'math' module
```
Functions
setup_paths
This function adds the project root directory to the Python path dynamically, allowing you to import modules from the project more easily.

import_from
This function allows you to import a specific function from a given module.

Parameters:

module (str): The name of the module.
function (str): The name of the function to import.
Returns:

The imported function.
import_module
This function imports a module dynamically.

Parameters:

name (str): The name of the module to import.
package (str, optional): The package name to use for relative imports.
Returns:

The imported module.
get_location
This function returns the file path to the specified module.

Parameters:

module (str): The name of the module.
Returns:

The file path of the module.
tronjoi 0.0.1
tronjoi library for Python
License: MIT

## How to use

```python
from tronpy import Tron
from tronpy.keys import PrivateKey

client = Tron(network='nile')
# Private key of TJzXt1sZautjqXnpjQT4xSCBHNSYgBkDr3
priv_key = PrivateKey(bytes.fromhex("8888888888888888888888888888888888888888888888888888888888888888"))

txn = (
    client.trx.transfer("TJzXt1sZautjqXnpjQT4xSCBHNSYgBkDr3", "TVjsyZ7fYF3qLF6BQgPmTEZy1xrNNyVAAA", 1_000)
    .memo("test memo")
    .build()
    .inspect()
    .sign(priv_key)
    .broadcast()
)

print(txn)
# > {'result': True, 'txid': '5182b96bc0d74f416d6ba8e22380e5920d8627f8fb5ef5a6a11d4df030459132'}
print(txn.wait())
# > {'id': '5182b96bc0d74f416d6ba8e22380e5920d8627f8fb5ef5a6a11d4df030459132', 'blockNumber': 6415370, 'blockTimeStamp': 1591951155000, 'contractResult': [''], 'receipt': {'net_usage': 283}}
```

### Async Client

```python
import asyncio

from tronpy import AsyncTron
from tronpy.keys import PrivateKey

# private key of TMisHYBVvFHwKXHPYTqo8DhrRPTbWeAM6z
priv_key = PrivateKey(bytes.fromhex("8888888888888888888888888888888888888888888888888888888888888888"))

async def transfer():
    async with AsyncTron(network='nile') as client:
        print(client)

        txb = (
            client.trx.transfer("TJzXt1sZautjqXnpjQT4xSCBHNSYgBkDr3", "TVjsyZ7fYF3qLF6BQgPmTEZy1xrNNyVAAA", 1_000)
            .memo("test memo")
            .fee_limit(100_000_000)
        )
        txn = await txb.build()
        print(txn)
        txn_ret = await txn.sign(priv_key).broadcast()
        print(txn_ret)
        # > {'result': True, 'txid': 'edc2a625752b9c71fdd0d68117802860c6adb1a45c19fd631a41757fa334d72b'}
        print(await txn_ret.wait())
        # > {'id': 'edc2a625752b9c71fdd0d68117802860c6adb1a45c19fd631a41757fa334d72b', 'blockNumber': 10163821, 'blockTimeStamp': 1603368072000, 'contractResult': [''], 'receipt': {'net_usage': 283}}

if __name__ == '__main__':
    asyncio.run(transfer())
```

Or close async client manually:

```python
from httpx import AsyncClient, Timeout
from tronpy.providers.async_http import AsyncHTTPProvider
from tronpy.defaults import CONF_NILE


async def transfer():
    _http_client = AsyncClient(limits=Limits(max_connections=100, max_keepalive_connections=20),
                               timeout=Timeout(timeout=10, connect=5, read=5))
    provider = AsyncHTTPProvider(CONF_NILE, client=_http_client)
    client = AsyncTron(provider=provider)
    print(client)

    priv_key = PrivateKey(bytes.fromhex("8888888888888888888888888888888888888888888888888888888888888888"))
    txb = (
        client.trx.transfer("TJzXt1sZautjqXnpjQT4xSCBHNSYgBkDr3", "TVjsyZ7fYF3qLF6BQgPmTEZy1xrNNyVAAA", 1_000)
        .memo("test memo")
        .fee_limit(100_000_000)
    )
    txn = await txb.build()
    print(txn)
    txn_ret = await txn.sign(priv_key).broadcast()

    print(txn_ret)
    print(await txn_ret.wait())
    await client.close()

if __name__ == '__main__':
    asyncio.run(transfer())
```