True-Core Python Library
A sophisticated Python utility library providing advanced enum management, type validation, time handling, regular expressions, and file operations.
Core Components
1. Enum Management (true.enum_registry)
- EnumRegistry: Advanced enum combination and management
- Merge multiple enum classes into a single registry
- Type-safe operations and validation
- Metadata support with descriptions, tags, and timestamps
- Comprehensive filtering capabilities
- Statistical analysis and serialization
2. Enum Toolkits (true.enums_toolkits)
- Specialized Enum Classes:
DynamicEnum: Runtime-modifiable enums- Type-safe enums:
ByteEnum,FloatEnum,ComplexNumberEnum - Collection enums:
DictEnum,SetEnum,ListEnum,TupleEnum - Iterator enums:
IterableEnum,IteratorEnum,GeneratorEnum
- Metadata Support:
- Custom attribute configuration
- Type information tracking
- Serialization capabilities
3. Collections (true.collections)
- File System Operations:
- Secure file deletion and creation
- Advanced file metadata handling
- Cross-platform compatibility
- File type-specific operations
- File Management:
- RecycleBin with metadata tracking
- Batch file operations
- Directory watching
- File statistics and analysis
4. Time Management (true.time)
- Time Handling:
- Advanced timezone support
- Time arithmetic and comparisons
- Duration calculations
- Event scheduling
- Time Features:
- Time rounding and formatting
- Timezone conversions
- Performance timing decorators
- Schedule management with conflict detection
5. Regular Expressions (true.re)
- Validation Patterns:
- Username validation patterns
- Password complexity patterns
- Email format validation
- Phone number formats
- Credit card validation
- URL pattern matching
- Date format validation
- IP address validation
6. Type System (true.types)
- Version Types:
- SemVer, CalVer, DateVersion support
- Version validation and comparison
- Numeric Types:
BigIntandBigDecimalwith validation- Scientific number handling
- Validated numeric types
- ID Types:
- UUID/ULID support with versions
- String and integer-based IDs
- Serialization:
- JSON, YAML, TOML support
- Type conversion utilities
7. Exception Handling (true.exceptions)
- Specialized Exceptions:
- Enum-related exceptions
- Type validation errors
- Schedule management errors
- File operation errors
- Access control exceptions
- Configuration errors
Installation
pip install true-core
Quick Start
from true.enum_registry import EnumRegistry
from true.collections import OSUtils
from true.time import Time, Schedule, Event, TimeUnit
from true.types import BigInt, Version
from enum import Enum
# Enum Registry Example
class ColorEnum(Enum):
RED = 1
BLUE = 2
registry = EnumRegistry([ColorEnum])
int_values = registry.filter.by_value_type(int)
# Time Management Example
time = Time.now()
schedule = Schedule()
event = Event(name="Meeting", start_time=time, end_time=time.add(1, TimeUnit.HOURS))
schedule.add_event(event)
# Type Validation Example
version = Version("1.2.3")
big_num = BigInt(1000000, context="Positive")
# File Operations Example
utils = OSUtils()
utils.force_delete("path/to/file") # Secure deletion
utils.watch_directory("path/to/dir", callback=lambda event: print(f"Change: {event.src_path}"))
Requirements
- Python 3.8+
- Platform-specific dependencies:
- Windows:
pywin32for advanced file operations - Unix: Standard Python libraries
- Windows:
- Optional dependencies:
pytzfor timezone supportpydubfor audio file handlingPillowfor image processing
Documentation
For detailed documentation, see docs.
License
MIT License - See LICENSE file for details.
Contributing
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
Support
For support:
- Check the documentation
- Search existing issues
- Create a new issue if needed
Author
Alaamer - https://github.com/alaamer12
Acknowledgments
Metadata
Release files for true-core 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| true_core-0.1.3.tar.gz | 69.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| true_core-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 149.2 kB
Release files / true_core-0.1.3.tar.gz
| Download URL | true_core-0.1.3.tar.gz |
|---|---|
| Size | 69.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aeb1af5107d4d0262ceb7251a7543ddfc2ce8ab1ee3da5d4aadcb19322920160
|
|
BLAKE2b-256 checksum How to use checksums |
a58092a803170397aefe1c02804b09c33235190093a9ffe0b89067d7439117b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.6
|
Release files / true_core-0.1.3-py3-none-any.whl
| Download URL | true_core-0.1.3-py3-none-any.whl |
|---|---|
| Size | 79.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b87a80f1732926cc591f23b15c6924eb511cbdd0217a8d595c0010430bf1a800
|
|
BLAKE2b-256 checksum How to use checksums |
4b552296386a3e7837e3922ad8774537a52284c38329ab7b2fa958e81bd972ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.6
|