This release is a pre-release and may not be stable for production use.
Dynamic Casting Utility
Introduction
This Python module provides a dynamic casting utility that enables flexible casting of function arguments and return values based on type annotations. The utility is particularly useful for handling complex type conversions and ensuring compatibility between different data types.
Installation
To use this dynamic casting utility, you can include it in your project by importing the dynamic_cast function from the module.
from dynamic_cast import dynamic_cast
Usage
Basic Usage
The dynamic_cast function can be applied to functions to dynamically cast their arguments and return values based on the provided type annotations. It supports various scenarios, including handling iterable types, callables, and more.
@dynamic_cast
def example_function(arg1: int, arg2: str) -> float:
# Function logic here.
return result
Advanced Usage
For more advanced scenarios, the utility provides additional functionality, such as handling generic types, callable types, and class instances.
@dynamic_cast
def advanced_function(arg1: List[int], arg2: Dict[str, float]) -> Tuple[str, int]:
# Advanced function logic here.
return result_tuple
Examples.
Dynamic Casting of Arguments.
@dynamic_cast
def example_function(arg1: Union[str, int], arg2: List[float]) -> Tuple[str, List[int]]:
# Function logic here
return result_tuple
Dynamic Casting of Class Instances
class ExampleClass:
@dynamic_cast
def __init__(self, arg1: int, arg2: str) -> None:
# Class initialization logic here
Contributing
Feel free to contribute to the development of this dynamic casting utility. If you encounter any issues or have suggestions for improvement, please create an issue or submit a pull request.
License
This dynamic casting utility is distributed under the MIT License. See the LICENSE file for more information.
Metadata
Release files for dynamic-cast 0.1.2a2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| dynamic_cast-0.1.2a2.tar.gz | 6.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dynamic_cast-0.1.2a2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.0 kB
Release files / dynamic_cast-0.1.2a2.tar.gz
| Download URL | dynamic_cast-0.1.2a2.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
80962cd3a9ba2f6310ed5c4fe6a27df9e1d4baf773fb2e604b15afb14a668b72
|
|
BLAKE2b-256 checksum How to use checksums |
cb8e87430a0882e10c611b6d7f38b3821614f7e17440d14b7dca2a37677af189
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.18.2 CPython/3.10.14 Windows/10
|
Release files / dynamic_cast-0.1.2a2-py3-none-any.whl
| Download URL | dynamic_cast-0.1.2a2-py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
18d2a1a61b9cdb3f6c9e283fc1e96312d3a39fc450ab5923c59c3e08e1dc326a
|
|
BLAKE2b-256 checksum How to use checksums |
5e41673fa827bfc365a0d3b55707d0df5e7a2eecedd6aac9d79066ae4f2af6b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.18.2 CPython/3.10.14 Windows/10
|
Security for dynamic-cast 0.1.2a2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.