Show More
@@ -1,6 +1,7 b'' | |||||
1 | #!/usr/bin/env python |
|
1 | #!/usr/bin/env python | |
2 |
|
2 | |||
3 | from os.path import join, dirname, abspath |
|
3 | from os.path import join, dirname, abspath | |
|
4 | import inspect | |||
4 |
|
5 | |||
5 | from IPython.terminal.ipapp import TerminalIPythonApp |
|
6 | from IPython.terminal.ipapp import TerminalIPythonApp | |
6 | from ipykernel.kernelapp import IPKernelApp |
|
7 | from ipykernel.kernelapp import IPKernelApp | |
@@ -14,33 +15,6 b" generated = join(options, 'config-generated.txt')" | |||||
14 | import textwrap |
|
15 | import textwrap | |
15 | indent = lambda text,n: textwrap.indent(text,n*' ') |
|
16 | indent = lambda text,n: textwrap.indent(text,n*' ') | |
16 |
|
17 | |||
17 | def dedent(text): |
|
|||
18 | """Equivalent of textwrap.dedent that ignores unindented first line. |
|
|||
19 |
|
||||
20 | This means it will still dedent strings like: |
|
|||
21 | '''foo |
|
|||
22 | is a bar |
|
|||
23 | ''' |
|
|||
24 |
|
||||
25 | For use in wrap_paragraphs. |
|
|||
26 | """ |
|
|||
27 |
|
||||
28 | if text.startswith('\n'): |
|
|||
29 | # text starts with blank line, don't ignore the first line |
|
|||
30 | return textwrap.dedent(text) |
|
|||
31 |
|
||||
32 | # split first line |
|
|||
33 | splits = text.split('\n',1) |
|
|||
34 | if len(splits) == 1: |
|
|||
35 | # only one line |
|
|||
36 | return textwrap.dedent(text) |
|
|||
37 |
|
||||
38 | first, rest = splits |
|
|||
39 | # dedent everything but the first line |
|
|||
40 | rest = textwrap.dedent(rest) |
|
|||
41 | return '\n'.join([first, rest]) |
|
|||
42 |
|
||||
43 |
|
||||
44 |
|
18 | |||
45 | def interesting_default_value(dv): |
|
19 | def interesting_default_value(dv): | |
46 | if (dv is None) or (dv is Undefined): |
|
20 | if (dv is None) or (dv is Undefined): | |
@@ -72,7 +46,7 b' def class_config_rst_doc(cls, trait_aliases):' | |||||
72 | ] |
|
46 | ] | |
73 |
|
47 | |||
74 | help = trait.help.rstrip() or 'No description' |
|
48 | help = trait.help.rstrip() or 'No description' | |
75 |
lines.append(indent( |
|
49 | lines.append(indent(inspect.cleandoc(help), 4) + '\n') | |
76 |
|
50 | |||
77 | # Choices or type |
|
51 | # Choices or type | |
78 | if 'Enum' in ttype: |
|
52 | if 'Enum' in ttype: |
General Comments 0
You need to be logged in to leave comments.
Login now