Show More
@@ -0,0 +1,47 b'' | |||
|
1 | IPython debugger (IPdb) now supports the number of context lines for the | |
|
2 | ``where`` (and ``w``) commands. The `context` keyword is also available in various APIs. | |
|
3 | ||
|
4 | .. code:: | |
|
5 | ||
|
6 | In [2]: def foo(): | |
|
7 | ...: 1 | |
|
8 | ...: 2 | |
|
9 | ...: 3 | |
|
10 | ...: 4 | |
|
11 | ...: 5 | |
|
12 | ...: raise ValueError('6 is not acceptable') | |
|
13 | ...: 7 | |
|
14 | ...: 8 | |
|
15 | ...: 9 | |
|
16 | ...: 10 | |
|
17 | ...: | |
|
18 | ||
|
19 | In [3]: foo() | |
|
20 | ---------------------------------------------------- | |
|
21 | ValueError Traceback (most recent call last) | |
|
22 | <ipython-input-3> in <module>() | |
|
23 | ----> 1 foo() | |
|
24 | ||
|
25 | <ipython-input-2> in foo() | |
|
26 | 5 4 | |
|
27 | 6 5 | |
|
28 | ----> 7 raise ValueError('6 is not acceptable') | |
|
29 | 8 7 | |
|
30 | 9 8 | |
|
31 | ||
|
32 | ValueError: 6 is not acceptable | |
|
33 | ||
|
34 | In [4]: debug | |
|
35 | > <ipython-input-2>(7)foo() | |
|
36 | 5 4 | |
|
37 | 6 5 | |
|
38 | ----> 7 raise ValueError('6 is not acceptable') | |
|
39 | 8 7 | |
|
40 | 9 8 | |
|
41 | ||
|
42 | ipdb> where 1 | |
|
43 | <ipython-input-3>(1)<module>() | |
|
44 | ----> 1 foo() | |
|
45 | ||
|
46 | > <ipython-input-2>(7)foo() | |
|
47 | ----> 7 raise ValueError('6 is not acceptable') |
@@ -1,21 +1,21 b'' | |||
|
1 | 1 | ===================== |
|
2 | 2 | Development version |
|
3 | 3 | ===================== |
|
4 | 4 | |
|
5 | 5 | This document describes in-flight development work. |
|
6 | 6 | |
|
7 | 7 | .. warning:: |
|
8 | 8 | |
|
9 | 9 | Please do not edit this file by hand (doing so will likely cause merge |
|
10 | 10 | conflicts for other Pull Requests). Instead, create a new file in the |
|
11 | 11 | `docs/source/whatsnew/pr` folder |
|
12 | 12 | |
|
13 | ||
|
13 | 14 | .. DO NOT EDIT THIS LINE BEFORE RELEASE. FEATURE INSERTION POINT. |
|
14 | 15 | |
|
15 | 16 | |
|
16 | 17 | Backwards incompatible changes |
|
17 | 18 | ------------------------------ |
|
18 | 19 | |
|
19 | 20 | |
|
20 | 21 | .. DO NOT EDIT THIS LINE BEFORE RELEASE. INCOMPAT INSERTION POINT. |
|
21 |
@@ -1,75 +1,80 b'' | |||
|
1 | 1 | #!/usr/bin/env python |
|
2 | 2 | """Update the What's New doc (development version) |
|
3 | 3 | |
|
4 | 4 | This collects the snippets from whatsnew/pr/, moves their content into |
|
5 | 5 | whatsnew/development.rst (chronologically ordered), and deletes the snippets. |
|
6 | 6 | """ |
|
7 | 7 | |
|
8 | 8 | import io |
|
9 | 9 | import os |
|
10 | from glob import glob | |
|
10 | 11 | from os.path import dirname, basename, abspath, join as pjoin |
|
11 | 12 | from subprocess import check_call, check_output |
|
12 | 13 | |
|
13 | 14 | repo_root = dirname(dirname(abspath(__file__))) |
|
14 | 15 | whatsnew_dir = pjoin(repo_root, 'docs', 'source', 'whatsnew') |
|
15 | 16 | pr_dir = pjoin(whatsnew_dir, 'pr') |
|
16 | 17 | target = pjoin(whatsnew_dir, 'development.rst') |
|
17 | 18 | |
|
18 | 19 | FEATURE_MARK = ".. DO NOT EDIT THIS LINE BEFORE RELEASE. FEATURE INSERTION POINT." |
|
19 | 20 | INCOMPAT_MARK = ".. DO NOT EDIT THIS LINE BEFORE RELEASE. INCOMPAT INSERTION POINT." |
|
20 | 21 | |
|
21 | 22 | # 1. Collect the whatsnew snippet files --------------------------------------- |
|
22 | 23 | |
|
23 | files = set(os.listdir(pr_dir)) | |
|
24 | files = set() | |
|
25 | for f in glob(pjoin(pr_dir, '*.rst')): | |
|
26 | files.add(f) | |
|
24 | 27 | # Ignore explanatory and example files |
|
25 | files.difference_update({'README.md', | |
|
28 | files.difference_update({pjoin(pr_dir, f) for f in {'README.md', | |
|
26 | 29 | 'incompat-switching-to-perl.rst', |
|
27 | 30 | 'antigravity-feature.rst'} |
|
28 | ) | |
|
31 | }) | |
|
29 | 32 | |
|
30 | # Absolute paths | |
|
31 | files = {pjoin(pr_dir, f) for f in files} | |
|
32 | 33 | |
|
33 | 34 | def getmtime(f): |
|
34 | 35 | return check_output(['git', 'log', '-1', '--format="%ai"', '--', f]) |
|
35 | 36 | |
|
36 | 37 | files = sorted(files, key=getmtime) |
|
37 | 38 | |
|
38 | 39 | features, incompats = [], [] |
|
39 | 40 | for path in files: |
|
40 | 41 | with io.open(path, encoding='utf-8') as f: |
|
41 | content = f.read().rstrip() | |
|
42 | try: | |
|
43 | content = f.read().rstrip() | |
|
44 | except Exception as e: | |
|
45 | raise Exception('Error reading "{}"'.format(f)) | |
|
46 | ||
|
42 | 47 | if basename(path).startswith('incompat-'): |
|
43 | 48 | incompats.append(content) |
|
44 | 49 | else: |
|
45 | 50 | features.append(content) |
|
46 | 51 | |
|
47 | 52 | # Put the insertion markers back on the end, so they're ready for next time. |
|
48 | 53 | feature_block = '\n\n'.join(features + [FEATURE_MARK]) |
|
49 | 54 | incompat_block = '\n\n'.join(incompats + [INCOMPAT_MARK]) |
|
50 | 55 | |
|
51 | 56 | # 2. Update the target file --------------------------------------------------- |
|
52 | 57 | |
|
53 | 58 | with io.open(target, encoding='utf-8') as f: |
|
54 | 59 | content = f.read() |
|
55 | 60 | |
|
56 | 61 | assert content.count(FEATURE_MARK) == 1 |
|
57 | 62 | assert content.count(INCOMPAT_MARK) == 1 |
|
58 | 63 | |
|
59 | 64 | content = content.replace(FEATURE_MARK, feature_block) |
|
60 | 65 | content = content.replace(INCOMPAT_MARK, incompat_block) |
|
61 | 66 | |
|
62 | 67 | # Clean trailing whitespace |
|
63 | 68 | content = '\n'.join(l.rstrip() for l in content.splitlines()) |
|
64 | 69 | |
|
65 | 70 | with io.open(target, 'w', encoding='utf-8') as f: |
|
66 | 71 | f.write(content) |
|
67 | 72 | |
|
68 | 73 | # 3. Stage the changes in git ------------------------------------------------- |
|
69 | 74 | |
|
70 | 75 | for file in files: |
|
71 | 76 | check_call(['git', 'rm', file]) |
|
72 | 77 | |
|
73 | 78 | check_call(['git', 'add', target]) |
|
74 | 79 | |
|
75 | print("Merged what's new changes. Check the diff and commit the change.") No newline at end of file | |
|
80 | print("Merged what's new changes. Check the diff and commit the change.") |
General Comments 0
You need to be logged in to leave comments.
Login now