comparison configmix/__init__.py @ 207:b3b5ed34d180

Handle most flake8 errors and warnings. NOTE: E265 "block comment should start with '# ' ist not yet handled. We would need to adjust our Python style.
author Franz Glasner <fzglas.hg@dom66.de>
date Sun, 05 May 2019 18:29:47 +0200
parents 5064e3a2e54a
children 657cf709463b
comparison
equal deleted inserted replaced
206:5064e3a2e54a 207:b3b5ed34d180
32 32
33 from .compat import u, u2fs 33 from .compat import u, u2fs
34 from .config import Configuration 34 from .config import Configuration
35 35
36 36
37 COMMENTS = [u("__comment"), 37 COMMENTS = [
38 u("__doc"), 38 u("__comment"),
39 u("__doc"),
39 ] 40 ]
40 """Prefixes for comment configuration keys that are to be handled as 41 """Prefixes for comment configuration keys that are to be handled as
41 comments 42 comments
42 43
43 """ 44 """
310 both a and bhave a key who's value is a dict then dict_merge is called 311 both a and bhave a key who's value is a dict then dict_merge is called
311 on both values and the result stored in the returned dictionary.""" 312 on both values and the result stored in the returned dictionary."""
312 313
313 if not isinstance(b, dict): 314 if not isinstance(b, dict):
314 return b 315 return b
315 result = deepcopy(a) 316 result = deepcopy(a) # noqa
316 for k, v in b.iteritems(): 317 for k, v in b.iteritems():
317 if k in result and isinstance(result[k], dict): 318 if k in result and isinstance(result[k], dict):
318 result[k] = dict_merge(result[k], v) 319 result[k] = dict_merge(result[k], v)
319 else: 320 else:
320 result[k] = deepcopy(v) 321 result[k] = deepcopy(v) # noqa
321 return result 322 return result
322 323
323 324
324 def merge(user, default, filter_comments=True): 325 def merge(user, default, filter_comments=True):
325 """Logically merge the configuration in `user` into `default`. 326 """Logically merge the configuration in `user` into `default`.