chromatic-python 0.9.1__tar.gz → 0.9.3__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.9.1 → chromatic_python-0.9.3}/PKG-INFO +1 -1
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/__main__.py +11 -3
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/_version.py +3 -3
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/color/core.py +15 -27
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic_python.egg-info/PKG-INFO +1 -1
- chromatic_python-0.9.3/chromatic_python.egg-info/scm_version.json +8 -0
- chromatic_python-0.9.1/chromatic_python.egg-info/scm_version.json +0 -8
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/.gitattributes +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/.github/dependabot.yml +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/.github/workflows/build.yml +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/.github/workflows/docs.yml +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/.github/workflows/release.yml +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/.gitignore +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/LICENSE +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/README.md +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/banner.png +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/__init__.py +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/__init__.pyi +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/_typing.py +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/color/__init__.py +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/color/__init__.pyi +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/color/colorconv.py +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/color/colorconv.pyi +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/color/core.pyi +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/color/palette.py +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/color/palette.pyi +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/data/__init__.py +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/data/fonts/userfont.schema.json +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/data/fonts/vga437.ttf +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/data/userfont.py +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/data/userfont.pyi +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/image/__init__.py +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/image/__init__.pyi +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/image/_array.py +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/image/_curses.py +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/image/_glyph.py +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic_python.egg-info/SOURCES.txt +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic_python.egg-info/dependency_links.txt +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic_python.egg-info/entry_points.txt +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic_python.egg-info/requires.txt +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic_python.egg-info/scm_file_list.json +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic_python.egg-info/top_level.txt +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/docs/api/chromatic.md +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/docs/api/color.md +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/docs/api/data.md +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/docs/api/image.md +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/docs/cli/index.md +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/docs/index.md +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/mkdocs.yml +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/mkdocs_hooks.py +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/pyproject.toml +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/setup.cfg +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/tests/__init__.py +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/tests/test_color_chain.py +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/tests/test_colorconv.py +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/tests/test_colorstr.py +0 -0
- {chromatic_python-0.9.1 → chromatic_python-0.9.3}/tests/test_image.py +0 -0
|
@@ -580,8 +580,10 @@ def Parser(prog=None):
|
|
|
580
580
|
return top_parser
|
|
581
581
|
|
|
582
582
|
|
|
583
|
-
def parse_args(
|
|
584
|
-
|
|
583
|
+
def parse_args(
|
|
584
|
+
args: tp.Optional[abc.Iterable[str]] = None, prog: tp.Optional[str] = None
|
|
585
|
+
):
|
|
586
|
+
return Parser(prog).parse_args(args)
|
|
585
587
|
|
|
586
588
|
|
|
587
589
|
def _call_from_ns[R](f: abc.Callable[..., R], /, ns, **kwargs) -> R:
|
|
@@ -655,10 +657,11 @@ def handle_image(ns):
|
|
|
655
657
|
params = {}
|
|
656
658
|
if is_anim := arr.ndim == 3:
|
|
657
659
|
params.update(save_all=True)
|
|
660
|
+
isatty = False
|
|
658
661
|
if hasattr(ns, "dumpfile"):
|
|
659
662
|
from .color.core import color_chain
|
|
660
663
|
|
|
661
|
-
if
|
|
664
|
+
if (isatty := ns.dumpfile.isatty()) and is_anim:
|
|
662
665
|
|
|
663
666
|
def anim_loop(n: int | None, duration: int | float):
|
|
664
667
|
from time import sleep
|
|
@@ -691,6 +694,11 @@ def handle_image(ns):
|
|
|
691
694
|
ns.dumpfile.write(f"{cc}\x1b[0m\n".encode())
|
|
692
695
|
if img is None:
|
|
693
696
|
return
|
|
697
|
+
if not hasattr(ns, "outfile_callback"):
|
|
698
|
+
show = getattr(ns, "show", None)
|
|
699
|
+
if show is True or not (show is False or isatty):
|
|
700
|
+
return img.show()
|
|
701
|
+
return
|
|
694
702
|
try:
|
|
695
703
|
outpath = ns.outfile_callback(ns, img, **params)
|
|
696
704
|
except Exception as e:
|
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '0.9.
|
|
22
|
-
__version_tuple__ = version_tuple = (0, 9,
|
|
21
|
+
__version__ = version = '0.9.3'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 9, 3)
|
|
23
23
|
|
|
24
|
-
__commit_id__ = commit_id = '
|
|
24
|
+
__commit_id__ = commit_id = 'g7bc8f9551'
|
|
@@ -676,35 +676,23 @@ class SgrParamBuffer[_T]:
|
|
|
676
676
|
|
|
677
677
|
@ft.lru_cache
|
|
678
678
|
def _get_sgr_nums(x: bytes, /) -> list[int]:
|
|
679
|
-
"""Return a list of integers from a bytestring of ANSI SGR parameters.
|
|
680
|
-
|
|
681
|
-
Notes
|
|
682
|
-
-----
|
|
683
|
-
Roughly, bitwise equivalent to ``list(map(int, bytes().split(b';')))``
|
|
684
|
-
|
|
685
|
-
"""
|
|
686
|
-
x = x.removeprefix(CSI)[: i if ~(i := x.find(*b"m")) else None].removesuffix(b"m")
|
|
679
|
+
"""Return a list of integers from a bytestring of ANSI SGR parameters."""
|
|
680
|
+
x = x.removeprefix(CSI).partition(b"m")[0]
|
|
687
681
|
length = len(x)
|
|
688
|
-
|
|
689
|
-
map(
|
|
690
|
-
bool,
|
|
691
|
-
int.to_bytes(
|
|
692
|
-
int.from_bytes(x) ^ int.from_bytes(b";" * length), length=length
|
|
693
|
-
),
|
|
694
|
-
)
|
|
695
|
-
)
|
|
682
|
+
[SEMI] = b";"
|
|
696
683
|
res = []
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
res.append(int(
|
|
707
|
-
|
|
684
|
+
i = j = 0
|
|
685
|
+
while j < length:
|
|
686
|
+
if x[j] == SEMI:
|
|
687
|
+
res.append(int(x[i:j] or 0))
|
|
688
|
+
i = j = j + 1
|
|
689
|
+
else:
|
|
690
|
+
j += 1
|
|
691
|
+
else:
|
|
692
|
+
if xn := x[i:j]:
|
|
693
|
+
res.append(int(xn))
|
|
694
|
+
elif not res:
|
|
695
|
+
res.append(0)
|
|
708
696
|
return res
|
|
709
697
|
|
|
710
698
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic_python.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic_python.egg-info/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|
{chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic_python.egg-info/scm_file_list.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|