diff options
author | ptmcg <ptmcg@austin.rr.com> | 2018-10-30 06:12:52 -0500 |
---|---|---|
committer | ptmcg <ptmcg@austin.rr.com> | 2018-10-30 06:12:52 -0500 |
commit | 5137808f361881b71a972903df30989ef2a6e0dc (patch) | |
tree | 40192caa0e68e59b2454defd66c7cda4c8aa7b01 /pyparsing.py | |
parent | 0277d2eb983c0ab1595994f52d8ac70d253c61f0 (diff) | |
download | pyparsing-git-5137808f361881b71a972903df30989ef2a6e0dc.tar.gz |
Remove _Constants in favor of types.SimpleNamespace
Diffstat (limited to 'pyparsing.py')
-rw-r--r-- | pyparsing.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/pyparsing.py b/pyparsing.py index 84b6f1d..5006e4e 100644 --- a/pyparsing.py +++ b/pyparsing.py @@ -119,6 +119,12 @@ except ImportError: except ImportError:
_OrderedDict = None
+try:
+ from types import SimpleNamespace
+except ImportError:
+ class SimpleNamespace: pass
+
+
#~ sys.stderr.write( "testing pyparsing module, version %s, %s\n" % (__version__,__versionTime__ ) )
__all__ = [
@@ -199,9 +205,6 @@ def _xml_escape(data): data = data.replace(from_, to_)
return data
-class _Constants(object):
- pass
-
alphas = string.ascii_uppercase + string.ascii_lowercase
nums = "0123456789"
hexnums = nums + "ABCDEFabcdef"
@@ -5179,7 +5182,7 @@ def withClass(classname, namespace=''): classattr = "%s:class" % namespace if namespace else "class"
return withAttribute(**{classattr : classname})
-opAssoc = _Constants()
+opAssoc = SimpleNamespace()
opAssoc.LEFT = object()
opAssoc.RIGHT = object()
|