diff --git a/v2/ansible/parsing/yaml/objects.py b/v2/ansible/parsing/yaml/objects.py index fe37eaab94a..33ea1ad37e4 100644 --- a/v2/ansible/parsing/yaml/objects.py +++ b/v2/ansible/parsing/yaml/objects.py @@ -19,14 +19,17 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -class AnsibleBaseYAMLObject: +from six import text_type + + +class AnsibleBaseYAMLObject(object): ''' the base class used to sub-class python built-in objects so that we can add attributes to them during yaml parsing ''' - _data_source = None - _line_number = 0 + _data_source = None + _line_number = 0 _column_number = 0 def _get_ansible_position(self): @@ -36,21 +39,27 @@ class AnsibleBaseYAMLObject: try: (src, line, col) = obj except (TypeError, ValueError): - raise AssertionError('ansible_pos can only be set with a tuple/list of three values: source, line number, column number') - self._data_source = src - self._line_number = line + raise AssertionError( + 'ansible_pos can only be set with a tuple/list ' + 'of three values: source, line number, column number' + ) + self._data_source = src + self._line_number = line self._column_number = col ansible_pos = property(_get_ansible_position, _set_ansible_position) + class AnsibleMapping(AnsibleBaseYAMLObject, dict): ''' sub class for dictionaries ''' pass -class AnsibleUnicode(AnsibleBaseYAMLObject, unicode): + +class AnsibleUnicode(AnsibleBaseYAMLObject, text_type): ''' sub class for unicode objects ''' pass + class AnsibleSequence(AnsibleBaseYAMLObject, list): ''' sub class for lists ''' pass