chromatic-python 0.9.2__py3-none-any.whl → 0.9.3__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.
chromatic/__main__.py CHANGED
@@ -580,9 +580,10 @@ def Parser(prog=None):
580
580
  return top_parser
581
581
 
582
582
 
583
- def parse_args(argv=None):
584
- argv = argv or sys.argv
585
- return Parser(os.path.basename(argv[0])).parse_args(argv[1:])
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)
586
587
 
587
588
 
588
589
  def _call_from_ns[R](f: abc.Callable[..., R], /, ns, **kwargs) -> R:
chromatic/_version.py CHANGED
@@ -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.2'
22
- __version_tuple__ = version_tuple = (0, 9, 2)
21
+ __version__ = version = '0.9.3'
22
+ __version_tuple__ = version_tuple = (0, 9, 3)
23
23
 
24
- __commit_id__ = commit_id = 'gbe4e6a5cd'
24
+ __commit_id__ = commit_id = 'g7bc8f9551'
chromatic/color/core.py CHANGED
@@ -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.2
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
@@ -1,13 +1,13 @@
1
1
  chromatic/__init__.py,sha256=OMvWLvDuaYpXaku9n0yKa0TShBw-nmY_YuC5MsSxyK4,200
2
2
  chromatic/__init__.pyi,sha256=ag2uIy4vaFiWQbfjaGMv00H1txh_XnzqeAfMien7aF8,1666
3
- chromatic/__main__.py,sha256=nm3FcPuGOz2p9cFiNp5IOvmtKTnAggBYRGfr9iwe5Ns,28065
3
+ chromatic/__main__.py,sha256=__OH0AmQ2Yn8cc1dXxNHMfS8PVooCsvFsyw8mSU2xi0,28083
4
4
  chromatic/_typing.py,sha256=sCBi3aJrgm9efUL22jZg6S4fWSQj39zLx56ZrfAAjvU,3695
5
- chromatic/_version.py,sha256=z01EEho55rtFSmtUIY_dFYiPC8OnFS0OJuwAOg4f-as,528
5
+ chromatic/_version.py,sha256=PQTK_JoKSPLIjy3ylI1CPU6vzh7QZ5Hcg6zY-HeWjeg,528
6
6
  chromatic/color/__init__.py,sha256=t19DW9WMdd6FEN69vkckVRlsDPBHldulHv_JulwXxFc,99
7
7
  chromatic/color/__init__.pyi,sha256=38k9rRtewx5jAG9MgHr77bvPVLEg3ULf8CkJfipnNZc,1774
8
8
  chromatic/color/colorconv.py,sha256=WTgRYeFxau0A7S10S7Zi4Y7Dg-Rcy-I6Sgm3LjTMPA4,11342
9
9
  chromatic/color/colorconv.pyi,sha256=uSw1bC2KTKugY-eSlnAfE40h22zqiDGYf6yXtaAGcKE,7669
10
- chromatic/color/core.py,sha256=xNnsev0Vgj80VDE6i0ViYLQFse-7ToD4-ata_N2bjQY,68526
10
+ chromatic/color/core.py,sha256=maottWRbE6BLkSe-aE89saMrZVOALtSQsCmu6vH3xs0,68143
11
11
  chromatic/color/core.pyi,sha256=QHGe6WE8FKkgwoavi_OakUl-cHF5uAobDxO-XZp5woU,20648
12
12
  chromatic/color/palette.py,sha256=AMKRPUkq9BRD9iCalQ0RNlvcAF7onpwfN2DWQ2B8VhE,22850
13
13
  chromatic/color/palette.pyi,sha256=zqcuBYPACoYSJOZf_QynX3DWvHi9GJkdZklwby0mzS0,9572
@@ -21,9 +21,9 @@ chromatic/image/__init__.pyi,sha256=IjC_HdMMTWznSMA6UprBsvEV8BB65PxBlYtrfDJudd0,
21
21
  chromatic/image/_array.py,sha256=6_eZOza5D_rLW8-uyyyD-TDZQQSSho70ec6mJp5SpQA,40493
22
22
  chromatic/image/_curses.py,sha256=GAlUvLfsXFDmyGg8Di_TKNfyHZnTf7NTAKZW6o7QHTc,1601
23
23
  chromatic/image/_glyph.py,sha256=RfiVwwzA3jxjObpOjV-zj2aipSndu1TrOOce6K7c2Eo,2534
24
- chromatic_python-0.9.2.dist-info/licenses/LICENSE,sha256=fKQvJY6-i5UcR_yGbIv2W7oAehJMTJY0NvRtWoXwHKE,1066
25
- chromatic_python-0.9.2.dist-info/METADATA,sha256=Co4HNqjShFi34TgNu1ogHOyUuT-GY5-B9WeKOLNFt9I,5166
26
- chromatic_python-0.9.2.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
27
- chromatic_python-0.9.2.dist-info/entry_points.txt,sha256=Fk_pV70Sz340dSNfzHu-JycTf2nO0Fa60LkANe73_YA,54
28
- chromatic_python-0.9.2.dist-info/top_level.txt,sha256=wjzxcxfjO8I4u22BS8wL67Bq64c59kbZCqQ--Fc_Mqw,10
29
- chromatic_python-0.9.2.dist-info/RECORD,,
24
+ chromatic_python-0.9.3.dist-info/licenses/LICENSE,sha256=fKQvJY6-i5UcR_yGbIv2W7oAehJMTJY0NvRtWoXwHKE,1066
25
+ chromatic_python-0.9.3.dist-info/METADATA,sha256=irOCILK4qhV3cmGdxQn0s8UF9MHvVf1q4Un4ByIE-8k,5166
26
+ chromatic_python-0.9.3.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
27
+ chromatic_python-0.9.3.dist-info/entry_points.txt,sha256=Fk_pV70Sz340dSNfzHu-JycTf2nO0Fa60LkANe73_YA,54
28
+ chromatic_python-0.9.3.dist-info/top_level.txt,sha256=wjzxcxfjO8I4u22BS8wL67Bq64c59kbZCqQ--Fc_Mqw,10
29
+ chromatic_python-0.9.3.dist-info/RECORD,,