Debian Codegraph @

tests/data/cases/comments3.py

raw
1 # The percent-percent comments are Spyder IDE cells.
2
3
4 # %%
5 def func():
6 x = """
7 a really long string
8 """
9 lcomp3 = [
10 # This one is actually too long to fit in a single line.
11 element.split("\n", 1)[0]
12 # yup
13 for element in collection.select_elements()
14 # right
15 if element is not None
16 ]
17 # Capture each of the exceptions in the MultiError along with each of their causes and contexts
18 if isinstance(exc_value, MultiError):
19 embedded = []
20 for exc in exc_value.exceptions:
21 if exc not in _seen:
22 embedded.append(
23 # This should be left alone (before)
24 traceback.TracebackException.from_exception(
25 exc,
26 limit=limit,
27 lookup_lines=lookup_lines,
28 capture_locals=capture_locals,
29 # copy the set of _seen exceptions so that duplicates
30 # shared between sub-exceptions are not omitted
31 _seen=set(_seen),
32 )
33 # This should be left alone (after)
34 )
35
36 # everything is fine if the expression isn't nested
37 traceback.TracebackException.from_exception(
38 exc,
39 limit=limit,
40 lookup_lines=lookup_lines,
41 capture_locals=capture_locals,
42 # copy the set of _seen exceptions so that duplicates
43 # shared between sub-exceptions are not omitted
44 _seen=set(_seen),
45 )
46
47
48 # %%