# Path: newsreap/NNTPIOStream.py
# NNTP_DEFAULT_ENCODING = 'ISO-8859-1'
# 
# Path: newsreap/NNTPIOStream.py
# class NNTPIOStream(object):
#     """
#     Defines the supported NNTP Input/Output Streams
# 
#     """
#     # RFC-3977 Standard NNTP Stream - No compression at all
#     RFC3977 = 'rfc3977'
# 
#     # GZip RFC-3977 (COMPRESS Keyword used)
#     RFC3977_GZIP = 'gzip.rfc3977'
# 
# Path: newsreap/Utils.py
# def parse_bool(arg, default=False):
#     """
#     Parses strings such as 'yes' and 'no' as well as other strings such as
#     'on' or 'off' , 'enable' or 'disable', etc.
# 
#     This method can just simplify checks to these variables.
# 
#     If the content could not be parsed, then the default is
#     returned.
#     """
# 
#     if isinstance(arg, basestring):
#         # no = no - False
#         # of = short for off - False
#         # 0  = int for False
#         # fa = short for False - False
#         # f  = short for False - False
#         # n  = short for No or Never - False
#         # ne  = short for Never - False
#         # di  = short for Disable(d) - False
#         # de  = short for Deny - False
#         if arg.lower()[0:2] in ('de', 'di', 'ne', 'f', 'n', 'no', 'of',
#                                 '0', 'fa'):
#             return False
#         # ye = yes - True
#         # on = short for off - True
#         # 1  = int for True
#         # tr = short for True - True
#         # t  = short for True - True
#         # al = short for Always (and Allow) - True
#         # en  = short for Enable(d) - True
#         elif arg.lower()[0:2] in ('en', 'al', 't', 'y', 'ye', 'on', '1',
#                                   'tr'):
#             return True
#         # otherwise
#         return default
# 
#     # Handle other types
#     return bool(arg)
# 
# Path: newsreap/Logging.py
# NEWSREAP_ENGINE = '%s.engine' % NEWSREAP_LOGGER


import gevent.monkey
import re
import sys
import yaml
import logging
from os import name as os_name
from os.path import join
from os.path import isfile
from os.path import dirname
from os.path import abspath
from os.path import expanduser
from yaml.scanner import ScannerError
from yaml.parser import ParserError
from operator import itemgetter
from copy import deepcopy
    from newsreap.NNTPDatabase import NNTPDatabase
    from newsreap.NNTPDatabase import NNTPDatabase
from newsreap.NNTPIOStream import NNTP_DEFAULT_ENCODING
from newsreap.NNTPIOStream import NNTPIOStream
from newsreap.Utils import parse_bool
from newsreap.Logging import NEWSREAP_ENGINE
        # Strip out only the information we're not interested in
        self.nntp_processing.update({
            k: self.cfg_data[PROCESSING_KEY][k]
            for k in DEFAULT_PROCESSING_VARIABLES.keys()
            if k in self.cfg_data[PROCESSING_KEY]})

        self.nntp_database.update({
            k: self.cfg_data[DATABASE_KEY][k]
            for k in DEFAULT_DATABASE_VARIABLES.keys()
            if k in self.cfg_data[DATABASE_KEY]})

        self.nntp_posting.update({
            k: self.cfg_data[POSTING_KEY][k]
            for k in DEFAULT_POSTING_VARIABLES.keys()
            if k in self.cfg_data[POSTING_KEY]})

        # Parse our content
        _priority = 0
        # Load our Server configuration
        for s in self.cfg_data[SERVER_LIST_KEY]:
            # Defaults
            results = dict(DEFAULT_SERVER_VARIABLES)

            if 'compress' in s:
                # compress flag to over-ride iostream variable; this simplifies
                # the iostream variable for users
                if parse_bool(s['compress']):
                    s['iostream'] = NNTPIOStream.RFC3977_GZIP

                else:

# Path: newsreap/NNTPIOStream.py
# NNTP_DEFAULT_ENCODING = 'ISO-8859-1'
# 
# Path: newsreap/NNTPIOStream.py
# class NNTPIOStream(object):
#     """
#     Defines the supported NNTP Input/Output Streams
# 
#     """
#     # RFC-3977 Standard NNTP Stream - No compression at all
#     RFC3977 = 'rfc3977'
# 
#     # GZip RFC-3977 (COMPRESS Keyword used)
#     RFC3977_GZIP = 'gzip.rfc3977'
# 
# Path: newsreap/Utils.py
# def parse_bool(arg, default=False):
#     """
#     Parses strings such as 'yes' and 'no' as well as other strings such as
#     'on' or 'off' , 'enable' or 'disable', etc.
# 
#     This method can just simplify checks to these variables.
# 
#     If the content could not be parsed, then the default is
#     returned.
#     """
# 
#     if isinstance(arg, basestring):
#         # no = no - False
#         # of = short for off - False
#         # 0  = int for False
#         # fa = short for False - False
#         # f  = short for False - False
#         # n  = short for No or Never - False
#         # ne  = short for Never - False
#         # di  = short for Disable(d) - False
#         # de  = short for Deny - False
#         if arg.lower()[0:2] in ('de', 'di', 'ne', 'f', 'n', 'no', 'of',
#                                 '0', 'fa'):
#             return False
#         # ye = yes - True
#         # on = short for off - True
#         # 1  = int for True
#         # tr = short for True - True
#         # t  = short for True - True
#         # al = short for Always (and Allow) - True
#         # en  = short for Enable(d) - True
#         elif arg.lower()[0:2] in ('en', 'al', 't', 'y', 'ye', 'on', '1',
#                                   'tr'):
#             return True
#         # otherwise
#         return default
# 
#     # Handle other types
#     return bool(arg)
# 
# Path: newsreap/Logging.py
# NEWSREAP_ENGINE = '%s.engine' % NEWSREAP_LOGGER


# Path: newsreap/NNTPSettings.py
import gevent.monkey
import re
import sys
import yaml
import logging
from os import name as os_name
from os.path import join
from os.path import isfile
from os.path import dirname
from os.path import abspath
from os.path import expanduser
from yaml.scanner import ScannerError
from yaml.parser import ParserError
from operator import itemgetter
from copy import deepcopy
    from newsreap.NNTPDatabase import NNTPDatabase
    from newsreap.NNTPDatabase import NNTPDatabase
from newsreap.NNTPIOStream import NNTP_DEFAULT_ENCODING
from newsreap.NNTPIOStream import NNTPIOStream
from newsreap.Utils import parse_bool
from newsreap.Logging import NEWSREAP_ENGINE

        # Strip out only the information we're not interested in
        self.nntp_processing.update({
            k: self.cfg_data[PROCESSING_KEY][k]
            for k in DEFAULT_PROCESSING_VARIABLES.keys()
            if k in self.cfg_data[PROCESSING_KEY]})

        self.nntp_database.update({
            k: self.cfg_data[DATABASE_KEY][k]
            for k in DEFAULT_DATABASE_VARIABLES.keys()
            if k in self.cfg_data[DATABASE_KEY]})

        self.nntp_posting.update({
            k: self.cfg_data[POSTING_KEY][k]
            for k in DEFAULT_POSTING_VARIABLES.keys()
            if k in self.cfg_data[POSTING_KEY]})

        # Parse our content
        _priority = 0
        # Load our Server configuration
        for s in self.cfg_data[SERVER_LIST_KEY]:
            # Defaults
            results = dict(DEFAULT_SERVER_VARIABLES)

            if 'compress' in s:
                # compress flag to over-ride iostream variable; this simplifies
                # the iostream variable for users
                if parse_bool(s['compress']):
                    s['iostream'] = NNTPIOStream.RFC3977_GZIP

                else:

                    s['iostream'] = NNTPIOStream.RFC3977