# 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
        for fun in self._handlers[cmd_code]:
            try:
                success.append(fun(**data))
            except Exception as err:
                if '--debug' in sys.argv:
                    raise err
                else:
                    err_msg = repr(err).replace('\n', '')
                    fun_name = fun.__name__
                    self.send_error('Error handling {} in function {}: {}'
                                    .format(cmd_code, fun_name, err_msg) + traceback.format_exc())
            else:
                if not success[-1]:
                    fun_name = fun.__name__
                    self.send_error('Unsuccessful handling {} in function {}'
                                    .format(cmd_code, fun_name))
        return all(success)

    def _recv_config(self, *args, **kwargs):
        """ note that the config has been received. """
        # pylint: disable=unused-argument
        self._got_config = True
        return True

    def get_params(self, **kwargs):
        """ Get the params from nodeserver and makes them available to
        the nodeserver api """
        self.isyver = kwargs['isyver']
        self.sandbox = kwargs['sandbox']
        self.name = kwargs['name']

# 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

        for fun in self._handlers[cmd_code]:
            try:
                success.append(fun(**data))
            except Exception as err:
                if '--debug' in sys.argv:
                    raise err
                else:
                    err_msg = repr(err).replace('\n', '')
                    fun_name = fun.__name__
                    self.send_error('Error handling {} in function {}: {}'
                                    .format(cmd_code, fun_name, err_msg) + traceback.format_exc())
            else:
                if not success[-1]:
                    fun_name = fun.__name__
                    self.send_error('Unsuccessful handling {} in function {}'
                                    .format(cmd_code, fun_name))
        return all(success)

    def _recv_config(self, *args, **kwargs):
        """ note that the config has been received. """
        # pylint: disable=unused-argument
        self._got_config = True
        return True

    def get_params(self, **kwargs):
        """ Get the params from nodeserver and makes them available to
        the nodeserver api """
        self.isyver = kwargs['isyver']
        self.sandbox = kwargs['sandbox']
        self.name = kwargs['name']

        self.pgver = kwargs['pgver']