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.
Files changed (57) hide show
  1. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/PKG-INFO +1 -1
  2. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/__main__.py +11 -3
  3. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/_version.py +3 -3
  4. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/color/core.py +15 -27
  5. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic_python.egg-info/PKG-INFO +1 -1
  6. chromatic_python-0.9.3/chromatic_python.egg-info/scm_version.json +8 -0
  7. chromatic_python-0.9.1/chromatic_python.egg-info/scm_version.json +0 -8
  8. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/.gitattributes +0 -0
  9. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/.github/dependabot.yml +0 -0
  10. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/.github/workflows/build.yml +0 -0
  11. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/.github/workflows/docs.yml +0 -0
  12. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/.github/workflows/release.yml +0 -0
  13. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/.gitignore +0 -0
  14. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/LICENSE +0 -0
  15. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/README.md +0 -0
  16. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/banner.png +0 -0
  17. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/__init__.py +0 -0
  18. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/__init__.pyi +0 -0
  19. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/_typing.py +0 -0
  20. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/color/__init__.py +0 -0
  21. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/color/__init__.pyi +0 -0
  22. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/color/colorconv.py +0 -0
  23. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/color/colorconv.pyi +0 -0
  24. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/color/core.pyi +0 -0
  25. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/color/palette.py +0 -0
  26. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/color/palette.pyi +0 -0
  27. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/data/__init__.py +0 -0
  28. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/data/fonts/userfont.schema.json +0 -0
  29. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/data/fonts/vga437.ttf +0 -0
  30. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/data/userfont.py +0 -0
  31. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/data/userfont.pyi +0 -0
  32. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/image/__init__.py +0 -0
  33. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/image/__init__.pyi +0 -0
  34. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/image/_array.py +0 -0
  35. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/image/_curses.py +0 -0
  36. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic/image/_glyph.py +0 -0
  37. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic_python.egg-info/SOURCES.txt +0 -0
  38. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic_python.egg-info/dependency_links.txt +0 -0
  39. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic_python.egg-info/entry_points.txt +0 -0
  40. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic_python.egg-info/requires.txt +0 -0
  41. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic_python.egg-info/scm_file_list.json +0 -0
  42. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/chromatic_python.egg-info/top_level.txt +0 -0
  43. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/docs/api/chromatic.md +0 -0
  44. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/docs/api/color.md +0 -0
  45. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/docs/api/data.md +0 -0
  46. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/docs/api/image.md +0 -0
  47. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/docs/cli/index.md +0 -0
  48. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/docs/index.md +0 -0
  49. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/mkdocs.yml +0 -0
  50. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/mkdocs_hooks.py +0 -0
  51. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/pyproject.toml +0 -0
  52. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/setup.cfg +0 -0
  53. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/tests/__init__.py +0 -0
  54. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/tests/test_color_chain.py +0 -0
  55. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/tests/test_colorconv.py +0 -0
  56. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/tests/test_colorstr.py +0 -0
  57. {chromatic_python-0.9.1 → chromatic_python-0.9.3}/tests/test_image.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chromatic-python
3
- Version: 0.9.1
3
+ Version: 0.9.3
4
4
  Summary: ANSI art image processing and colored terminal text
5
5
  Author: crypt0lith
6
6
  License-Expression: MIT
@@ -580,8 +580,10 @@ def Parser(prog=None):
580
580
  return top_parser
581
581
 
582
582
 
583
- def parse_args(argv=None):
584
- return Parser(os.path.basename((argv or sys.argv)[0])).parse_args(argv)
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 is_anim and ns.dumpfile.isatty():
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.1'
22
- __version_tuple__ = version_tuple = (0, 9, 1)
21
+ __version__ = version = '0.9.3'
22
+ __version_tuple__ = version_tuple = (0, 9, 3)
23
23
 
24
- __commit_id__ = commit_id = 'g281bef66b'
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
- mask_indices = enumerate(
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
- digits = bytearray()
698
- for i, is_digit in mask_indices:
699
- try:
700
- while is_digit:
701
- digits.append(x[i] | 0x30)
702
- i, is_digit = next(mask_indices)
703
- except StopIteration:
704
- break
705
- finally:
706
- res.append(int(digits) if digits else 0)
707
- digits.clear()
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
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chromatic-python
3
- Version: 0.9.1
3
+ Version: 0.9.3
4
4
  Summary: ANSI art image processing and colored terminal text
5
5
  Author: crypt0lith
6
6
  License-Expression: MIT
@@ -0,0 +1,8 @@
1
+ {
2
+ "tag": "0.9.3",
3
+ "distance": 0,
4
+ "node": "g7bc8f9551ea3208a10ef26a7df49e9952a3c9cb8",
5
+ "dirty": false,
6
+ "branch": "HEAD",
7
+ "node_date": "2026-10-01"
8
+ }
@@ -1,8 +0,0 @@
1
- {
2
- "tag": "0.9.1",
3
- "distance": 0,
4
- "node": "g281bef66b80163dfd442da5f58e4e5bbbd57bb92",
5
- "dirty": false,
6
- "branch": "HEAD",
7
- "node_date": "2026-09-19"
8
- }