No longer need AnsibleComposer

This commit is contained in:
Toshio Kuratomi 2015-04-02 12:35:50 -07:00
parent b4f16a5e2a
commit 369bf0d214
2 changed files with 3 additions and 42 deletions

View file

@ -1,38 +0,0 @@
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from yaml.composer import Composer
from yaml.nodes import MappingNode, ScalarNode
class AnsibleComposer(Composer):
def __init__(self):
super(Composer, self).__init__()
def compose_node(self, parent, index):
# the line number where the previous token has ended (plus empty lines)
node = Composer.compose_node(self, parent, index)
if isinstance(node, (ScalarNode, MappingNode)):
node.__datasource__ = self.name
node.__line__ = self.line
node.__column__ = node.start_mark.column + 1
node.__line__ = node.start_mark.line + 1
return node

View file

@ -36,17 +36,16 @@ if HAVE_PYYAML_C:
AnsibleConstructor.__init__(self, file_name=file_name) AnsibleConstructor.__init__(self, file_name=file_name)
Resolver.__init__(self) Resolver.__init__(self)
else: else:
from yaml.composer import Composer
from yaml.reader import Reader from yaml.reader import Reader
from yaml.scanner import Scanner from yaml.scanner import Scanner
from yaml.parser import Parser from yaml.parser import Parser
from ansible.parsing.yaml.composer import AnsibleComposer class AnsibleLoader(Reader, Scanner, Parser, Composer, AnsibleConstructor, Resolver):
class AnsibleLoader(Reader, Scanner, Parser, AnsibleComposer, AnsibleConstructor, Resolver):
def __init__(self, stream, file_name=None): def __init__(self, stream, file_name=None):
Reader.__init__(self, stream) Reader.__init__(self, stream)
Scanner.__init__(self) Scanner.__init__(self)
Parser.__init__(self) Parser.__init__(self)
AnsibleComposer.__init__(self) Composer.__init__(self)
AnsibleConstructor.__init__(self, file_name=file_name) AnsibleConstructor.__init__(self, file_name=file_name)
Resolver.__init__(self) Resolver.__init__(self)