IncludeCPP 3.3.11__py3-none-any.whl → 3.3.20__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.
@@ -6,10 +6,39 @@ Error messages are always printed LAST so users who only read the end still see
6
6
 
7
7
  from typing import List, Optional, Dict
8
8
  import re
9
+ import sys
9
10
 
10
11
  from .error_catalog import ERROR_CATALOG, get_error_message, format_error_box, format_unknown_error
11
12
 
12
13
 
14
+ def _supports_unicode():
15
+ """Check if terminal supports Unicode output."""
16
+ if sys.platform == 'win32':
17
+ try:
18
+ '✓✗❌→←'.encode(sys.stdout.encoding or 'utf-8')
19
+ return True
20
+ except (UnicodeEncodeError, LookupError, AttributeError):
21
+ return False
22
+ return True
23
+
24
+
25
+ _UNICODE_OK = _supports_unicode()
26
+
27
+ # Box drawing characters with ASCII fallbacks
28
+ BOX_TL = '╔' if _UNICODE_OK else '+'
29
+ BOX_TR = '╗' if _UNICODE_OK else '+'
30
+ BOX_BL = '╚' if _UNICODE_OK else '+'
31
+ BOX_BR = '╝' if _UNICODE_OK else '+'
32
+ BOX_H = '═' if _UNICODE_OK else '='
33
+ BOX_V = '║' if _UNICODE_OK else '|'
34
+ BULLET = '•' if _UNICODE_OK else '*'
35
+ ARROW = '→' if _UNICODE_OK else '->'
36
+ DBLARROW = '↔' if _UNICODE_OK else '<->'
37
+ CHECK = '✓' if _UNICODE_OK else '[OK]'
38
+ CROSS = '✗' if _UNICODE_OK else '[X]'
39
+ ERR_CROSS = '❌' if _UNICODE_OK else '[X]'
40
+
41
+
13
42
  class BuildErrorFormatter:
14
43
  """Format C++ compilation errors with context and suggestions."""
15
44
 
@@ -25,10 +54,11 @@ class BuildErrorFormatter:
25
54
  Returns:
26
55
  Formatted error message with suggestions
27
56
  """
57
+ h_line = BOX_H * 62
28
58
  return f"""
29
- ╔══════════════════════════════════════════════════════════════╗
30
- TYPE MISMATCH ERROR
31
- ╚══════════════════════════════════════════════════════════════╝
59
+ {BOX_TL}{h_line}{BOX_TR}
60
+ {BOX_V} TYPE MISMATCH ERROR {BOX_V}
61
+ {BOX_BL}{h_line}{BOX_BR}
32
62
 
33
63
  Location: {location}
34
64
 
@@ -36,10 +66,10 @@ Expected: {expected}
36
66
  Got: {got}
37
67
 
38
68
  Suggestions:
39
- Check if you're passing the correct type
40
- For struct dict: use struct_instance.to_dict()
41
- For dict struct: use StructName.from_dict(dict_instance)
42
- For vector conversions: Python list std::vector is automatic
69
+ {BULLET} Check if you're passing the correct type
70
+ {BULLET} For struct {ARROW} dict: use struct_instance.to_dict()
71
+ {BULLET} For dict {ARROW} struct: use StructName.from_dict(dict_instance)
72
+ {BULLET} For vector conversions: Python list {DBLARROW} std::vector is automatic
43
73
 
44
74
  Type Conversion Examples:
45
75
  # Struct to dict
@@ -86,7 +116,7 @@ To Fix:
86
116
  python -m includecpp rebuild --verbose
87
117
 
88
118
  Dependency Chain:
89
- {module} {missing_dep}
119
+ {{module}} {ARROW} {{missing_dep}}
90
120
  """
91
121
 
92
122
  @staticmethod
@@ -99,28 +129,29 @@ Dependency Chain:
99
129
  Returns:
100
130
  Formatted error message with refactoring suggestions
101
131
  """
102
- cycle_display = " ".join(cycle + [cycle[0]])
132
+ cycle_display = f" {ARROW} ".join(cycle + [cycle[0]])
133
+ h_line = BOX_H * 62
103
134
  return f"""
104
- ╔══════════════════════════════════════════════════════════════╗
105
- CIRCULAR DEPENDENCY DETECTED
106
- ╚══════════════════════════════════════════════════════════════╝
135
+ {BOX_TL}{h_line}{BOX_TR}
136
+ {BOX_V} CIRCULAR DEPENDENCY DETECTED {BOX_V}
137
+ {BOX_BL}{h_line}{BOX_BR}
107
138
 
108
139
  Dependency Cycle:
109
140
  {cycle_display}
110
141
 
111
142
  To Fix:
112
- Refactor modules to remove circular dependency
113
- Use forward declarations where possible
114
- Consider merging modules if they're tightly coupled
115
- Create a third module for shared types
143
+ {BULLET} Refactor modules to remove circular dependency
144
+ {BULLET} Use forward declarations where possible
145
+ {BULLET} Consider merging modules if they're tightly coupled
146
+ {BULLET} Create a third module for shared types
116
147
 
117
148
  Example Refactoring:
118
149
  Before:
119
- module_a module_b module_a
150
+ module_a {ARROW} module_b {ARROW} module_a {ERR_CROSS}
120
151
 
121
152
  After:
122
- module_a shared_types
123
- module_b shared_types
153
+ module_a {ARROW} shared_types
154
+ module_b {ARROW} shared_types {CHECK}
124
155
  """
125
156
 
126
157
  @staticmethod