Reusable utilities for Lacus Solutions Python packages
Project description
Lacus Solutions' Utils
Reusable utilities library for Lacus Solutions' Python packages.
Python Support
| Passing ✔ | Passing ✔ | Passing ✔ | Passing ✔ | Passing ✔ |
Features
- Type description: Python-native type labels for error messages (
NoneType,dict,tuple, built-ins, lists) - Random sequences: Generate numeric, alphabetic, or alphanumeric sequences of any length
- Zero dependencies: No external runtime packages required
Installation
$ pip install lacus.utils
Import
from lacus.utils import describe_type, generate_random_sequence, SequenceType
Quick Start
describe_type(None) # 'NoneType'
describe_type("hello") # 'string'
describe_type(42) # 'integer number'
describe_type(3.14) # 'float number'
describe_type(float("nan")) # 'NaN'
describe_type({}) # 'dict'
describe_type([1, 2, 3]) # 'number[]'
describe_type([1, "a", 2]) # '(number | string)[]'
describe_type((1, 2)) # 'number tuple'
generate_random_sequence(10, "numeric") # e.g. '9956000611'
generate_random_sequence(6, "alphabetic") # e.g. 'AXQMZB'
generate_random_sequence(8, "alphanumeric") # e.g. '8ZFB2K09'
API
All functions are implemented in src/lacus/utils/ and covered by tests in tests/.
describe_type(value) -> str
Describes the type of a value for error messages.
| Input | Result |
|---|---|
None |
'NoneType' |
str |
'string' |
bool |
'boolean' |
int |
'integer number' |
float (finite) |
'float number' |
float('nan') |
'NaN' |
float('inf') / float('-inf') |
'Infinity' |
complex |
'complex number' |
dict |
'dict' |
set / frozenset |
'set' / 'frozenset' |
bytes / bytearray |
'bytes' / 'bytearray' |
| callable | 'function' |
class (int, str, …) |
'type' |
| custom class instance | 'object' |
[] |
'Array (empty)' |
[1, 2, 3] |
'number[]' |
[1, 'a', 2] |
`'(number |
() |
'tuple (empty)' |
(1, 2) |
'number tuple' |
generate_random_sequence(size: int, sequence_type: SequenceType) -> str
Generates a random character sequence of the given length and type.
size: Length of the sequence (e.g.10).sequence_type: One of:'numeric': digits0-9'alphabetic': uppercase lettersA-Z'alphanumeric': digits and uppercase letters0-9A-Z
Exports summary
| Export | Description |
|---|---|
describe_type |
Type description for error messages |
generate_random_sequence |
Random sequence generation |
SequenceType |
Literal type: 'alphabetic' | 'alphanumeric' | 'numeric' |
Contribution & Support
We welcome contributions! Please see our Contributing Guidelines for details. If you find this project helpful, please consider:
- Starring the repository
- Contributing to the codebase
- Suggesting new features
- Reporting bugs
License
This project is licensed under the MIT License - see the LICENSE file for details.
Changelog
See CHANGELOG for a list of changes and version history.
Made with ❤️ by Lacus Solutions
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lacus_utils-1.0.0.tar.gz.
File metadata
- Download URL: lacus_utils-1.0.0.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b618bdc4b8ea10bc35e1403dc2ec683586b0057ea1d0f1b9e705a7e4360c08f
|
|
| MD5 |
f01dbfdc10e0a758471df4c8b74f8866
|
|
| BLAKE2b-256 |
053cfc93d97d80f1e8c53c17c126a0686db166a43a7b1a6d6c8f47a624f87d05
|
File details
Details for the file lacus_utils-1.0.0-py3-none-any.whl.
File metadata
- Download URL: lacus_utils-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d902d692e89b4af7a941f9daffb88ba5a87298dcd0a5eb6652bc7a66cd47ef18
|
|
| MD5 |
3795e18cf37b8189cdce201980d20a8c
|
|
| BLAKE2b-256 |
2ea8c33e57769dd57cbe2acd363f861756f85ae4908cefc92fa07c101a4122b6
|