# Path: polyglot/utils.py
# class AsyncFileReader(threading.Thread):
# class LockQueue(Queue):
#     def __init__(self, fd, handler):
#     def run(self):
#     def __init__(self, *args, **kwargs):
#     def put(self, *args, **kwargs):
#     def put_nowait(self, *args, **kwargs):


from collections import defaultdict, OrderedDict
from functools import wraps
from polyglot.utils import AsyncFileReader, Empty, LockQueue
import copy
import json
import logging
import logging.handlers
import sys
import os
import threading
import time
import traceback
import xml.etree.ElementTree as ET
    import yaml
                    self.smsg('**INFO: NodeServer configuration file is different than running config... Updated file.')
                    return True
            except yaml.YAMLError as e:
                self.logger.error('**ERROR: write_nodeserver_config: {}'.format(e))
                return False
            except IOError:
                self.smsg('**ERROR: write_nodeserver_config: Could not write to nodeserver config file {}'.format(self.configfile))
                return False
        else: self.smsg('**ERROR: PyYAML module not installed... skipping custom config sections. "sudo pip install pyyaml" to use')
        return True

    # manage output
    def _send_out(self):
        """ Send output through pipe """
        while not self._outq.locked or not self._outq.empty():
            try:
                line = self._outq.get(True, 5)
            except Empty:
                pass
            else:
                sys.stdout.write('{}\n'.format(line))
                self._outq.task_done()
                sys.stdout.flush()
            time.sleep(.1)

    def _send_err(self):
        """ Send error through pipe """
        while not self._errq.locked or not self._errq.empty():
            try:
                line = self._errq.get(True, 5)

# Path: polyglot/utils.py
# class AsyncFileReader(threading.Thread):
# class LockQueue(Queue):
#     def __init__(self, fd, handler):
#     def run(self):
#     def __init__(self, *args, **kwargs):
#     def put(self, *args, **kwargs):
#     def put_nowait(self, *args, **kwargs):


# Path: polyglot/nodeserver_api.py
from collections import defaultdict, OrderedDict
from functools import wraps
from polyglot.utils import AsyncFileReader, Empty, LockQueue
import copy
import json
import logging
import logging.handlers
import sys
import os
import threading
import time
import traceback
import xml.etree.ElementTree as ET
    import yaml

                    self.smsg('**INFO: NodeServer configuration file is different than running config... Updated file.')
                    return True
            except yaml.YAMLError as e:
                self.logger.error('**ERROR: write_nodeserver_config: {}'.format(e))
                return False
            except IOError:
                self.smsg('**ERROR: write_nodeserver_config: Could not write to nodeserver config file {}'.format(self.configfile))
                return False
        else: self.smsg('**ERROR: PyYAML module not installed... skipping custom config sections. "sudo pip install pyyaml" to use')
        return True

    # manage output
    def _send_out(self):
        """ Send output through pipe """
        while not self._outq.locked or not self._outq.empty():
            try:
                line = self._outq.get(True, 5)
            except Empty:
                pass
            else:
                sys.stdout.write('{}\n'.format(line))
                self._outq.task_done()
                sys.stdout.flush()
            time.sleep(.1)

    def _send_err(self):
        """ Send error through pipe """
        while not self._errq.locked or not self._errq.empty():
            try:
                line = self._errq.get(True, 5)

            except Empty: