diff --git a/pyhocon/config_parser.py b/pyhocon/config_parser.py index 79b5ee7f..44dc6346 100644 --- a/pyhocon/config_parser.py +++ b/pyhocon/config_parser.py @@ -8,7 +8,20 @@ import socket import sys from datetime import timedelta -from glob import glob + +import pyparsing + +class ParseResults(pyparsing.ParseResults): + def __getattr__(self, item): + if item == '__deepcopy__': + raise AttributeError(item) + try: + return self[item] + except KeyError: + return "" + + +pyparsing.ParseResults = ParseResults from pyparsing import (Forward, Group, Keyword, Literal, Optional, ParserElement, ParseSyntaxException, QuotedString, @@ -16,6 +29,7 @@ Word, ZeroOrMore, alphanums, alphas8bit, col, lineno, replaceWith) + import asset from pyhocon.config_tree import (ConfigInclude, ConfigList, ConfigQuotedString, ConfigSubstitution, ConfigTree, @@ -46,6 +60,8 @@ def glob(pathname, recursive=False): warnings.warn('This version of python (%s) does not support recursive import' % sys.version) from glob import glob as _glob return _glob(pathname) +else: + from glob import glob logger = logging.getLogger(__name__) diff --git a/pyhocon/config_tree.py b/pyhocon/config_tree.py index 48c38847..b446c4de 100644 --- a/pyhocon/config_tree.py +++ b/pyhocon/config_tree.py @@ -1,4 +1,17 @@ from collections import OrderedDict + +import pyparsing +class ParseResults(pyparsing.ParseResults): + class ParseResults(pyparsing.ParseResults): + def __getattr__(self, item): + if item == '__deepcopy__': + raise AttributeError(item) + try: + return self[item] + except KeyError: + return "" + + from pyparsing import lineno from pyparsing import col try: diff --git a/pyhocon/converter.py b/pyhocon/converter.py index 404c7571..bb51e851 100644 --- a/pyhocon/converter.py +++ b/pyhocon/converter.py @@ -14,6 +14,7 @@ basestring except NameError: basestring = str + unicode = str class HOCONConverter(object): diff --git a/setup.py b/setup.py index 46ce7f8f..6f6c2a38 100755 --- a/setup.py +++ b/setup.py @@ -46,6 +46,7 @@ def run_tests(self): 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8' ], packages=[ 'pyhocon',