typio 0.1__py3-none-any.whl → 0.2__py3-none-any.whl
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.
- typio/__init__.py +1 -0
- typio/errors.py +1 -1
- typio/functions.py +15 -7
- typio/params.py +3 -2
- {typio-0.1.dist-info → typio-0.2.dist-info}/METADATA +21 -5
- typio-0.2.dist-info/RECORD +11 -0
- {typio-0.1.dist-info → typio-0.2.dist-info}/licenses/AUTHORS.md +1 -1
- typio-0.1.dist-info/RECORD +0 -11
- {typio-0.1.dist-info → typio-0.2.dist-info}/WHEEL +0 -0
- {typio-0.1.dist-info → typio-0.2.dist-info}/licenses/LICENSE +0 -0
- {typio-0.1.dist-info → typio-0.2.dist-info}/top_level.txt +0 -0
typio/__init__.py
CHANGED
typio/errors.py
CHANGED
typio/functions.py
CHANGED
|
@@ -11,6 +11,7 @@ from typing import Any, Callable, Optional
|
|
|
11
11
|
from .params import TypeMode
|
|
12
12
|
from .params import INVALID_TEXT_ERROR, INVALID_BYTE_ERROR, INVALID_DELAY_ERROR
|
|
13
13
|
from .params import INVALID_JITTER_ERROR, INVALID_MODE_ERROR, INVALID_FILE_ERROR
|
|
14
|
+
from .params import INVALID_END_ERROR
|
|
14
15
|
from .errors import TypioError
|
|
15
16
|
|
|
16
17
|
|
|
@@ -19,6 +20,7 @@ def _validate(
|
|
|
19
20
|
delay: Any,
|
|
20
21
|
jitter: Any,
|
|
21
22
|
mode: Any,
|
|
23
|
+
end: Any,
|
|
22
24
|
file: Any,
|
|
23
25
|
) -> str:
|
|
24
26
|
"""
|
|
@@ -28,6 +30,7 @@ def _validate(
|
|
|
28
30
|
:param delay: base delay (in seconds) between emitted units
|
|
29
31
|
:param jitter: random jitter added/subtracted from delay
|
|
30
32
|
:param mode: typing mode controlling emission granularity
|
|
33
|
+
:param end: end character(s)
|
|
31
34
|
:param file: output stream supporting a write() method
|
|
32
35
|
"""
|
|
33
36
|
if not isinstance(text, (str, bytes)):
|
|
@@ -48,9 +51,12 @@ def _validate(
|
|
|
48
51
|
if not isinstance(mode, TypeMode):
|
|
49
52
|
raise TypioError(INVALID_MODE_ERROR)
|
|
50
53
|
|
|
54
|
+
if not isinstance(end, str):
|
|
55
|
+
raise TypioError(INVALID_END_ERROR)
|
|
56
|
+
|
|
51
57
|
if file is not None and not hasattr(file, "write"):
|
|
52
58
|
raise TypioError(INVALID_FILE_ERROR)
|
|
53
|
-
|
|
59
|
+
text = f"{text}{end}"
|
|
54
60
|
return text
|
|
55
61
|
|
|
56
62
|
|
|
@@ -179,18 +185,20 @@ def type_print(
|
|
|
179
185
|
*,
|
|
180
186
|
delay: float = 0.04,
|
|
181
187
|
jitter: float = 0,
|
|
188
|
+
end: str = "\n",
|
|
182
189
|
mode: TypeMode = TypeMode.CHAR,
|
|
183
|
-
file: Optional[TextIOBase] = None):
|
|
190
|
+
file: Optional[TextIOBase] = None) -> None:
|
|
184
191
|
"""
|
|
185
192
|
Print text with typing effects.
|
|
186
193
|
|
|
187
194
|
:param text: text to be printed
|
|
188
195
|
:param delay: base delay (in seconds) between emitted units
|
|
189
196
|
:param jitter: random jitter added/subtracted from delay
|
|
197
|
+
:param end: end character(s)
|
|
190
198
|
:param mode: typing mode controlling emission granularity
|
|
191
199
|
:param file: output stream supporting a write() method
|
|
192
200
|
"""
|
|
193
|
-
text = _validate(text, delay, jitter, mode, file)
|
|
201
|
+
text = _validate(text, delay, jitter, mode, end, file)
|
|
194
202
|
out = file or sys.stdout
|
|
195
203
|
|
|
196
204
|
printer = _TypioPrinter(
|
|
@@ -204,9 +212,9 @@ def type_print(
|
|
|
204
212
|
|
|
205
213
|
|
|
206
214
|
def typestyle(
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
215
|
+
*,
|
|
216
|
+
delay: float = 0.04,
|
|
217
|
+
jitter: float = 0,
|
|
210
218
|
mode: TypeMode = TypeMode.CHAR) -> Callable:
|
|
211
219
|
"""
|
|
212
220
|
Apply typing effects to all print() calls inside the decorated function.
|
|
@@ -215,7 +223,7 @@ def typestyle(
|
|
|
215
223
|
:param jitter: random jitter added/subtracted from delay
|
|
216
224
|
:param mode: typing mode controlling emission granularity
|
|
217
225
|
"""
|
|
218
|
-
_validate("", delay, jitter, mode, sys.stdout)
|
|
226
|
+
_validate("", delay, jitter, mode, "", sys.stdout)
|
|
219
227
|
|
|
220
228
|
def decorator(func: Callable) -> Callable:
|
|
221
229
|
@wraps(func)
|
typio/params.py
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
"""typio params."""
|
|
3
3
|
from enum import Enum
|
|
4
4
|
|
|
5
|
-
TYPIO_VERSION = "0.
|
|
5
|
+
TYPIO_VERSION = "0.2"
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class TypeMode(Enum):
|
|
9
9
|
"""Type mode enum."""
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
CHAR = "char"
|
|
12
12
|
WORD = "word"
|
|
13
13
|
LINE = "line"
|
|
@@ -21,4 +21,5 @@ INVALID_BYTE_ERROR = "bytes text must be UTF-8 decodable."
|
|
|
21
21
|
INVALID_DELAY_ERROR = "`delay` must be a non-negative number."
|
|
22
22
|
INVALID_JITTER_ERROR = "`jitter` must be a non-negative number."
|
|
23
23
|
INVALID_MODE_ERROR = "`mode` must be a TypeMode enum value."
|
|
24
|
+
INVALID_END_ERROR = "`end` must be a str."
|
|
24
25
|
INVALID_FILE_ERROR = "`file` must be a file-like object."
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: typio
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2
|
|
4
4
|
Summary: Typio: Make Your Terminal Type Like a Human
|
|
5
5
|
Home-page: https://github.com/sepandhaghighi/typio
|
|
6
|
-
Download-URL: https://github.com/sepandhaghighi/typio/tarball/v0.
|
|
6
|
+
Download-URL: https://github.com/sepandhaghighi/typio/tarball/v0.2
|
|
7
7
|
Author: Sepand Haghighi
|
|
8
8
|
Author-email: me@sepand.tech
|
|
9
9
|
License: MIT
|
|
@@ -53,6 +53,7 @@ Dynamic: summary
|
|
|
53
53
|
<a href="https://www.python.org/"><img src="https://img.shields.io/badge/built%20with-Python3-green.svg" alt="built with Python3"></a>
|
|
54
54
|
<a href="https://github.com/sepandhaghighi/typio"><img alt="GitHub repo size" src="https://img.shields.io/github/repo-size/sepandhaghighi/typio"></a>
|
|
55
55
|
<a href="https://badge.fury.io/py/typio"><img src="https://badge.fury.io/py/typio.svg" alt="PyPI version"></a>
|
|
56
|
+
<a href="https://codecov.io/gh/sepandhaghighi/typio"><img src="https://codecov.io/gh/sepandhaghighi/typio/graph/badge.svg?token=UPhwanwQVw"></a>
|
|
56
57
|
</div>
|
|
57
58
|
|
|
58
59
|
## Overview
|
|
@@ -87,16 +88,24 @@ Typio is a lightweight Python library that prints text to the terminal as if it
|
|
|
87
88
|
</tr>
|
|
88
89
|
</table>
|
|
89
90
|
|
|
91
|
+
<table>
|
|
92
|
+
<tr>
|
|
93
|
+
<td align="center">Code Quality</td>
|
|
94
|
+
<td align="center"><a href="https://www.codefactor.io/repository/github/sepandhaghighi/typio"><img src="https://www.codefactor.io/repository/github/sepandhaghighi/typio/badge" alt="CodeFactor"></a></td>
|
|
95
|
+
<td align="center"><a href="https://app.codacy.com/gh/sepandhaghighi/typio/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade"><img src="https://app.codacy.com/project/badge/Grade/e047db39052a4be2859f299dd7f7ce3c"></a></td>
|
|
96
|
+
</tr>
|
|
97
|
+
</table>
|
|
98
|
+
|
|
90
99
|
## Installation
|
|
91
100
|
|
|
92
101
|
### Source Code
|
|
93
|
-
- Download [Version 0.
|
|
102
|
+
- Download [Version 0.2](https://github.com/sepandhaghighi/typio/archive/v0.2.zip) or [Latest Source](https://github.com/sepandhaghighi/typio/archive/dev.zip)
|
|
94
103
|
- `pip install .`
|
|
95
104
|
|
|
96
105
|
### PyPI
|
|
97
106
|
|
|
98
107
|
- Check [Python Packaging User Guide](https://packaging.python.org/installing/)
|
|
99
|
-
- `pip install typio==0.
|
|
108
|
+
- `pip install typio==0.2`
|
|
100
109
|
|
|
101
110
|
|
|
102
111
|
## Usage
|
|
@@ -115,6 +124,7 @@ type_print(
|
|
|
115
124
|
"Typing with style and personality.",
|
|
116
125
|
delay=0.06,
|
|
117
126
|
jitter=0.02,
|
|
127
|
+
end="\n",
|
|
118
128
|
mode=TypeMode.ADAPTIVE,
|
|
119
129
|
)
|
|
120
130
|
```
|
|
@@ -191,6 +201,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
|
191
201
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
192
202
|
|
|
193
203
|
## [Unreleased]
|
|
204
|
+
## [0.2] - 2026-02-04
|
|
205
|
+
### Changed
|
|
206
|
+
- `README.md` updated
|
|
207
|
+
- `end` parameter added to `type_print` function
|
|
208
|
+
- Test system modified
|
|
194
209
|
## [0.1] - 2026-01-31
|
|
195
210
|
### Added
|
|
196
211
|
- `type_print` function
|
|
@@ -202,7 +217,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
202
217
|
- `TYPEWRITER` mode
|
|
203
218
|
- `ADAPTIVE` mode
|
|
204
219
|
|
|
205
|
-
[Unreleased]: https://github.com/sepandhaghighi/typio/compare/v0.
|
|
220
|
+
[Unreleased]: https://github.com/sepandhaghighi/typio/compare/v0.2...dev
|
|
221
|
+
[0.2]: https://github.com/sepandhaghighi/typio/compare/v0.1...v0.2
|
|
206
222
|
[0.1]: https://github.com/sepandhaghighi/typio/compare/750c00e...v0.1
|
|
207
223
|
|
|
208
224
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
typio/__init__.py,sha256=46OPTYQECaKgTjmo4UfK7VmgsNjcE5K2zM3QC8LmOWA,258
|
|
2
|
+
typio/__main__.py,sha256=NXst2kL-xGtI3tNIxh-H3AOL3vyn8SPiR96fER5oxfE,79
|
|
3
|
+
typio/errors.py,sha256=IC6YD8cW6bVc1f_4DlaIm_TlSgiTw292IeY8_ZO1Fwo,127
|
|
4
|
+
typio/functions.py,sha256=IrdRPc3cGOQtkci_wiI9Z8ShaIk0arFmFcw8YOcSoR4,6950
|
|
5
|
+
typio/params.py,sha256=d5w4oVZZKfAF1nEzUsvsqHYOObquFKfP72eoCuLCArY,679
|
|
6
|
+
typio-0.2.dist-info/licenses/AUTHORS.md,sha256=IONT1m3fc49glmYk5CbN70OMYCArB_2E5gXVb-PETKg,181
|
|
7
|
+
typio-0.2.dist-info/licenses/LICENSE,sha256=-eYKcwcJYZNHlmW-GcaTyv0U2goVRxkTf9rH095_EI0,1072
|
|
8
|
+
typio-0.2.dist-info/METADATA,sha256=4sgCWHL5lERQVe4qXSqH_aEHB6vH3tfNxkWE2YQZXGc,7423
|
|
9
|
+
typio-0.2.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
10
|
+
typio-0.2.dist-info/top_level.txt,sha256=Dp5VGIrBg-Gmk8fSWVXKSpwl-Dltacd0Q4dEoIzcReY,6
|
|
11
|
+
typio-0.2.dist-info/RECORD,,
|
typio-0.1.dist-info/RECORD
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
typio/__init__.py,sha256=zQwcPifBXaJ-KfZH0xsaWc8yiBYDWLwDi03yma5e2-g,194
|
|
2
|
-
typio/__main__.py,sha256=NXst2kL-xGtI3tNIxh-H3AOL3vyn8SPiR96fER5oxfE,79
|
|
3
|
-
typio/errors.py,sha256=NQbqfcRb4x-7MATeu6gWBqhJyrw5wrRri8eZwO4R6-M,131
|
|
4
|
-
typio/functions.py,sha256=xCu9UH7sYYhYqEtRUH5ksL1GAdLUGpe2VjzwpDc40ak,6675
|
|
5
|
-
typio/params.py,sha256=fxbtHgyHq9IhKwqGVdQl9hNE6tqhIGMJwP4y8OqG4rE,640
|
|
6
|
-
typio-0.1.dist-info/licenses/AUTHORS.md,sha256=MpV5Y8EC8ZhJuALpwydW5BkmpRvxjxFopEHWdyjJ1Q8,181
|
|
7
|
-
typio-0.1.dist-info/licenses/LICENSE,sha256=-eYKcwcJYZNHlmW-GcaTyv0U2goVRxkTf9rH095_EI0,1072
|
|
8
|
-
typio-0.1.dist-info/METADATA,sha256=_Vp8vKhRBhSR_5xtL5MeZ5iT1DNBsKz0Dy3l-m42u1w,6515
|
|
9
|
-
typio-0.1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
10
|
-
typio-0.1.dist-info/top_level.txt,sha256=Dp5VGIrBg-Gmk8fSWVXKSpwl-Dltacd0Q4dEoIzcReY,6
|
|
11
|
-
typio-0.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|