chromatic-python 0.1.0__tar.gz → 0.1.1__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.
- chromatic_python-0.1.1/.gitattributes +1 -0
- chromatic_python-0.1.1/.gitignore +11 -0
- {chromatic_python-0.1.0 → chromatic_python-0.1.1}/PKG-INFO +18 -1
- chromatic_python-0.1.1/README.md +16 -0
- {chromatic_python-0.1.0 → chromatic_python-0.1.1}/chromatic/__init__.py +16 -3
- {chromatic_python-0.1.0 → chromatic_python-0.1.1}/chromatic/_typing.py +37 -18
- chromatic_python-0.1.1/chromatic/_version.py +16 -0
- {chromatic_python-0.1.0 → chromatic_python-0.1.1}/chromatic/ascii/_array.py +458 -277
- {chromatic_python-0.1.0 → chromatic_python-0.1.1}/chromatic/ascii/_curses.py +38 -47
- {chromatic_python-0.1.0 → chromatic_python-0.1.1}/chromatic/ascii/_glyph_proc.py +30 -39
- {chromatic_python-0.1.0 → chromatic_python-0.1.1}/chromatic/color/colorconv.py +24 -16
- {chromatic_python-0.1.0 → chromatic_python-0.1.1}/chromatic/color/core.py +291 -206
- {chromatic_python-0.1.0 → chromatic_python-0.1.1}/chromatic/color/core.pyi +361 -421
- {chromatic_python-0.1.0 → chromatic_python-0.1.1}/chromatic/color/palette.py +121 -98
- {chromatic_python-0.1.0 → chromatic_python-0.1.1}/chromatic/color/palette.pyi +13 -48
- {chromatic_python-0.1.0 → chromatic_python-0.1.1}/chromatic/data/__init__.py +46 -37
- {chromatic_python-0.1.0 → chromatic_python-0.1.1}/chromatic/demo.py +89 -110
- {chromatic_python-0.1.0 → chromatic_python-0.1.1}/chromatic_python.egg-info/PKG-INFO +18 -1
- {chromatic_python-0.1.0 → chromatic_python-0.1.1}/chromatic_python.egg-info/SOURCES.txt +4 -21
- {chromatic_python-0.1.0 → chromatic_python-0.1.1}/pyproject.toml +9 -5
- {chromatic_python-0.1.0 → chromatic_python-0.1.1}/LICENSE +0 -0
- {chromatic_python-0.1.0 → chromatic_python-0.1.1}/chromatic/ascii/__init__.py +0 -0
- {chromatic_python-0.1.0 → chromatic_python-0.1.1}/chromatic/color/__init__.py +0 -0
- {chromatic_python-0.1.0 → chromatic_python-0.1.1}/chromatic/data/__init__.pyi +0 -0
- {chromatic_python-0.1.0 → chromatic_python-0.1.1}/chromatic/data/fonts/IBM_VGA_437_8x16.ttf +0 -0
- {chromatic_python-0.1.0 → chromatic_python-0.1.1}/chromatic/data/fonts/consolas.ttf +0 -0
- {chromatic_python-0.1.0 → chromatic_python-0.1.1}/chromatic/data/images/butterfly.jpg +0 -0
- {chromatic_python-0.1.0 → chromatic_python-0.1.1}/chromatic/data/images/escher.png +0 -0
- {chromatic_python-0.1.0 → chromatic_python-0.1.1}/chromatic/data/images/goblin_virus.png +0 -0
- {chromatic_python-0.1.0 → chromatic_python-0.1.1}/chromatic/data/images/hotdog.jpg +0 -0
- {chromatic_python-0.1.0 → chromatic_python-0.1.1}/chromatic_python.egg-info/dependency_links.txt +0 -0
- {chromatic_python-0.1.0 → chromatic_python-0.1.1}/chromatic_python.egg-info/requires.txt +0 -0
- {chromatic_python-0.1.0 → chromatic_python-0.1.1}/chromatic_python.egg-info/top_level.txt +0 -0
- {chromatic_python-0.1.0 → chromatic_python-0.1.1}/setup.cfg +0 -0
- /chromatic_python-0.1.0/README.md → /chromatic_python-0.1.1/tests/__init__.py +0 -0
- {chromatic_python-0.1.0 → chromatic_python-0.1.1}/tests/test_color_str.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* text=auto
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: chromatic-python
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: ANSI art image processing and colored terminal text
|
|
5
5
|
Author: crypt0lith
|
|
6
6
|
License: MIT License
|
|
@@ -37,3 +37,20 @@ Requires-Dist: pillow~=10.4.0
|
|
|
37
37
|
Requires-Dist: scikit-image~=0.25.0rc1
|
|
38
38
|
Requires-Dist: scikit-learn~=1.5.2
|
|
39
39
|
Requires-Dist: scipy~=1.14.1
|
|
40
|
+
|
|
41
|
+
# chromatic-python
|
|
42
|
+
---
|
|
43
|
+
🚧 docs currently under construction 🚧
|
|
44
|
+
|
|
45
|
+
### Installation
|
|
46
|
+
---
|
|
47
|
+
Install the package using `pip`:
|
|
48
|
+
```bash
|
|
49
|
+
pip install chromatic-python
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Confirm `chromatic` installed correctly:
|
|
53
|
+
```pycon
|
|
54
|
+
python -c "import chromatic; print chromatic.__version__"
|
|
55
|
+
0.1.0
|
|
56
|
+
```
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# chromatic-python
|
|
2
|
+
---
|
|
3
|
+
🚧 docs currently under construction 🚧
|
|
4
|
+
|
|
5
|
+
### Installation
|
|
6
|
+
---
|
|
7
|
+
Install the package using `pip`:
|
|
8
|
+
```bash
|
|
9
|
+
pip install chromatic-python
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Confirm `chromatic` installed correctly:
|
|
13
|
+
```pycon
|
|
14
|
+
python -c "import chromatic; print chromatic.__version__"
|
|
15
|
+
0.1.0
|
|
16
|
+
```
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
try:
|
|
2
|
+
from ._version import version as __version__
|
|
3
|
+
except ImportError:
|
|
4
|
+
__version__ = "0.0.0"
|
|
5
|
+
|
|
1
6
|
from . import ascii, color, data
|
|
2
7
|
from .ascii import (
|
|
3
8
|
ansi2img,
|
|
@@ -14,12 +19,20 @@ from .ascii import (
|
|
|
14
19
|
read_ans,
|
|
15
20
|
render_ans,
|
|
16
21
|
reshape_ansi,
|
|
17
|
-
to_sgr_array
|
|
22
|
+
to_sgr_array,
|
|
18
23
|
)
|
|
19
24
|
from .ascii._glyph_proc import get_glyph_masks
|
|
20
25
|
from .color import (
|
|
21
|
-
ansicolor24Bit,
|
|
22
|
-
|
|
26
|
+
ansicolor24Bit,
|
|
27
|
+
ansicolor4Bit,
|
|
28
|
+
ansicolor8Bit,
|
|
29
|
+
Back,
|
|
30
|
+
Color,
|
|
31
|
+
colorbytes,
|
|
32
|
+
ColorStr,
|
|
33
|
+
Fore,
|
|
34
|
+
SgrParameter,
|
|
35
|
+
Style,
|
|
23
36
|
)
|
|
24
37
|
from .data import register_user_font
|
|
25
38
|
|
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
from collections.abc import Mapping
|
|
4
3
|
from functools import reduce
|
|
5
4
|
from numbers import Number
|
|
6
5
|
from types import UnionType
|
|
7
6
|
from typing import (
|
|
8
|
-
Any,
|
|
9
|
-
|
|
7
|
+
Any,
|
|
8
|
+
Callable,
|
|
9
|
+
Concatenate,
|
|
10
|
+
get_args,
|
|
11
|
+
get_origin,
|
|
12
|
+
get_type_hints,
|
|
13
|
+
Iterable,
|
|
14
|
+
Literal,
|
|
15
|
+
ParamSpec,
|
|
16
|
+
Protocol,
|
|
17
|
+
Sequence,
|
|
18
|
+
SupportsRound,
|
|
19
|
+
TYPE_CHECKING,
|
|
20
|
+
TypeVar,
|
|
21
|
+
Union,
|
|
10
22
|
)
|
|
11
23
|
|
|
12
24
|
from numpy import dtype, float64, generic, ndarray, number, uint8
|
|
@@ -25,17 +37,18 @@ _AnyNumber_co = TypeVar('_AnyNumber_co', number, Number, covariant=True)
|
|
|
25
37
|
if TYPE_CHECKING:
|
|
26
38
|
from _typeshed import SupportsRichComparison, SupportsDivMod
|
|
27
39
|
|
|
28
|
-
|
|
29
40
|
class SupportsRoundAndDivMod(
|
|
30
|
-
SupportsRound[_T_co],
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
):
|
|
34
|
-
...
|
|
41
|
+
SupportsRound[_T_co], SupportsDivMod[Any, _T_co], Protocol
|
|
42
|
+
): ...
|
|
43
|
+
|
|
35
44
|
|
|
36
|
-
type ArrayReducerFunc[_SCT: generic] = Callable[
|
|
45
|
+
type ArrayReducerFunc[_SCT: generic] = Callable[
|
|
46
|
+
Concatenate[_ArrayLike[_SCT], _P], NDArray[_SCT]
|
|
47
|
+
]
|
|
37
48
|
type KeyFunction[_T] = Callable[[_T], SupportsRichComparison]
|
|
38
|
-
type ShapedNDArray[_Shape: tuple[int, ...], _SCT: generic] = ndarray[
|
|
49
|
+
type ShapedNDArray[_Shape: tuple[int, ...], _SCT: generic] = ndarray[
|
|
50
|
+
_Shape, dtype[_SCT]
|
|
51
|
+
]
|
|
39
52
|
type MatrixLike[_SCT: generic] = ShapedNDArray[TupleOf2[int], _SCT]
|
|
40
53
|
type SquareMatrix[_I: int, _SCT: generic] = ShapedNDArray[TupleOf2[_I], _SCT]
|
|
41
54
|
type GlyphArray[_SCT: generic] = SquareMatrix[Literal[24], _SCT]
|
|
@@ -73,7 +86,9 @@ def is_matching_type(value, typ):
|
|
|
73
86
|
elif isinstance(typ, TypeVar):
|
|
74
87
|
if typ.__constraints__:
|
|
75
88
|
return any(
|
|
76
|
-
is_matching_type(value, constraint)
|
|
89
|
+
is_matching_type(value, constraint)
|
|
90
|
+
for constraint in typ.__constraints__
|
|
91
|
+
)
|
|
77
92
|
else:
|
|
78
93
|
return True
|
|
79
94
|
elif origin is type:
|
|
@@ -101,8 +116,9 @@ def is_matching_type(value, typ):
|
|
|
101
116
|
return True
|
|
102
117
|
key_type, val_type = args
|
|
103
118
|
return all(
|
|
104
|
-
is_matching_type(k, key_type) and is_matching_type(v, val_type)
|
|
105
|
-
value.items()
|
|
119
|
+
is_matching_type(k, key_type) and is_matching_type(v, val_type)
|
|
120
|
+
for k, v in value.items()
|
|
121
|
+
)
|
|
106
122
|
elif origin is tuple:
|
|
107
123
|
if not isinstance(value, tuple):
|
|
108
124
|
return False
|
|
@@ -139,8 +155,11 @@ def type_error_msg(err_obj, *expected, context: str = '', obj_repr=False):
|
|
|
139
155
|
name_slots = [f"{{{n}.__qualname__!r}}" for n in range(n_expected)]
|
|
140
156
|
if name_slots and n_expected > 1:
|
|
141
157
|
name_slots[-1] = f"or {name_slots[-1]}"
|
|
142
|
-
names = (
|
|
143
|
-
|
|
158
|
+
names = (
|
|
159
|
+
(', ' if n_expected > 2 else ' ')
|
|
160
|
+
.join([context.strip()] + name_slots)
|
|
161
|
+
.format(*expected)
|
|
162
|
+
)
|
|
144
163
|
if not obj_repr:
|
|
145
164
|
if not isinstance(err_obj, type):
|
|
146
165
|
err_obj = type(err_obj)
|
|
@@ -163,6 +182,6 @@ def is_matching_typed_dict(__d: dict, typed_dict: type[dict]) -> tuple[bool, str
|
|
|
163
182
|
for name, typ in expected.items():
|
|
164
183
|
if ((field := __d.get(name)) is not None) and not is_matching_type(field, typ):
|
|
165
184
|
return False, type_error_msg(
|
|
166
|
-
field, typ,
|
|
167
|
-
|
|
185
|
+
field, typ, context=f'keyword argument {name!r} of type'
|
|
186
|
+
)
|
|
168
187
|
return True, ''
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# file generated by setuptools_scm
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
TYPE_CHECKING = False
|
|
4
|
+
if TYPE_CHECKING:
|
|
5
|
+
from typing import Tuple, Union
|
|
6
|
+
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
7
|
+
else:
|
|
8
|
+
VERSION_TUPLE = object
|
|
9
|
+
|
|
10
|
+
version: str
|
|
11
|
+
__version__: str
|
|
12
|
+
__version_tuple__: VERSION_TUPLE
|
|
13
|
+
version_tuple: VERSION_TUPLE
|
|
14
|
+
|
|
15
|
+
__version__ = version = '0.1.1'
|
|
16
|
+
__version_tuple__ = version_tuple = (0, 1, 1)
|