# Path: treeCl/constants.py
# ISPY3 = sys.version_info.major>=3


from abc import ABCMeta, abstractmethod, abstractproperty
from locale import getpreferredencoding
from subprocess import PIPE, Popen
from ..constants import ISPY3
from queue import Queue
import os
import shlex
import sys
import threading
import logging
logger = logging.getLogger(__name__)
POSIX = 'posix' in sys.builtin_module_names
DEFAULT_ENCODING = getpreferredencoding() or "UTF-8"


class ExternalProcessError(Exception):
    pass


def _py2_and_3_joiner(sep, joinable):
    """
    Allow '\n'.join(...) statements to work in Py2 and Py3.
    :param sep:
    :param joinable:
    :return:
    """
    if ISPY3:
        sep = bytes(sep, DEFAULT_ENCODING)
    joined = sep.join(joinable)

# Path: treeCl/constants.py
# ISPY3 = sys.version_info.major>=3


# Path: treeCl/wrappers/abstract_wrapper.py
from abc import ABCMeta, abstractmethod, abstractproperty
from locale import getpreferredencoding
from subprocess import PIPE, Popen
from ..constants import ISPY3
from queue import Queue
import os
import shlex
import sys
import threading
import logging

logger = logging.getLogger(__name__)
POSIX = 'posix' in sys.builtin_module_names
DEFAULT_ENCODING = getpreferredencoding() or "UTF-8"


class ExternalProcessError(Exception):
    pass


def _py2_and_3_joiner(sep, joinable):
    """
    Allow '\n'.join(...) statements to work in Py2 and Py3.
    :param sep:
    :param joinable:
    :return:
    """
    if ISPY3:
        sep = bytes(sep, DEFAULT_ENCODING)
    joined = sep.join(joinable)

    return joined.decode(DEFAULT_ENCODING) if ISPY3 else joined