@@ -98,6 +98,7 @@ class members that are inherited from a base class. This value can be
98
98
99
99
__all__ = ['Automoddiagram' , 'Automodsumm' , 'automodsumm_to_autosummary_lines' ,
100
100
'generate_automodsumm_docs' , 'process_automodsumm_generation' ]
101
+ logger = logging .getLogger (__name__ )
101
102
102
103
103
104
def _str_list_converter (argument ):
@@ -134,7 +135,7 @@ def run(self):
134
135
try :
135
136
localnames , fqns , objs = find_mod_objs (modname )
136
137
except ImportError :
137
- self . warn ("Couldn't import module " + modname )
138
+ logger . warning ("Couldn't import module " + modname )
138
139
return []
139
140
140
141
try :
@@ -144,8 +145,8 @@ def run(self):
144
145
clsonly = 'classes-only' in self .options
145
146
varonly = 'variables-only' in self .options
146
147
if [clsonly , funconly , varonly ].count (True ) > 1 :
147
- self . warn ('more than one of "functions-only", "classes-only", '
148
- 'or "variables-only" defined. Ignoring.' )
148
+ logger . warning ('more than one of "functions-only", "classes-only", '
149
+ 'or "variables-only" defined. Ignoring.' )
149
150
clsonly = funconly = varonly = False
150
151
151
152
skipnames = []
@@ -156,9 +157,9 @@ def run(self):
156
157
option_skipnames .remove (lnm )
157
158
skipnames .append (lnm )
158
159
if len (option_skipnames ) > 0 :
159
- self . warn ('Tried to skip objects {objs} in module {mod}, '
160
- 'but they were not present. Ignoring.'
161
- .format (objs = option_skipnames , mod = modname ))
160
+ logger . warning ('Tried to skip objects {objs} in module {mod}, '
161
+ 'but they were not present. Ignoring.'
162
+ .format (objs = option_skipnames , mod = modname ))
162
163
163
164
if funconly :
164
165
cont = []
@@ -217,7 +218,7 @@ def run(self):
217
218
218
219
nms , objs = find_mod_objs (self .arguments [0 ], onlylocals = ols )[1 :]
219
220
except ImportError :
220
- self . warn ("Couldn't import module " + self .arguments [0 ])
221
+ logger . warning ("Couldn't import module " + self .arguments [0 ])
221
222
return []
222
223
223
224
# Check if some classes should be skipped
@@ -309,8 +310,6 @@ def automodsumm_to_autosummary_lines(fn, app):
309
310
310
311
"""
311
312
312
- logger = logging .getLogger (__name__ )
313
-
314
313
fullfn = os .path .join (app .builder .env .srcdir , fn )
315
314
316
315
with io .open (fullfn , encoding = 'utf8' ) as fr :
@@ -425,8 +424,6 @@ def generate_automodsumm_docs(lines, srcfn, app=None, suffix='.rst',
425
424
426
425
from .utils import find_autosummary_in_lines_for_automodsumm as find_autosummary_in_lines
427
426
428
- logger = logging .getLogger (__name__ )
429
-
430
427
# Create our own templating environment - here we use Astropy's
431
428
# templates rather than the default autosummary templates, in order to
432
429
# allow docstrings to be shown for methods.
0 commit comments