Skip to content

Commit 2525efd

Browse files
committed
fix GitHub Actions run #7
1 parent 3398c27 commit 2525efd

5 files changed

Lines changed: 37 additions & 0 deletions

File tree

src/xulbux/console.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,6 +1293,7 @@ def validate(self, document) -> None:
12931293
raise ValidationError(message="", cursor_position=len(document.text))
12941294

12951295

1296+
@mypyc_attr(native_class=False)
12961297
class ProgressBar:
12971298
"""A console progress bar with smooth transitions and customizable appearance.\n
12981299
-------------------------------------------------------------------------------------------------
@@ -1631,6 +1632,7 @@ def __call__(self, *args: Any, **kwargs: Any) -> None:
16311632
self.progress_bar.show_progress(current=self.current_progress, total=self.total, label=self.current_label)
16321633

16331634

1635+
@mypyc_attr(native_class=False)
16341636
class Spinner:
16351637
"""A console spinner for indeterminate processes with customizable appearance.
16361638
This class intercepts stdout to allow printing while the animation is active.\n

src/xulbux/data.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@
1414
import math as _math
1515
import re as _re
1616

17+
try:
18+
from mypy_extensions import mypyc_attr # type: ignore[import]
19+
except ImportError:
20+
21+
def __mypyc_attr_decorator(cls):
22+
return cls
23+
24+
def mypyc_attr(*args, **kwargs): # type: ignore[misc]
25+
return __mypyc_attr_decorator
26+
1727

1828
_DEFAULT_SYNTAX_HL: Final[dict[str, tuple[str, str]]] = {
1929
"str": ("[br:blue]", "[_c]"),
@@ -25,6 +35,7 @@
2535
"""Default syntax highlighting styles for data structure rendering."""
2636

2737

38+
@mypyc_attr(native_class=False)
2839
class Data:
2940
"""This class includes methods to work with nested data structures (dictionaries and lists)."""
3041

src/xulbux/format_codes.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,16 @@
167167
import sys as _sys
168168
import os as _os
169169

170+
try:
171+
from mypy_extensions import mypyc_attr # type: ignore[import]
172+
except ImportError:
173+
174+
def __mypyc_attr_decorator(cls):
175+
return cls
176+
177+
def mypyc_attr(*args, **kwargs): # type: ignore[misc]
178+
return __mypyc_attr_decorator
179+
170180

171181
_CONSOLE_ANSI_CONFIGURED: bool = False
172182
"""Whether the console was already configured to be able to interpret and render ANSI formatting."""
@@ -210,6 +220,7 @@
210220
)
211221

212222

223+
@mypyc_attr(native_class=False)
213224
class FormatCodes:
214225
"""This class provides methods to print and work with strings that contain special formatting codes,
215226
which are then converted to ANSI codes for pretty console output."""

src/xulbux/json.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,18 @@
1010
from typing import Literal, Any, cast
1111
import json as _json
1212

13+
try:
14+
from mypy_extensions import mypyc_attr # type: ignore[import]
15+
except ImportError:
1316

17+
def __mypyc_attr_decorator(cls):
18+
return cls
19+
20+
def mypyc_attr(*args, **kwargs): # type: ignore[misc]
21+
return __mypyc_attr_decorator
22+
23+
24+
@mypyc_attr(native_class=False)
1425
class Json:
1526
"""This class provides methods to read, create and update JSON files,
1627
with support for comments inside the JSON data."""

tests/test_console.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,6 +1173,7 @@ def test_progressbar_clear_progress_line():
11731173
pb = ProgressBar()
11741174
mock_stdout = MagicMock()
11751175
mock_stdout.write.return_value = 0
1176+
mock_stdout.flush.return_value = None
11761177
pb._original_stdout = mock_stdout
11771178
pb._last_line_len = 20
11781179
pb._clear_progress_line()
@@ -1184,6 +1185,7 @@ def test_progressbar_redraw_progress_bar():
11841185
pb = ProgressBar()
11851186
mock_stdout = MagicMock()
11861187
mock_stdout.write.return_value = 0
1188+
mock_stdout.flush.return_value = None
11871189
pb._original_stdout = mock_stdout
11881190
pb._current_progress_str = "\x1b[2K\rLoading |████████████| 50%"
11891191
pb._redraw_display()

0 commit comments

Comments
 (0)