Skip to content

Commit a301f82

Browse files
authored
Merge pull request #543 from musicinmybrain/invalid-escapes
Fix backslash escaping issues in docstrings
2 parents dc97dbf + b7a4259 commit a301f82

File tree

6 files changed

+20
-20
lines changed

6 files changed

+20
-20
lines changed

nipy/algorithms/statistics/formula/formulae.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def __add__(self, other):
202202

203203

204204
def terms(names, **kwargs):
205-
''' Return list of terms with names given by `names`
205+
r''' Return list of terms with names given by `names`
206206
207207
This is just a convenience in defining a set of terms, and is the
208208
equivalent of ``sympy.symbols`` for defining symbols in sympy.
@@ -215,7 +215,7 @@ def terms(names, **kwargs):
215215
names : str or sequence of str
216216
If a single str, can specify multiple ``Term``s with string
217217
containing space or ',' as separator.
218-
\\**kwargs : keyword arguments
218+
\*\*kwargs : keyword arguments
219219
keyword arguments as for ``sympy.symbols``
220220
221221
Returns

nipy/core/reference/coordinate_map.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2301,22 +2301,22 @@ def make_cmap(self, domain_N, xform, inv_xform=None):
23012301
inv_xform)
23022302

23032303
def __call__(self, *args, **kwargs):
2304-
""" Create affine or non-affine coordinate map
2304+
r""" Create affine or non-affine coordinate map
23052305
23062306
Parameters
23072307
----------
2308-
\\*args :
2308+
\*args :
23092309
Arguments to ``make_affine`` or ``make_cmap`` methods. We check the
23102310
first argument to see if it is a scalar or an affine, and pass the
2311-
\\*args, \\*\\*kwargs to ``make_cmap`` or ``make_affine``
2311+
\*args, \*\*kwargs to ``make_cmap`` or ``make_affine``
23122312
respectively
2313-
\\*\\*kwargs:
2313+
\*\*kwargs:
23142314
See above
23152315
23162316
Returns
23172317
-------
23182318
cmap : ``CoordinateMap`` or ``AffineTransform``
2319-
Affine if the first \\*arg was an affine array, otherwise a
2319+
Affine if the first \*arg was an affine array, otherwise a
23202320
Coordinate Map.
23212321
"""
23222322
arg0 = np.asarray(args[0])

nipy/modalities/fmri/design.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ def stack_contrasts(contrasts, name, keys):
402402

403403

404404
def stack_designs(*pairs):
405-
""" Stack a sequence of design / contrast dictionary pairs
405+
r""" Stack a sequence of design / contrast dictionary pairs
406406
407407
Uses multiple calls to :func:`stack2designs`
408408

nipy/modalities/fmri/utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def fourier_basis(freq):
142142

143143

144144
def interp(times, values, fill=0, name=None, **kw):
145-
""" Generic interpolation function of t given `times` and `values`
145+
r""" Generic interpolation function of t given `times` and `values`
146146
147147
Imterpolator such that:
148148
@@ -206,7 +206,7 @@ def interp(times, values, fill=0, name=None, **kw):
206206

207207

208208
def linear_interp(times, values, fill=0, name=None, **kw):
209-
""" Linear interpolation function of t given `times` and `values`
209+
r""" Linear interpolation function of t given `times` and `values`
210210
211211
Imterpolator such that:
212212
@@ -455,7 +455,7 @@ def __init__(self, expr, support, delta, fill=0):
455455
self._vals = _eval_for(expr, self.support, self.delta)
456456

457457
def convolve(self, g, g_interval, name=None, **kwargs):
458-
""" Convolve sympy expression `g` with this kernel
458+
r""" Convolve sympy expression `g` with this kernel
459459
460460
Parameters
461461
----------
@@ -488,7 +488,7 @@ def convolve(self, g, g_interval, name=None, **kwargs):
488488

489489
def convolve_functions(f, g, f_interval, g_interval, dt,
490490
fill=0, name=None, **kwargs):
491-
""" Expression containing numerical convolution of `fn1` with `fn2`
491+
r""" Expression containing numerical convolution of `fn1` with `fn2`
492492
493493
Parameters
494494
----------

nipy/utils/perlpie.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
22
# vi: set ft=python sts=4 ts=4 sw=4 et:
3-
"""Perform a global search and replace on the current directory *recursively*.
3+
r"""Perform a global search and replace on the current directory *recursively*.
44
55
This a small python wrapper around the `perl -p -i -e` functionality.
66
I **strongly recommend** running `perlpie` on files under source
@@ -71,14 +71,14 @@ def check_deps():
7171

7272

7373
def perl_dash_pie(oldstr, newstr, dry_run=None):
74-
"""Use perl to replace the oldstr with the newstr.
74+
r"""Use perl to replace the oldstr with the newstr.
7575
7676
Examples
7777
--------
7878
7979
# To replace all occurrences of 'import numpy as N' with 'import numpy as np'
8080
from nipy.utils import perlpie
81-
perlpie.perl_dash_pie('import\s+numpy\s+as\s+N', 'import numpy as np')
81+
perlpie.perl_dash_pie(r'import\s+numpy\s+as\s+N', 'import numpy as np')
8282
grind | xargs perl -pi -e 's/import\s+numpy\s+as\s+N/import numpy as np/g'
8383
8484
"""

tools/apigen.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ def __init__(self,
6868
['\.setup$', '\._']
6969
'''
7070
if package_skip_patterns is None:
71-
package_skip_patterns = ['\\.tests$']
71+
package_skip_patterns = [r'\.tests$']
7272
if module_skip_patterns is None:
73-
module_skip_patterns = ['\\.setup$', '\\._']
73+
module_skip_patterns = [r'\.setup$', r'\._']
7474
self.package_name = package_name
7575
self.rst_extension = rst_extension
7676
self.package_skip_patterns = package_skip_patterns
@@ -272,7 +272,7 @@ def generate_api_doc(self, uri):
272272
return ad
273273

274274
def _survives_exclude(self, matchstr, match_type):
275-
''' Returns True if *matchstr* does not match patterns
275+
r''' Returns True if *matchstr* does not match patterns
276276
277277
``self.package_name`` removed from front of string if present
278278
@@ -281,14 +281,14 @@ def _survives_exclude(self, matchstr, match_type):
281281
>>> dw = ApiDocWriter('sphinx')
282282
>>> dw._survives_exclude('sphinx.okpkg', 'package')
283283
True
284-
>>> dw.package_skip_patterns.append('^\\.badpkg$')
284+
>>> dw.package_skip_patterns.append(r'^\.badpkg$')
285285
>>> dw._survives_exclude('sphinx.badpkg', 'package')
286286
False
287287
>>> dw._survives_exclude('sphinx.badpkg', 'module')
288288
True
289289
>>> dw._survives_exclude('sphinx.badmod', 'module')
290290
True
291-
>>> dw.module_skip_patterns.append('^\\.badmod$')
291+
>>> dw.module_skip_patterns.append(r'^\.badmod$')
292292
>>> dw._survives_exclude('sphinx.badmod', 'module')
293293
False
294294
'''

0 commit comments

Comments
 (0)