@@ -697,28 +697,19 @@ def matplotlib_fname():
697
697
698
698
The file location is determined in the following order
699
699
700
- - `$PWD/matplotlibrc`
701
-
702
- - `$MATPLOTLIBRC` if it is not a directory
703
-
704
- - `$MATPLOTLIBRC/matplotlibrc`
705
-
706
- - `$MPLCONFIGDIR/matplotlibrc`
707
-
700
+ - ``$PWD/matplotlibrc``
701
+ - ``$MATPLOTLIBRC`` if it is not a directory
702
+ - ``$MATPLOTLIBRC/matplotlibrc``
703
+ - ``$MPLCONFIGDIR/matplotlibrc``
708
704
- On Linux,
709
-
710
- - `$XDG_CONFIG_HOME/matplotlib/matplotlibrc` (if
711
- $XDG_CONFIG_HOME is defined)
712
-
713
- - or `$HOME/.config/matplotlib/matplotlibrc` (if
714
- $XDG_CONFIG_HOME is not defined)
715
-
705
+ - ``$XDG_CONFIG_HOME/matplotlib/matplotlibrc`` (if ``$XDG_CONFIG_HOME``
706
+ is defined)
707
+ - or ``$HOME/.config/matplotlib/matplotlibrc`` (if ``$XDG_CONFIG_HOME``
708
+ is not defined)
716
709
- On other platforms,
717
-
718
- - `$HOME/.matplotlib/matplotlibrc` if `$HOME` is defined.
719
-
720
- - Lastly, it looks in `$MATPLOTLIBDATA/matplotlibrc` for a
721
- system-defined copy.
710
+ - ``$HOME/.matplotlib/matplotlibrc`` if ``$HOME`` is defined
711
+ - Lastly, it looks in ``$MATPLOTLIBDATA/matplotlibrc``, which should always
712
+ exist.
722
713
"""
723
714
724
715
def gen_candidates ():
@@ -735,10 +726,10 @@ def gen_candidates():
735
726
736
727
for fname in gen_candidates ():
737
728
if os .path .exists (fname ) and not os .path .isdir (fname ):
738
- break
739
- # Return first candidate that is a file, or last candidate if none is
740
- # valid (in that case, a warning is raised at startup by `rc_params`).
741
- return fname
729
+ return fname
730
+
731
+ raise RuntimeError ( "Could not find matplotlibrc file; your Matplotlib "
732
+ "install is broken" )
742
733
743
734
744
735
# rcParams deprecated and automatically mapped to another key.
@@ -917,17 +908,7 @@ def rc_params(fail_on_error=False):
917
908
"""Return a :class:`matplotlib.RcParams` instance from the
918
909
default matplotlib rc file.
919
910
"""
920
- fname = matplotlib_fname ()
921
- if not os .path .exists (fname ):
922
- # this should never happen, default in mpl-data should always be found
923
- message = 'could not find rc file; returning defaults'
924
- ret = RcParams ([(key , default ) for key , (default , _ ) in
925
- defaultParams .items ()
926
- if key not in _all_deprecated ])
927
- warnings .warn (message )
928
- return ret
929
-
930
- return rc_params_from_file (fname , fail_on_error )
911
+ return rc_params_from_file (matplotlib_fname (), fail_on_error )
931
912
932
913
933
914
URL_REGEX = re .compile (r'http://|https://|ftp://|file://|file:\\' )
0 commit comments