@@ -5,7 +5,7 @@ and standards. Please edit and extend this document.
5
5
6
6
== svn checkouts ==
7
7
8
- # checking out the main src
8
+ # checking out the main src
9
9
svn co https://svn.sourceforge.net/svnroot/matplotlib/trunk/matplotlib matplotlib
10
10
11
11
# checking out everything (toolkits, user's guide, htdocs, etc..)
@@ -38,8 +38,29 @@ in mind.
38
38
* If you have altered extension code, do you pass
39
39
unit/memleak_hawaii.py?
40
40
41
+ == Importing and name spaces ==
41
42
42
- == Naming and spacing conventions ==
43
+ For numpy, use:
44
+
45
+ import numpy as npy
46
+ ...
47
+ a = npy.array([1,2,3])
48
+ ...
49
+
50
+ For matplotlib main module, use:
51
+
52
+ import matplotlib as mpl
53
+ ...
54
+ mpl.rcParams['xtick.major.pad'] = 6
55
+
56
+ For matplotlib modules, use:
57
+
58
+ import matplotlib.cbook as cbook
59
+ ...
60
+ if cbook.iterable(z):
61
+ ...
62
+
63
+ == Naming, spacing, and formatting conventions ==
43
64
44
65
In general, we want to hew as closely as possible to the standard
45
66
coding guidelines for python written by Guido in
@@ -58,6 +79,22 @@ Also, use an editor that does not put tabs in files. Four spaces
58
79
should be used for indentation everywhere and if there is a file with
59
80
tabs or more or less spaces it is a bug -- please fix it.
60
81
82
+ Please avoid spurious invisible spaces at the ends of lines.
83
+ (Tell your editor to strip whitespace from line ends when saving
84
+ a file.)
85
+
86
+ Keep docstrings uniformly indented as in the example below, with
87
+ nothing to the left of the triple quotes. The dedent() function
88
+ is needed to remove excess indentation only if something will be
89
+ interpolated into the docstring, again as in the example above.
90
+
91
+ Limit line length to 80 characters. If a logical line needs to be
92
+ longer, use parentheses to break it; do not use an escaped
93
+ newline. It may be preferable to use a temporary variable
94
+ to replace a single long line with two shorter and more
95
+ readable lines.
96
+
97
+
61
98
== Licenses ==
62
99
63
100
matplotlib only uses BSD compatible code. If you bring in code from
@@ -195,7 +232,6 @@ Then in any function accepting Line2D passthrough kwargs, eg
195
232
matplotlib.axes.Axes.plot
196
233
197
234
# in axes.py
198
- from cbook import dedent
199
235
...
200
236
def plot(self, *args, **kwargs):
201
237
"""
@@ -210,7 +246,7 @@ from cbook import dedent
210
246
information
211
247
"""
212
248
pass
213
- plot.__doc__ = dedent(plot.__doc__) % artist.kwdocd
249
+ plot.__doc__ = cbook. dedent(plot.__doc__) % artist.kwdocd
214
250
215
251
Note there is a problem for Artist __init__ methods, eg Patch.__init__
216
252
which supports Patch kwargs, since the artist inspector cannot work
@@ -220,18 +256,3 @@ made some manual hacks in this case which violates the "single entry
220
256
point" requirement above; hopefully we'll find a more elegant solution
221
257
before too long
222
258
223
- == Formatting (editor setup) ==
224
-
225
- Indentation is in units of 4 spaces.
226
-
227
- Please avoid hard tabs--use only spaces.
228
-
229
- Please avoid spurious invisible spaces at the ends of lines.
230
- (Tell your editor to strip whitespace from line ends when saving
231
- a file.)
232
-
233
- Keep docstrings uniformly indented as in the example above, with
234
- nothing to the left of the triple quotes. The dedent() function
235
- is needed to remove excess indentation only if something will be
236
- interpolated into the docstring, again as in the example above.
237
-
0 commit comments