]> git.madduck.net Git - etc/vim.git/blob - tests/data/comments3.py

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

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