# Path: ncclient/operations/rpc.py
# class RPCError(OperationError):
# class RPCReply(object):
# class RPCReplyListener(SessionListener): # internal use
# class RaiseMode(object):
# class RPC(object):
# class GenericRPC(RPC):
#     def __init__(self, raw, errs=None):
#     def to_dict(self):
#     def xml(self):
#     def type(self):
#     def tag(self):
#     def app_tag(self):
#     def severity(self):
#     def path(self):
#     def message(self):
#     def info(self):
#     def errlist(self):
#     def __init__(self, raw, huge_tree=False, parsing_error_transform=None):
#     def __repr__(self):
#     def parse(self):
#     def _parsing_hook(self, root):
#     def set_parsing_error_transform(self, transform_function):
#     def xml(self):
#     def ok(self):
#     def error(self):
#     def errors(self):
#     def __new__(cls, session, device_handler):
#     def register(self, id, rpc):
#     def callback(self, root, raw):
#     def errback(self, err):
#     def __init__(self, session, device_handler, async_mode=False, timeout=30, raise_mode=RaiseMode.NONE, huge_tree=False):
#     def _wrap(self, subele):
#     def _request(self, op):
#     def request(self):
#     def _assert(self, capability):
#     def deliver_reply(self, raw):
#     def deliver_error(self, err):
#     def reply(self):
#     def error(self):
#     def id(self):
#     def session(self):
#     def event(self):
#     def __set_async(self, async_mode=True):
#     def __set_raise_mode(self, mode):
#     def __set_timeout(self, timeout):
#     def huge_tree(self):
#     def huge_tree(self, x):
#     def request(self, rpc_command, source=None, filter=None, config=None, target=None, format=None):
#     ERROR_CLS = RPCError
#     NONE = 0
#     ERRORS = 1
#     ALL = 2
#     DEPENDS = []
#     REPLY_CLS = RPCReply
#     REPLY_CLS = RPCReply


import os
import difflib
import logging
from threading import Lock
from xml.sax.handler import ContentHandler
from lxml import etree
from lxml.builder import E
from xml.sax._exceptions import SAXParseException
from xml.sax import make_parser
from ncclient.transport.parser import DefaultXMLParser
from ncclient.operations import rpc
from ncclient.transport.parser import SAXFilterXMLNotFoundError
from ncclient.transport.parser import MSG_DELIM, MSG_DELIM_LEN
from ncclient.operations.errors import OperationError
from ncclient.xml_ import BASE_NS_1_0
# Copyright 2018 Nitin Kumar

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.






logger = logging.getLogger("ncclient.transport.third_party.junos.parser")


RPC_REPLY_END_TAG = "</rpc-reply>"
RFC_RPC_REPLY_END_TAG = "</nc:rpc-reply>"


class JunosXMLParser(DefaultXMLParser):

# Path: ncclient/operations/rpc.py
# class RPCError(OperationError):
# class RPCReply(object):
# class RPCReplyListener(SessionListener): # internal use
# class RaiseMode(object):
# class RPC(object):
# class GenericRPC(RPC):
#     def __init__(self, raw, errs=None):
#     def to_dict(self):
#     def xml(self):
#     def type(self):
#     def tag(self):
#     def app_tag(self):
#     def severity(self):
#     def path(self):
#     def message(self):
#     def info(self):
#     def errlist(self):
#     def __init__(self, raw, huge_tree=False, parsing_error_transform=None):
#     def __repr__(self):
#     def parse(self):
#     def _parsing_hook(self, root):
#     def set_parsing_error_transform(self, transform_function):
#     def xml(self):
#     def ok(self):
#     def error(self):
#     def errors(self):
#     def __new__(cls, session, device_handler):
#     def register(self, id, rpc):
#     def callback(self, root, raw):
#     def errback(self, err):
#     def __init__(self, session, device_handler, async_mode=False, timeout=30, raise_mode=RaiseMode.NONE, huge_tree=False):
#     def _wrap(self, subele):
#     def _request(self, op):
#     def request(self):
#     def _assert(self, capability):
#     def deliver_reply(self, raw):
#     def deliver_error(self, err):
#     def reply(self):
#     def error(self):
#     def id(self):
#     def session(self):
#     def event(self):
#     def __set_async(self, async_mode=True):
#     def __set_raise_mode(self, mode):
#     def __set_timeout(self, timeout):
#     def huge_tree(self):
#     def huge_tree(self, x):
#     def request(self, rpc_command, source=None, filter=None, config=None, target=None, format=None):
#     ERROR_CLS = RPCError
#     NONE = 0
#     ERRORS = 1
#     ALL = 2
#     DEPENDS = []
#     REPLY_CLS = RPCReply
#     REPLY_CLS = RPCReply


# Path: ncclient/transport/third_party/junos/parser.py
import os
import difflib
import logging
from threading import Lock
from xml.sax.handler import ContentHandler
from lxml import etree
from lxml.builder import E
from xml.sax._exceptions import SAXParseException
from xml.sax import make_parser
from ncclient.transport.parser import DefaultXMLParser
from ncclient.operations import rpc
from ncclient.transport.parser import SAXFilterXMLNotFoundError
from ncclient.transport.parser import MSG_DELIM, MSG_DELIM_LEN
from ncclient.operations.errors import OperationError
from ncclient.xml_ import BASE_NS_1_0

# Copyright 2018 Nitin Kumar

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.






logger = logging.getLogger("ncclient.transport.third_party.junos.parser")


RPC_REPLY_END_TAG = "</rpc-reply>"
RFC_RPC_REPLY_END_TAG = "</nc:rpc-reply>"


class JunosXMLParser(DefaultXMLParser):

    def __init__(self, session):