@@ -244,9 +244,8 @@ def _set_logger_verbose_level(level_str='silent', file_str='sys.stdout'):
244
244
fileo = open (file_str , 'w' )
245
245
# if this fails, we will just write to stdout
246
246
except IOError :
247
- logging .warning ('could not open log file "{0}"'
248
- 'for writing. Check your '
249
- 'matplotlibrc' .format (file_str ))
247
+ _log .warning ('could not open log file "{0}" for writing. '
248
+ 'Check your matplotlibrc' .format (file_str ))
250
249
console = logging .StreamHandler (fileo )
251
250
console .setLevel (newlev )
252
251
_log .addHandler (console )
@@ -307,10 +306,9 @@ def set_level(self, level):
307
306
if self ._commandLineVerbose is not None :
308
307
level = self ._commandLineVerbose
309
308
if level not in self .levels :
310
- cbook ._warn_external (
311
- 'matplotlib: unrecognized --verbose-* string "%s". Legal '
312
- 'values are %s' % (
313
- level , self .levels ))
309
+ cbook ._warn_external ('matplotlib: unrecognized --verbose-* '
310
+ 'string "%s". Legal values are %s' %
311
+ (level , self .levels ))
314
312
else :
315
313
self .level = level
316
314
@@ -489,10 +487,9 @@ def checkdep_ps_distiller(s):
489
487
gs_exec , gs_v = checkdep_ghostscript ()
490
488
if not gs_exec :
491
489
flag = False
492
-
493
- logging .warning ('matplotlibrc ps.usedistiller option can not be used '
494
- 'unless ghostscript 9.0 or later is installed on your '
495
- 'system' )
490
+ _log .warning ('matplotlibrc ps.usedistiller option can not be used '
491
+ 'unless ghostscript 9.0 or later is installed on your '
492
+ 'system' )
496
493
497
494
if s == 'xpdf' :
498
495
pdftops_req = '3.0'
@@ -505,9 +502,9 @@ def checkdep_ps_distiller(s):
505
502
pass
506
503
else :
507
504
flag = False
508
- logging .warning (('matplotlibrc ps.usedistiller can not be set to '
509
- 'xpdf unless xpdf-%s or later is installed on '
510
- 'your system' ) % pdftops_req )
505
+ _log .warning (('matplotlibrc ps.usedistiller can not be set to '
506
+ 'xpdf unless xpdf-%s or later is installed on '
507
+ 'your system' ) % pdftops_req )
511
508
512
509
if flag :
513
510
return s
@@ -525,23 +522,22 @@ def checkdep_usetex(s):
525
522
526
523
if shutil .which ("tex" ) is None :
527
524
flag = False
528
- logging .warning (
529
- 'matplotlibrc text.usetex option can not be used unless TeX is '
530
- 'installed on your system' )
525
+ _log .warning ('matplotlibrc text.usetex option can not be used unless '
526
+ 'TeX is installed on your system' )
531
527
532
528
dvipng_v = checkdep_dvipng ()
533
529
if not compare_versions (dvipng_v , dvipng_req ):
534
530
flag = False
535
- logging .warning ('matplotlibrc text.usetex can not be used with *Agg '
536
- 'backend unless dvipng-%s or later is installed on '
537
- 'your system' % dvipng_req )
531
+ _log .warning ('matplotlibrc text.usetex can not be used with *Agg '
532
+ 'backend unless dvipng-%s or later is installed on '
533
+ 'your system' % dvipng_req )
538
534
539
535
gs_exec , gs_v = checkdep_ghostscript ()
540
536
if not compare_versions (gs_v , gs_req ):
541
537
flag = False
542
- logging .warning ('matplotlibrc text.usetex can not be used unless '
543
- 'ghostscript-%s or later is installed on your system'
544
- % gs_req )
538
+ _log .warning ('matplotlibrc text.usetex can not be used unless '
539
+ 'ghostscript-%s or later is installed on your system'
540
+ % gs_req )
545
541
546
542
return flag
547
543
@@ -958,17 +954,17 @@ def _rc_params_in_file(fname, fail_on_error=False):
958
954
tup = strippedline .split (':' , 1 )
959
955
if len (tup ) != 2 :
960
956
error_details = _error_details_fmt % (cnt , line , fname )
961
- logging .warning ('Illegal %s' % error_details )
957
+ _log .warning ('Illegal %s' % error_details )
962
958
continue
963
959
key , val = tup
964
960
key = key .strip ()
965
961
val = val .strip ()
966
962
if key in rc_temp :
967
- logging .warning ('Duplicate key in file "%s", line #%d' %
963
+ _log .warning ('Duplicate key in file "%s", line #%d' %
968
964
(fname , cnt ))
969
965
rc_temp [key ] = (val , line , cnt )
970
966
except UnicodeDecodeError :
971
- logging .warning (
967
+ _log .warning (
972
968
('Cannot decode configuration file %s with '
973
969
'encoding %s, check LANG and LC_* variables' )
974
970
% (fname , locale .getpreferredencoding (do_setlocale = False ) or
@@ -987,8 +983,8 @@ def _rc_params_in_file(fname, fail_on_error=False):
987
983
config [key ] = val # try to convert to proper type or skip
988
984
except Exception as msg :
989
985
error_details = _error_details_fmt % (cnt , line , fname )
990
- logging .warning ('Bad val "%s" on %s\n \t %s' %
991
- (val , error_details , msg ))
986
+ _log .warning ('Bad val "%s" on %s\n \t %s' %
987
+ (val , error_details , msg ))
992
988
993
989
for key , (val , line , cnt ) in rc_temp .items ():
994
990
if key in defaultParams :
@@ -999,8 +995,8 @@ def _rc_params_in_file(fname, fail_on_error=False):
999
995
config [key ] = val # try to convert to proper type or skip
1000
996
except Exception as msg :
1001
997
error_details = _error_details_fmt % (cnt , line , fname )
1002
- logging .warning ('Bad val "%s" on %s\n \t %s' %
1003
- (val , error_details , msg ))
998
+ _log .warning ('Bad val "%s" on %s\n \t %s' %
999
+ (val , error_details , msg ))
1004
1000
elif key in _deprecated_ignore_map :
1005
1001
version , alt_key = _deprecated_ignore_map [key ]
1006
1002
cbook .warn_deprecated (
@@ -1424,7 +1420,7 @@ def _init_tests():
1424
1420
from matplotlib import ft2font
1425
1421
if (ft2font .__freetype_version__ != LOCAL_FREETYPE_VERSION or
1426
1422
ft2font .__freetype_build_type__ != 'local' ):
1427
- logging .warning (
1423
+ _log .warning (
1428
1424
"Matplotlib is not built with the correct FreeType version to run "
1429
1425
"tests. Set local_freetype=True in setup.cfg and rebuild. "
1430
1426
"Expect many image comparison failures below. "
@@ -1765,10 +1761,9 @@ def inner(ax, *args, data=None, **kwargs):
1765
1761
else :
1766
1762
cbook ._warn_external (
1767
1763
"Tried to set a label via parameter %r in func %r but "
1768
- "couldn't find such an argument.\n "
1769
- "(This is a programming error, please report to "
1770
- "the Matplotlib list!)" % (label_namer ,
1771
- func .__name__ ),
1764
+ "couldn't find such an argument.\n (This is a "
1765
+ "programming error, please report to the Matplotlib "
1766
+ "list!)" % (label_namer , func .__name__ ),
1772
1767
RuntimeWarning )
1773
1768
return func (ax , * args , ** kwargs )
1774
1769
0 commit comments