@@ -114,7 +114,7 @@ def parse(self):
114
114
115
115
self ._run_conf = self ._create_run_config (self ._options )
116
116
117
- config = self ._create_check_config (self ._options , use_dafaults = False )
117
+ config = self ._create_check_config (self ._options , use_defaults = False )
118
118
self ._override_by_cli = config
119
119
120
120
@check_initialized
@@ -141,7 +141,7 @@ def _get_matches(config):
141
141
match_dir_func = re (config .match_dir + '$' ).match
142
142
return match_func , match_dir_func
143
143
144
- def _get_ignore_dec (config ):
144
+ def _get_ignore_decorators (config ):
145
145
"""Return the `ignore_decorators` as None or regex."""
146
146
if config .ignore_decorators : # not None and not ''
147
147
ignore_decorators = re (config .ignore_decorators )
@@ -154,7 +154,7 @@ def _get_ignore_dec(config):
154
154
for root , dirs , filenames in os .walk (name ):
155
155
config = self ._get_config (root )
156
156
match , match_dir = _get_matches (config )
157
- ignore_dec = _get_ignore_dec (config )
157
+ ignore_decorators = _get_ignore_decorators (config )
158
158
159
159
# Skip any dirs that do not match match_dir
160
160
dirs [:] = [dir for dir in dirs if match_dir (dir )]
@@ -163,13 +163,13 @@ def _get_ignore_dec(config):
163
163
if match (filename ):
164
164
full_path = os .path .join (root , filename )
165
165
yield (full_path , list (config .checked_codes ),
166
- ignore_dec )
166
+ ignore_decorators )
167
167
else :
168
168
config = self ._get_config (name )
169
169
match , _ = _get_matches (config )
170
- ignore_dec = _get_ignore_dec (config )
170
+ ignore_decorators = _get_ignore_decorators (config )
171
171
if match (name ):
172
- yield (name , list (config .checked_codes ), ignore_dec )
172
+ yield (name , list (config .checked_codes ), ignore_decorators )
173
173
174
174
# --------------------------- Private Methods -----------------------------
175
175
@@ -313,9 +313,8 @@ def _merge_configuration(self, parent_config, child_options):
313
313
314
314
kwargs = dict (checked_codes = error_codes )
315
315
for key in ('match' , 'match_dir' , 'ignore_decorators' ):
316
- kwargs [key ] = getattr (child_options , key ) \
317
- if getattr (child_options , key ) is not None \
318
- else getattr (parent_config , key )
316
+ kwargs [key ] = \
317
+ getattr (child_options , key ) or getattr (parent_config , key )
319
318
return CheckConfiguration (** kwargs )
320
319
321
320
def _parse_args (self , args = None , values = None ):
@@ -331,23 +330,23 @@ def _create_run_config(options):
331
330
return RunConfiguration (** values )
332
331
333
332
@classmethod
334
- def _create_check_config (cls , options , use_dafaults = True ):
333
+ def _create_check_config (cls , options , use_defaults = True ):
335
334
"""Create a `CheckConfiguration` object from `options`.
336
335
337
- If `use_dafaults `, any of the match options that are `None` will
336
+ If `use_defaults `, any of the match options that are `None` will
338
337
be replaced with their default value and the default convention will be
339
338
set for the checked codes.
340
339
341
340
"""
342
341
checked_codes = None
343
342
344
- if cls ._has_exclusive_option (options ) or use_dafaults :
343
+ if cls ._has_exclusive_option (options ) or use_defaults :
345
344
checked_codes = cls ._get_checked_errors (options )
346
345
347
346
kwargs = dict (checked_codes = checked_codes )
348
347
for key in ('match' , 'match_dir' , 'ignore_decorators' ):
349
348
kwargs [key ] = getattr (cls , 'DEFAULT_{0}_RE' .format (key .upper ())) \
350
- if getattr (options , key ) is None and use_dafaults \
349
+ if getattr (options , key ) is None and use_defaults \
351
350
else getattr (options , key )
352
351
return CheckConfiguration (** kwargs )
353
352
@@ -530,7 +529,7 @@ def _create_option_parser(cls):
530
529
help = ("ignore any functions or methods that are decorated "
531
530
"by a function with a name fitting the <decorators> "
532
531
"regular expression; default is --ignore-decorators='{0}'"
533
- "which does not ignore any decorated functions."
532
+ " which does not ignore any decorated functions."
534
533
.format (cls .DEFAULT_IGNORE_DECORATORS_RE )))
535
534
return parser
536
535
0 commit comments