lacus.utils 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Julio L. Muller
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,151 @@
1
+ Metadata-Version: 2.4
2
+ Name: lacus.utils
3
+ Version: 1.0.0
4
+ Summary: Reusable utilities for Lacus Solutions Python packages
5
+ Author: Julio L. Muller
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/LacusSolutions/br-utils-py
8
+ Project-URL: Source, https://github.com/LacusSolutions/br-utils-py
9
+ Project-URL: Tracker, https://github.com/LacusSolutions/br-utils-py/issues
10
+ Keywords: utils,utilities,helpers,random,sequence,type
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Natural Language :: English
14
+ Classifier: Operating System :: MacOS :: MacOS X
15
+ Classifier: Operating System :: Microsoft :: Windows
16
+ Classifier: Operating System :: POSIX
17
+ Classifier: Operating System :: Unix
18
+ Classifier: Programming Language :: Python :: 3 :: Only
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Programming Language :: Python :: 3.14
24
+ Classifier: Topic :: Software Development :: Libraries
25
+ Classifier: Topic :: Utilities
26
+ Requires-Python: >=3.10
27
+ Description-Content-Type: text/markdown
28
+ License-File: LICENSE
29
+ Dynamic: license-file
30
+
31
+ # Lacus Solutions' Utils
32
+
33
+ [![PyPI Version](https://img.shields.io/pypi/v/lacus.utils)](https://pypi.org/project/lacus.utils)
34
+ [![PyPI Downloads](https://img.shields.io/pypi/dm/lacus.utils)](https://pypi.org/project/lacus.utils)
35
+ [![Python Version](https://img.shields.io/pypi/pyversions/lacus.utils)](https://www.python.org/)
36
+ [![Test Status](https://img.shields.io/github/actions/workflow/status/LacusSolutions/br-utils-py/ci.yml?label=ci/cd)](https://github.com/LacusSolutions/br-utils-py/actions)
37
+ [![Last Update Date](https://img.shields.io/github/last-commit/LacusSolutions/br-utils-py)](https://github.com/LacusSolutions/br-utils-py)
38
+ [![Project License](https://img.shields.io/github/license/LacusSolutions/br-utils-py)](https://github.com/LacusSolutions/br-utils-py/blob/main/LICENSE)
39
+
40
+ Reusable utilities library for Lacus Solutions' Python packages.
41
+
42
+ ## Python Support
43
+
44
+ | ![Python 3.10](https://img.shields.io/badge/Python-3.10-3776AB?logo=python&logoColor=white) | ![Python 3.11](https://img.shields.io/badge/Python-3.11-3776AB?logo=python&logoColor=white) | ![Python 3.12](https://img.shields.io/badge/Python-3.12-3776AB?logo=python&logoColor=white) | ![Python 3.13](https://img.shields.io/badge/Python-3.13-3776AB?logo=python&logoColor=white) | ![Python 3.14](https://img.shields.io/badge/Python-3.14-3776AB?logo=python&logoColor=white) |
45
+ |--- | --- | --- | --- | --- |
46
+ | Passing ✔ | Passing ✔ | Passing ✔ | Passing ✔ | Passing ✔ |
47
+
48
+ ## Features
49
+
50
+ - **Type description**: Python-native type labels for error messages (`NoneType`, `dict`, `tuple`, built-ins, lists)
51
+ - **Random sequences**: Generate numeric, alphabetic, or alphanumeric sequences of any length
52
+ - **Zero dependencies**: No external runtime packages required
53
+
54
+ ## Installation
55
+
56
+ ```bash
57
+ $ pip install lacus.utils
58
+ ```
59
+
60
+ ## Import
61
+
62
+ ```python
63
+ from lacus.utils import describe_type, generate_random_sequence, SequenceType
64
+ ```
65
+
66
+ ## Quick Start
67
+
68
+ ```python
69
+ describe_type(None) # 'NoneType'
70
+ describe_type("hello") # 'string'
71
+ describe_type(42) # 'integer number'
72
+ describe_type(3.14) # 'float number'
73
+ describe_type(float("nan")) # 'NaN'
74
+ describe_type({}) # 'dict'
75
+ describe_type([1, 2, 3]) # 'number[]'
76
+ describe_type([1, "a", 2]) # '(number | string)[]'
77
+ describe_type((1, 2)) # 'number tuple'
78
+
79
+ generate_random_sequence(10, "numeric") # e.g. '9956000611'
80
+ generate_random_sequence(6, "alphabetic") # e.g. 'AXQMZB'
81
+ generate_random_sequence(8, "alphanumeric") # e.g. '8ZFB2K09'
82
+ ```
83
+
84
+ ## API
85
+
86
+ All functions are implemented in [`src/lacus/utils/`](src/lacus/utils/) and covered by tests in [`tests/`](tests/).
87
+
88
+ ### `describe_type(value) -> str`
89
+
90
+ Describes the type of a value for error messages.
91
+
92
+ | Input | Result |
93
+ |--------|--------|
94
+ | `None` | `'NoneType'` |
95
+ | `str` | `'string'` |
96
+ | `bool` | `'boolean'` |
97
+ | `int` | `'integer number'` |
98
+ | `float` (finite) | `'float number'` |
99
+ | `float('nan')` | `'NaN'` |
100
+ | `float('inf')` / `float('-inf')` | `'Infinity'` |
101
+ | `complex` | `'complex number'` |
102
+ | `dict` | `'dict'` |
103
+ | `set` / `frozenset` | `'set'` / `'frozenset'` |
104
+ | `bytes` / `bytearray` | `'bytes'` / `'bytearray'` |
105
+ | callable | `'function'` |
106
+ | class (`int`, `str`, …) | `'type'` |
107
+ | custom class instance | `'object'` |
108
+ | `[]` | `'Array (empty)'` |
109
+ | `[1, 2, 3]` | `'number[]'` |
110
+ | `[1, 'a', 2]` | `'(number | string)[]'` |
111
+ | `()` | `'tuple (empty)'` |
112
+ | `(1, 2)` | `'number tuple'` |
113
+
114
+ ### `generate_random_sequence(size: int, sequence_type: SequenceType) -> str`
115
+
116
+ Generates a random character sequence of the given length and type.
117
+
118
+ - **`size`**: Length of the sequence (e.g. `10`).
119
+ - **`sequence_type`**: One of:
120
+ - **`'numeric'`**: digits `0-9`
121
+ - **`'alphabetic'`**: uppercase letters `A-Z`
122
+ - **`'alphanumeric'`**: digits and uppercase letters `0-9A-Z`
123
+
124
+ ### Exports summary
125
+
126
+ | Export | Description |
127
+ |--------|-------------|
128
+ | `describe_type` | Type description for error messages |
129
+ | `generate_random_sequence` | Random sequence generation |
130
+ | `SequenceType` | Literal type: `'alphabetic' \| 'alphanumeric' \| 'numeric'` |
131
+
132
+ ## Contribution & Support
133
+
134
+ We welcome contributions! Please see our [Contributing Guidelines](https://github.com/LacusSolutions/br-utils-py/blob/main/CONTRIBUTING.md) for details. If you find this project helpful, please consider:
135
+
136
+ - Starring the repository
137
+ - Contributing to the codebase
138
+ - [Suggesting new features](https://github.com/LacusSolutions/br-utils-py/issues)
139
+ - [Reporting bugs](https://github.com/LacusSolutions/br-utils-py/issues)
140
+
141
+ ## License
142
+
143
+ This project is licensed under the MIT License - see the [LICENSE](https://github.com/LacusSolutions/br-utils-py/blob/main/LICENSE) file for details.
144
+
145
+ ## Changelog
146
+
147
+ See [CHANGELOG](./CHANGELOG.md) for a list of changes and version history.
148
+
149
+ ---
150
+
151
+ Made with ❤️ by [Lacus Solutions](https://github.com/LacusSolutions)
@@ -0,0 +1,121 @@
1
+ # Lacus Solutions' Utils
2
+
3
+ [![PyPI Version](https://img.shields.io/pypi/v/lacus.utils)](https://pypi.org/project/lacus.utils)
4
+ [![PyPI Downloads](https://img.shields.io/pypi/dm/lacus.utils)](https://pypi.org/project/lacus.utils)
5
+ [![Python Version](https://img.shields.io/pypi/pyversions/lacus.utils)](https://www.python.org/)
6
+ [![Test Status](https://img.shields.io/github/actions/workflow/status/LacusSolutions/br-utils-py/ci.yml?label=ci/cd)](https://github.com/LacusSolutions/br-utils-py/actions)
7
+ [![Last Update Date](https://img.shields.io/github/last-commit/LacusSolutions/br-utils-py)](https://github.com/LacusSolutions/br-utils-py)
8
+ [![Project License](https://img.shields.io/github/license/LacusSolutions/br-utils-py)](https://github.com/LacusSolutions/br-utils-py/blob/main/LICENSE)
9
+
10
+ Reusable utilities library for Lacus Solutions' Python packages.
11
+
12
+ ## Python Support
13
+
14
+ | ![Python 3.10](https://img.shields.io/badge/Python-3.10-3776AB?logo=python&logoColor=white) | ![Python 3.11](https://img.shields.io/badge/Python-3.11-3776AB?logo=python&logoColor=white) | ![Python 3.12](https://img.shields.io/badge/Python-3.12-3776AB?logo=python&logoColor=white) | ![Python 3.13](https://img.shields.io/badge/Python-3.13-3776AB?logo=python&logoColor=white) | ![Python 3.14](https://img.shields.io/badge/Python-3.14-3776AB?logo=python&logoColor=white) |
15
+ |--- | --- | --- | --- | --- |
16
+ | Passing ✔ | Passing ✔ | Passing ✔ | Passing ✔ | Passing ✔ |
17
+
18
+ ## Features
19
+
20
+ - **Type description**: Python-native type labels for error messages (`NoneType`, `dict`, `tuple`, built-ins, lists)
21
+ - **Random sequences**: Generate numeric, alphabetic, or alphanumeric sequences of any length
22
+ - **Zero dependencies**: No external runtime packages required
23
+
24
+ ## Installation
25
+
26
+ ```bash
27
+ $ pip install lacus.utils
28
+ ```
29
+
30
+ ## Import
31
+
32
+ ```python
33
+ from lacus.utils import describe_type, generate_random_sequence, SequenceType
34
+ ```
35
+
36
+ ## Quick Start
37
+
38
+ ```python
39
+ describe_type(None) # 'NoneType'
40
+ describe_type("hello") # 'string'
41
+ describe_type(42) # 'integer number'
42
+ describe_type(3.14) # 'float number'
43
+ describe_type(float("nan")) # 'NaN'
44
+ describe_type({}) # 'dict'
45
+ describe_type([1, 2, 3]) # 'number[]'
46
+ describe_type([1, "a", 2]) # '(number | string)[]'
47
+ describe_type((1, 2)) # 'number tuple'
48
+
49
+ generate_random_sequence(10, "numeric") # e.g. '9956000611'
50
+ generate_random_sequence(6, "alphabetic") # e.g. 'AXQMZB'
51
+ generate_random_sequence(8, "alphanumeric") # e.g. '8ZFB2K09'
52
+ ```
53
+
54
+ ## API
55
+
56
+ All functions are implemented in [`src/lacus/utils/`](src/lacus/utils/) and covered by tests in [`tests/`](tests/).
57
+
58
+ ### `describe_type(value) -> str`
59
+
60
+ Describes the type of a value for error messages.
61
+
62
+ | Input | Result |
63
+ |--------|--------|
64
+ | `None` | `'NoneType'` |
65
+ | `str` | `'string'` |
66
+ | `bool` | `'boolean'` |
67
+ | `int` | `'integer number'` |
68
+ | `float` (finite) | `'float number'` |
69
+ | `float('nan')` | `'NaN'` |
70
+ | `float('inf')` / `float('-inf')` | `'Infinity'` |
71
+ | `complex` | `'complex number'` |
72
+ | `dict` | `'dict'` |
73
+ | `set` / `frozenset` | `'set'` / `'frozenset'` |
74
+ | `bytes` / `bytearray` | `'bytes'` / `'bytearray'` |
75
+ | callable | `'function'` |
76
+ | class (`int`, `str`, …) | `'type'` |
77
+ | custom class instance | `'object'` |
78
+ | `[]` | `'Array (empty)'` |
79
+ | `[1, 2, 3]` | `'number[]'` |
80
+ | `[1, 'a', 2]` | `'(number | string)[]'` |
81
+ | `()` | `'tuple (empty)'` |
82
+ | `(1, 2)` | `'number tuple'` |
83
+
84
+ ### `generate_random_sequence(size: int, sequence_type: SequenceType) -> str`
85
+
86
+ Generates a random character sequence of the given length and type.
87
+
88
+ - **`size`**: Length of the sequence (e.g. `10`).
89
+ - **`sequence_type`**: One of:
90
+ - **`'numeric'`**: digits `0-9`
91
+ - **`'alphabetic'`**: uppercase letters `A-Z`
92
+ - **`'alphanumeric'`**: digits and uppercase letters `0-9A-Z`
93
+
94
+ ### Exports summary
95
+
96
+ | Export | Description |
97
+ |--------|-------------|
98
+ | `describe_type` | Type description for error messages |
99
+ | `generate_random_sequence` | Random sequence generation |
100
+ | `SequenceType` | Literal type: `'alphabetic' \| 'alphanumeric' \| 'numeric'` |
101
+
102
+ ## Contribution & Support
103
+
104
+ We welcome contributions! Please see our [Contributing Guidelines](https://github.com/LacusSolutions/br-utils-py/blob/main/CONTRIBUTING.md) for details. If you find this project helpful, please consider:
105
+
106
+ - Starring the repository
107
+ - Contributing to the codebase
108
+ - [Suggesting new features](https://github.com/LacusSolutions/br-utils-py/issues)
109
+ - [Reporting bugs](https://github.com/LacusSolutions/br-utils-py/issues)
110
+
111
+ ## License
112
+
113
+ This project is licensed under the MIT License - see the [LICENSE](https://github.com/LacusSolutions/br-utils-py/blob/main/LICENSE) file for details.
114
+
115
+ ## Changelog
116
+
117
+ See [CHANGELOG](./CHANGELOG.md) for a list of changes and version history.
118
+
119
+ ---
120
+
121
+ Made with ❤️ by [Lacus Solutions](https://github.com/LacusSolutions)
@@ -0,0 +1,65 @@
1
+ [project]
2
+ name = "lacus.utils"
3
+ dynamic = [ "version" ]
4
+ description = "Reusable utilities for Lacus Solutions Python packages"
5
+ license = "MIT"
6
+ license-files = [ "LICENSE" ]
7
+ keywords = [
8
+ "utils",
9
+ "utilities",
10
+ "helpers",
11
+ "random",
12
+ "sequence",
13
+ "type",
14
+ ]
15
+ classifiers = [
16
+ "Development Status :: 5 - Production/Stable",
17
+ "Intended Audience :: Developers",
18
+ "Natural Language :: English",
19
+ "Operating System :: MacOS :: MacOS X",
20
+ "Operating System :: Microsoft :: Windows",
21
+ "Operating System :: POSIX",
22
+ "Operating System :: Unix",
23
+ "Programming Language :: Python :: 3 :: Only",
24
+ "Programming Language :: Python :: 3.10",
25
+ "Programming Language :: Python :: 3.11",
26
+ "Programming Language :: Python :: 3.12",
27
+ "Programming Language :: Python :: 3.13",
28
+ "Programming Language :: Python :: 3.14",
29
+ "Topic :: Software Development :: Libraries",
30
+ "Topic :: Utilities",
31
+ ]
32
+ requires-python = ">=3.10"
33
+
34
+ [[project.authors]]
35
+ name = "Julio L. Muller"
36
+
37
+ [project.readme]
38
+ file = "README.md"
39
+ content-type = "text/markdown"
40
+
41
+ [project.urls]
42
+ Homepage = "https://github.com/LacusSolutions/br-utils-py"
43
+ Source = "https://github.com/LacusSolutions/br-utils-py"
44
+ Tracker = "https://github.com/LacusSolutions/br-utils-py/issues"
45
+
46
+ [build-system]
47
+ requires = [ "setuptools>=82.0.1", "wheel" ]
48
+ build-backend = "setuptools.build_meta"
49
+
50
+ [tool.setuptools.dynamic.version]
51
+ attr = "lacus.utils.__version__"
52
+
53
+ [tool.setuptools.packages.find]
54
+ where = [ "src/" ]
55
+
56
+ [tool.pytest.ini_options]
57
+ minversion = "9.0"
58
+ addopts = [ "--import-mode=importlib" ]
59
+ testpaths = [ "tests/" ]
60
+ python_files = [ "*.spec.py" ]
61
+ python_functions = [ "it_*", "test_*" ]
62
+
63
+ [tool.coverage.run]
64
+ source = [ "src/" ]
65
+ omit = [ "tests/*" ]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,11 @@
1
+ from .describe_type import describe_type
2
+ from .generate_random_sequence import generate_random_sequence
3
+ from .types import SequenceType
4
+
5
+ __all__ = [
6
+ "SequenceType",
7
+ "describe_type",
8
+ "generate_random_sequence",
9
+ ]
10
+
11
+ __version__ = "1.0.0"
@@ -0,0 +1,150 @@
1
+ import math
2
+ from collections.abc import Callable
3
+ from typing import Any
4
+
5
+
6
+ def _describe_item(item: Any) -> str:
7
+ """Return a type label for an element inside a list or tuple."""
8
+ if item is None:
9
+ return "NoneType"
10
+
11
+ if isinstance(item, bool):
12
+ return "boolean"
13
+
14
+ if isinstance(item, int):
15
+ return "number"
16
+
17
+ if isinstance(item, float):
18
+ if math.isnan(item):
19
+ return "NaN"
20
+
21
+ if math.isinf(item):
22
+ return "Infinity"
23
+
24
+ return "number"
25
+
26
+ if isinstance(item, str):
27
+ return "string"
28
+
29
+ return _describe_type(item)
30
+
31
+
32
+ def _describe_sequence(
33
+ items: list[Any] | tuple[Any, ...],
34
+ empty_label: str,
35
+ suffix: str,
36
+ ) -> str:
37
+ if not items:
38
+ return empty_label
39
+
40
+ unique_types: dict[str, None] = {}
41
+
42
+ for item in items:
43
+ label = _describe_item(item)
44
+
45
+ if label not in unique_types:
46
+ unique_types[label] = None
47
+
48
+ type_labels = list(unique_types.keys())
49
+
50
+ if len(type_labels) == 1:
51
+ return f"{type_labels[0]}{suffix}"
52
+
53
+ return f"({' | '.join(type_labels)}){suffix}"
54
+
55
+
56
+ def _describe_type(value: Any) -> str:
57
+ if isinstance(value, list):
58
+ return _describe_sequence(value, "Array (empty)", "[]")
59
+
60
+ if isinstance(value, tuple):
61
+ return _describe_sequence(value, "tuple (empty)", " tuple")
62
+
63
+ if value is None:
64
+ return "NoneType"
65
+
66
+ if isinstance(value, bool):
67
+ return "boolean"
68
+
69
+ if isinstance(value, int):
70
+ return "integer number"
71
+
72
+ if isinstance(value, float):
73
+ if math.isnan(value):
74
+ return "NaN"
75
+
76
+ if math.isinf(value):
77
+ return "Infinity"
78
+
79
+ return "float number"
80
+
81
+ if isinstance(value, complex):
82
+ return "complex number"
83
+
84
+ if isinstance(value, str):
85
+ return "string"
86
+
87
+ if isinstance(value, dict):
88
+ return "dict"
89
+
90
+ if isinstance(value, set):
91
+ return "set"
92
+
93
+ if isinstance(value, frozenset):
94
+ return "frozenset"
95
+
96
+ if isinstance(value, bytes):
97
+ return "bytes"
98
+
99
+ if isinstance(value, bytearray):
100
+ return "bytearray"
101
+
102
+ if isinstance(value, type):
103
+ return "type"
104
+
105
+ if isinstance(value, Callable):
106
+ return "function"
107
+
108
+ return "object"
109
+
110
+
111
+ def describe_type(value: Any) -> str:
112
+ """Describe the type of a value for error messages.
113
+
114
+ Args:
115
+ value: Any value to describe.
116
+
117
+ Returns:
118
+ A human-readable type label. For example, ``None`` returns ``"NoneType"``,
119
+ ``42`` returns ``"integer number"``, ``[1, 2, 3]`` returns ``"number[]"``,
120
+ and ``(1, "a")`` returns ``"(number | string) tuple"``.
121
+
122
+ Examples:
123
+ >>> describe_type(None)
124
+ 'NoneType'
125
+ >>> describe_type("hello")
126
+ 'string'
127
+ >>> describe_type(True)
128
+ 'boolean'
129
+ >>> describe_type(42)
130
+ 'integer number'
131
+ >>> describe_type(3.14)
132
+ 'float number'
133
+ >>> describe_type(float("nan"))
134
+ 'NaN'
135
+ >>> describe_type(float("inf"))
136
+ 'Infinity'
137
+ >>> describe_type([])
138
+ 'Array (empty)'
139
+ >>> describe_type([1, 2, 3])
140
+ 'number[]'
141
+ >>> describe_type([1, "a", 2])
142
+ '(number | string)[]'
143
+ >>> describe_type({})
144
+ 'dict'
145
+ >>> describe_type(())
146
+ 'tuple (empty)'
147
+ >>> describe_type((1, 2))
148
+ 'number tuple'
149
+ """
150
+ return _describe_type(value)
@@ -0,0 +1,40 @@
1
+ import secrets
2
+
3
+ from .types import SequenceType
4
+
5
+ _NUMERIC = "0123456789"
6
+ _ALPHABETIC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
7
+ _ALPHANUMERIC = _NUMERIC + _ALPHABETIC
8
+
9
+
10
+ def generate_random_sequence(size: int, sequence_type: SequenceType) -> str:
11
+ """Generate a random character sequence of the given length and type.
12
+
13
+ Args:
14
+ size: Length of the sequence.
15
+ sequence_type: Character set to draw from. One of ``"numeric"`` (``0-9``),
16
+ ``"alphabetic"`` (``A-Z``), or ``"alphanumeric"`` (``0-9A-Z``).
17
+
18
+ Returns:
19
+ A random string of the requested length using uppercase letters and/or
20
+ digits, depending on ``sequence_type``.
21
+
22
+ Examples:
23
+ >>> generate_random_sequence(10, "numeric") # doctest: +SKIP
24
+ '9956000611'
25
+ >>> generate_random_sequence(6, "alphabetic") # doctest: +SKIP
26
+ 'AXQMZB'
27
+ >>> generate_random_sequence(8, "alphanumeric") # doctest: +SKIP
28
+ '8ZFB2K09'
29
+ """
30
+ if size < 0:
31
+ raise ValueError(f"size must be non-negative, got {size}")
32
+
33
+ if sequence_type == "numeric":
34
+ chars = _NUMERIC
35
+ elif sequence_type == "alphabetic":
36
+ chars = _ALPHABETIC
37
+ else:
38
+ chars = _ALPHANUMERIC
39
+
40
+ return "".join(secrets.choice(chars) for _ in range(size))
@@ -0,0 +1,9 @@
1
+ from typing import Literal
2
+
3
+ SequenceType = Literal["alphabetic", "alphanumeric", "numeric"]
4
+ """Character type for random sequence generation.
5
+
6
+ - ``"alphanumeric"``: digits and uppercase letters (``0-9A-Z``).
7
+ - ``"numeric"``: digits only (``0-9``).
8
+ - ``"alphabetic"``: uppercase letters only (``A-Z``).
9
+ """
@@ -0,0 +1,151 @@
1
+ Metadata-Version: 2.4
2
+ Name: lacus.utils
3
+ Version: 1.0.0
4
+ Summary: Reusable utilities for Lacus Solutions Python packages
5
+ Author: Julio L. Muller
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/LacusSolutions/br-utils-py
8
+ Project-URL: Source, https://github.com/LacusSolutions/br-utils-py
9
+ Project-URL: Tracker, https://github.com/LacusSolutions/br-utils-py/issues
10
+ Keywords: utils,utilities,helpers,random,sequence,type
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Natural Language :: English
14
+ Classifier: Operating System :: MacOS :: MacOS X
15
+ Classifier: Operating System :: Microsoft :: Windows
16
+ Classifier: Operating System :: POSIX
17
+ Classifier: Operating System :: Unix
18
+ Classifier: Programming Language :: Python :: 3 :: Only
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Programming Language :: Python :: 3.14
24
+ Classifier: Topic :: Software Development :: Libraries
25
+ Classifier: Topic :: Utilities
26
+ Requires-Python: >=3.10
27
+ Description-Content-Type: text/markdown
28
+ License-File: LICENSE
29
+ Dynamic: license-file
30
+
31
+ # Lacus Solutions' Utils
32
+
33
+ [![PyPI Version](https://img.shields.io/pypi/v/lacus.utils)](https://pypi.org/project/lacus.utils)
34
+ [![PyPI Downloads](https://img.shields.io/pypi/dm/lacus.utils)](https://pypi.org/project/lacus.utils)
35
+ [![Python Version](https://img.shields.io/pypi/pyversions/lacus.utils)](https://www.python.org/)
36
+ [![Test Status](https://img.shields.io/github/actions/workflow/status/LacusSolutions/br-utils-py/ci.yml?label=ci/cd)](https://github.com/LacusSolutions/br-utils-py/actions)
37
+ [![Last Update Date](https://img.shields.io/github/last-commit/LacusSolutions/br-utils-py)](https://github.com/LacusSolutions/br-utils-py)
38
+ [![Project License](https://img.shields.io/github/license/LacusSolutions/br-utils-py)](https://github.com/LacusSolutions/br-utils-py/blob/main/LICENSE)
39
+
40
+ Reusable utilities library for Lacus Solutions' Python packages.
41
+
42
+ ## Python Support
43
+
44
+ | ![Python 3.10](https://img.shields.io/badge/Python-3.10-3776AB?logo=python&logoColor=white) | ![Python 3.11](https://img.shields.io/badge/Python-3.11-3776AB?logo=python&logoColor=white) | ![Python 3.12](https://img.shields.io/badge/Python-3.12-3776AB?logo=python&logoColor=white) | ![Python 3.13](https://img.shields.io/badge/Python-3.13-3776AB?logo=python&logoColor=white) | ![Python 3.14](https://img.shields.io/badge/Python-3.14-3776AB?logo=python&logoColor=white) |
45
+ |--- | --- | --- | --- | --- |
46
+ | Passing ✔ | Passing ✔ | Passing ✔ | Passing ✔ | Passing ✔ |
47
+
48
+ ## Features
49
+
50
+ - **Type description**: Python-native type labels for error messages (`NoneType`, `dict`, `tuple`, built-ins, lists)
51
+ - **Random sequences**: Generate numeric, alphabetic, or alphanumeric sequences of any length
52
+ - **Zero dependencies**: No external runtime packages required
53
+
54
+ ## Installation
55
+
56
+ ```bash
57
+ $ pip install lacus.utils
58
+ ```
59
+
60
+ ## Import
61
+
62
+ ```python
63
+ from lacus.utils import describe_type, generate_random_sequence, SequenceType
64
+ ```
65
+
66
+ ## Quick Start
67
+
68
+ ```python
69
+ describe_type(None) # 'NoneType'
70
+ describe_type("hello") # 'string'
71
+ describe_type(42) # 'integer number'
72
+ describe_type(3.14) # 'float number'
73
+ describe_type(float("nan")) # 'NaN'
74
+ describe_type({}) # 'dict'
75
+ describe_type([1, 2, 3]) # 'number[]'
76
+ describe_type([1, "a", 2]) # '(number | string)[]'
77
+ describe_type((1, 2)) # 'number tuple'
78
+
79
+ generate_random_sequence(10, "numeric") # e.g. '9956000611'
80
+ generate_random_sequence(6, "alphabetic") # e.g. 'AXQMZB'
81
+ generate_random_sequence(8, "alphanumeric") # e.g. '8ZFB2K09'
82
+ ```
83
+
84
+ ## API
85
+
86
+ All functions are implemented in [`src/lacus/utils/`](src/lacus/utils/) and covered by tests in [`tests/`](tests/).
87
+
88
+ ### `describe_type(value) -> str`
89
+
90
+ Describes the type of a value for error messages.
91
+
92
+ | Input | Result |
93
+ |--------|--------|
94
+ | `None` | `'NoneType'` |
95
+ | `str` | `'string'` |
96
+ | `bool` | `'boolean'` |
97
+ | `int` | `'integer number'` |
98
+ | `float` (finite) | `'float number'` |
99
+ | `float('nan')` | `'NaN'` |
100
+ | `float('inf')` / `float('-inf')` | `'Infinity'` |
101
+ | `complex` | `'complex number'` |
102
+ | `dict` | `'dict'` |
103
+ | `set` / `frozenset` | `'set'` / `'frozenset'` |
104
+ | `bytes` / `bytearray` | `'bytes'` / `'bytearray'` |
105
+ | callable | `'function'` |
106
+ | class (`int`, `str`, …) | `'type'` |
107
+ | custom class instance | `'object'` |
108
+ | `[]` | `'Array (empty)'` |
109
+ | `[1, 2, 3]` | `'number[]'` |
110
+ | `[1, 'a', 2]` | `'(number | string)[]'` |
111
+ | `()` | `'tuple (empty)'` |
112
+ | `(1, 2)` | `'number tuple'` |
113
+
114
+ ### `generate_random_sequence(size: int, sequence_type: SequenceType) -> str`
115
+
116
+ Generates a random character sequence of the given length and type.
117
+
118
+ - **`size`**: Length of the sequence (e.g. `10`).
119
+ - **`sequence_type`**: One of:
120
+ - **`'numeric'`**: digits `0-9`
121
+ - **`'alphabetic'`**: uppercase letters `A-Z`
122
+ - **`'alphanumeric'`**: digits and uppercase letters `0-9A-Z`
123
+
124
+ ### Exports summary
125
+
126
+ | Export | Description |
127
+ |--------|-------------|
128
+ | `describe_type` | Type description for error messages |
129
+ | `generate_random_sequence` | Random sequence generation |
130
+ | `SequenceType` | Literal type: `'alphabetic' \| 'alphanumeric' \| 'numeric'` |
131
+
132
+ ## Contribution & Support
133
+
134
+ We welcome contributions! Please see our [Contributing Guidelines](https://github.com/LacusSolutions/br-utils-py/blob/main/CONTRIBUTING.md) for details. If you find this project helpful, please consider:
135
+
136
+ - Starring the repository
137
+ - Contributing to the codebase
138
+ - [Suggesting new features](https://github.com/LacusSolutions/br-utils-py/issues)
139
+ - [Reporting bugs](https://github.com/LacusSolutions/br-utils-py/issues)
140
+
141
+ ## License
142
+
143
+ This project is licensed under the MIT License - see the [LICENSE](https://github.com/LacusSolutions/br-utils-py/blob/main/LICENSE) file for details.
144
+
145
+ ## Changelog
146
+
147
+ See [CHANGELOG](./CHANGELOG.md) for a list of changes and version history.
148
+
149
+ ---
150
+
151
+ Made with ❤️ by [Lacus Solutions](https://github.com/LacusSolutions)
@@ -0,0 +1,11 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/lacus.utils.egg-info/PKG-INFO
5
+ src/lacus.utils.egg-info/SOURCES.txt
6
+ src/lacus.utils.egg-info/dependency_links.txt
7
+ src/lacus.utils.egg-info/top_level.txt
8
+ src/lacus/utils/__init__.py
9
+ src/lacus/utils/describe_type.py
10
+ src/lacus/utils/generate_random_sequence.py
11
+ src/lacus/utils/types.py