cli2 6.0.0rc13__tar.gz → 6.0.0rc15__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.
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/PKG-INFO +1 -1
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2/__init__.py +9 -1
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2/traceback.py +28 -15
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2.egg-info/PKG-INFO +1 -1
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/setup.py +1 -1
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/MANIFEST.in +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2/asyncio.py +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2/cli.py +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2/cli2.py +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2/colors.py +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2/configuration.py +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2/decorators.py +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2/display.py +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2/examples/__init__.py +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2/examples/conf.py +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2/examples/example.py +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2/examples/example_obj.py +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2/examples/nesting.py +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2/examples/obj.py +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2/examples/obj2.py +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2/examples/test.py +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2/examples/traceback_demo.py +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2/exceptions.py +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2/file.py +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2/find.py +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2/flow2.py +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2/interactive.py +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2/lock.py +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2/log.py +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2/mask.py +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2/node.py +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2/notlevenshtein.py +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2/proc.py +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2/queue.py +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2/sphinx.py +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2/table.py +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2/template2.py +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2/test.py +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2/theme.py +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2.egg-info/SOURCES.txt +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2.egg-info/dependency_links.txt +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2.egg-info/entry_points.txt +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2.egg-info/requires.txt +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/cli2.egg-info/top_level.txt +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/pyproject.toml +0 -0
- {cli2-6.0.0rc13 → cli2-6.0.0rc15}/setup.cfg +0 -0
|
@@ -19,7 +19,15 @@ from .asyncio import async_resolve, files_read
|
|
|
19
19
|
from .queue import Queue
|
|
20
20
|
from .colors import colors as c
|
|
21
21
|
from .theme import theme, t
|
|
22
|
-
from .display import
|
|
22
|
+
from .display import (
|
|
23
|
+
diff,
|
|
24
|
+
diff_data,
|
|
25
|
+
render,
|
|
26
|
+
print,
|
|
27
|
+
highlight,
|
|
28
|
+
yaml_dump,
|
|
29
|
+
yaml_highlight,
|
|
30
|
+
)
|
|
23
31
|
from .interactive import confirm, choice, editor
|
|
24
32
|
try:
|
|
25
33
|
import fcntl
|
|
@@ -104,6 +104,14 @@ class TracebackFormatter:
|
|
|
104
104
|
@staticmethod
|
|
105
105
|
def display_value(value):
|
|
106
106
|
"""Truncate long values for display."""
|
|
107
|
+
if isinstance(value, bool):
|
|
108
|
+
if value:
|
|
109
|
+
return t.g(value)
|
|
110
|
+
else:
|
|
111
|
+
return t.r(value)
|
|
112
|
+
elif value is None:
|
|
113
|
+
return t.G(value)
|
|
114
|
+
|
|
107
115
|
try:
|
|
108
116
|
value = str(value)
|
|
109
117
|
except Exception:
|
|
@@ -113,6 +121,8 @@ class TracebackFormatter:
|
|
|
113
121
|
value = f"{type(value)} instance (unrepresentable)"
|
|
114
122
|
if len(value) > 75:
|
|
115
123
|
value = value[:72] + "..." # Adjusted length to fit ellipsis
|
|
124
|
+
for symb in ('{', '(', ')', '}', '<', '>', '='):
|
|
125
|
+
value = value.replace(symb, t.G(symb))
|
|
116
126
|
return value
|
|
117
127
|
|
|
118
128
|
def format_syntax_error(self, etype, value):
|
|
@@ -138,15 +148,15 @@ class TracebackFormatter:
|
|
|
138
148
|
and path.is_relative_to(cwd)
|
|
139
149
|
):
|
|
140
150
|
display_path = path.relative_to(cwd)
|
|
141
|
-
display_path_str =
|
|
142
|
-
t.p.b(display_path_str) # Use display_path_str
|
|
151
|
+
display_path_str = t.o.b(display_path)
|
|
143
152
|
colored_lineno = t.y.b(lineno)
|
|
144
153
|
except (ValueError, OSError):
|
|
154
|
+
display_path_str = t.b(display_path)
|
|
145
155
|
pass # Keep default non-relative coloring
|
|
146
156
|
|
|
147
157
|
# Header - using standard Python format
|
|
148
158
|
self.output.append(
|
|
149
|
-
f'\
|
|
159
|
+
f'\nFile "{display_path_str}", line {colored_lineno}'
|
|
150
160
|
)
|
|
151
161
|
|
|
152
162
|
file_lines, total_lines = self._get_source_lines(filename)
|
|
@@ -209,7 +219,7 @@ class TracebackFormatter:
|
|
|
209
219
|
colored_lineno = t.G(lineno)
|
|
210
220
|
sig_color = t.G # Default color
|
|
211
221
|
|
|
212
|
-
display_path_str = filename
|
|
222
|
+
display_path_str = t.G(filename)
|
|
213
223
|
try:
|
|
214
224
|
# Check if path is relative only if it's likely a file path
|
|
215
225
|
if filename and "<" not in filename and ">" not in filename:
|
|
@@ -224,9 +234,9 @@ class TracebackFormatter:
|
|
|
224
234
|
relative = True
|
|
225
235
|
try:
|
|
226
236
|
display_path = path.relative_to(cwd)
|
|
227
|
-
display_path_str =
|
|
237
|
+
display_path_str = t.o(display_path)
|
|
228
238
|
except ValueError: # pragma: no cover
|
|
229
|
-
display_path_str =
|
|
239
|
+
display_path_str = t.b(path) # Should not happen
|
|
230
240
|
|
|
231
241
|
t.p.b(display_path_str) # Use relative string
|
|
232
242
|
colored_lineno = t.y.b(lineno)
|
|
@@ -237,7 +247,7 @@ class TracebackFormatter:
|
|
|
237
247
|
output = []
|
|
238
248
|
# Standard Python format: File "...", line ..., in ...
|
|
239
249
|
header = (
|
|
240
|
-
f'\
|
|
250
|
+
f'\nFile "{display_path_str}", line {colored_lineno}, '
|
|
241
251
|
f"in {sig_color(name)}"
|
|
242
252
|
)
|
|
243
253
|
|
|
@@ -264,8 +274,8 @@ class TracebackFormatter:
|
|
|
264
274
|
|
|
265
275
|
# Define context window sizes
|
|
266
276
|
|
|
267
|
-
context_lines =
|
|
268
|
-
more_context =
|
|
277
|
+
context_lines = 3 # Context lines above/below
|
|
278
|
+
more_context = 5 # Extra context for final frame in project
|
|
269
279
|
|
|
270
280
|
# Determine context window based on frame type/position
|
|
271
281
|
if not relative: # Non-project code (library etc.)
|
|
@@ -302,7 +312,7 @@ class TracebackFormatter:
|
|
|
302
312
|
)
|
|
303
313
|
# Add standard indentation (" ") for source lines in
|
|
304
314
|
# traceback
|
|
305
|
-
output.append(f"
|
|
315
|
+
output.append(f"{formatted_line}")
|
|
306
316
|
|
|
307
317
|
# Specific handling for line number issues
|
|
308
318
|
except IndexError as e:
|
|
@@ -342,13 +352,16 @@ class TracebackFormatter:
|
|
|
342
352
|
if filtered_locals:
|
|
343
353
|
# Sort locals by key for consistent output
|
|
344
354
|
sorted_locals = sorted(filtered_locals.items())
|
|
345
|
-
locals_str = " ".join(
|
|
346
|
-
f"{k}
|
|
355
|
+
locals_str = "\n ".join(
|
|
356
|
+
f"{t.b(k)}: {self.display_value(v)}"
|
|
347
357
|
for k, v in sorted_locals
|
|
348
358
|
)
|
|
349
359
|
|
|
350
|
-
|
|
351
|
-
|
|
360
|
+
if not os.getenv('NO_LOCALS'):
|
|
361
|
+
# Add standard indentation for locals line
|
|
362
|
+
output.append(
|
|
363
|
+
f" {locals_str}",
|
|
364
|
+
)
|
|
352
365
|
|
|
353
366
|
except Exception as e:
|
|
354
367
|
output.append(
|
|
@@ -405,7 +418,7 @@ class TracebackFormatter:
|
|
|
405
418
|
try:
|
|
406
419
|
# Get exception type name and value representation
|
|
407
420
|
exc_name = t.r.b(etype.__name__)
|
|
408
|
-
exc_value =
|
|
421
|
+
exc_value = value
|
|
409
422
|
exception_str = f"{exc_name}: {exc_value}"
|
|
410
423
|
except Exception:
|
|
411
424
|
exception_str = (
|
|
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
|
|
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
|