Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 081d4c1

Browse filesBrowse files
committed
Move some toplevel strings into the only functions that use them.
1 parent 4236b57 commit 081d4c1
Copy full SHA for 081d4c1

File tree

Expand file treeCollapse file tree

2 files changed

+5
-10
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+5
-10
lines changed

‎lib/matplotlib/__init__.py

Copy file name to clipboardExpand all lines: lib/matplotlib/__init__.py
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -882,15 +882,14 @@ def _open_file_or_url(fname):
882882
yield f
883883

884884

885-
_error_details_fmt = 'line #%d\n\t"%s"\n\tin file "%s"'
886-
887-
888885
def _rc_params_in_file(fname, fail_on_error=False):
889886
"""Return :class:`matplotlib.RcParams` from the contents of the given file.
890887
891888
Unlike `rc_params_from_file`, the configuration class only contains the
892889
parameters specified in the file (i.e. default values are not filled in).
893890
"""
891+
_error_details_fmt = 'line #%d\n\t"%s"\n\tin file "%s"'
892+
894893
rc_temp = {}
895894
with _open_file_or_url(fname) as fd:
896895
try:

‎lib/matplotlib/mlab.py

Copy file name to clipboardExpand all lines: lib/matplotlib/mlab.py
+3-7Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,11 +1067,6 @@ def specgram(x, NFFT=None, Fs=None, detrend=None, window=None,
10671067
return spec, freqs, t
10681068

10691069

1070-
_coh_error = """Coherence is calculated by averaging over *NFFT*
1071-
length segments. Your signal is too short for your choice of *NFFT*.
1072-
"""
1073-
1074-
10751070
@docstring.dedent_interpd
10761071
def cohere(x, y, NFFT=256, Fs=2, detrend=detrend_none, window=window_hanning,
10771072
noverlap=0, pad_to=None, sides='default', scale_by_freq=None):
@@ -1109,9 +1104,10 @@ def cohere(x, y, NFFT=256, Fs=2, detrend=detrend_none, window=window_hanning,
11091104
For information about the methods used to compute :math:`P_{xy}`,
11101105
:math:`P_{xx}` and :math:`P_{yy}`.
11111106
"""
1112-
11131107
if len(x) < 2 * NFFT:
1114-
raise ValueError(_coh_error)
1108+
raise ValueError(
1109+
"Coherence is calculated by averaging over *NFFT* length "
1110+
"segments. Your signal is too short for your choice of *NFFT*.")
11151111
Pxx, f = psd(x, NFFT, Fs, detrend, window, noverlap, pad_to, sides,
11161112
scale_by_freq)
11171113
Pyy, f = psd(y, NFFT, Fs, detrend, window, noverlap, pad_to, sides,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.