mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Fix PyLint C0103 on salt.renderers.yaml
+ PEP8 + Minor logic fix. Refs #1775.
This commit is contained in:
parent
1f1a1120c2
commit
524e025049
@ -12,7 +12,7 @@ from salt.exceptions import SaltRenderError
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
# code fragment taken from https://gist.github.com/844388
|
||||
has_ordered_dict = True
|
||||
HAS_ORDERED_DICT = True
|
||||
try:
|
||||
# included in standard lib from Python 2.7
|
||||
from collections import OrderedDict
|
||||
@ -22,7 +22,7 @@ except ImportError:
|
||||
try:
|
||||
from ordereddict import OrderedDict
|
||||
except ImportError:
|
||||
has_ordered_dict = False
|
||||
HAS_ORDERED_DICT = False
|
||||
|
||||
|
||||
def get_yaml_loader(argline):
|
||||
@ -38,14 +38,14 @@ Options:
|
||||
''')
|
||||
raise
|
||||
if ('-o', '') in opts:
|
||||
if has_ordered_dict:
|
||||
def Loader(*args):
|
||||
if HAS_ORDERED_DICT:
|
||||
def Loader(*args): # pylint: disable-msg=C0103
|
||||
return CustomLoader(*args, dictclass=OrderedDict)
|
||||
return Loader
|
||||
else:
|
||||
raise SaltRenderError(
|
||||
'OrderedDict not available! It is required when using '
|
||||
'the ordered option(-o) with yaml renderer.')
|
||||
raise SaltRenderError(
|
||||
'OrderedDict not available! It is required when using the ordered '
|
||||
'option(-o) with yaml renderer.'
|
||||
)
|
||||
return CustomLoader
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user