summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul McGuire <ptmcg@users.noreply.github.com>2020-08-19 14:20:33 -0500
committerPaul McGuire <ptmcg@users.noreply.github.com>2020-08-19 14:20:33 -0500
commitca2dd9fd04947f1096be55677875f07983136dd0 (patch)
tree339583b987f6922b5779b955d70550a14bf35281
parent4e258967a47e2740199eb7a43d18e8ea1af68247 (diff)
downloadpyparsing-git-ca2dd9fd04947f1096be55677875f07983136dd0.tar.gz
Add __version_info__ module attribute, similar in content and structure to sys.version_info
-rw-r--r--CHANGES10
-rw-r--r--pyparsing/__init__.py14
2 files changed, 21 insertions, 3 deletions
diff --git a/CHANGES b/CHANGES
index 6b835ee..40de70b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -29,16 +29,26 @@ Version 3.0.0b1
min and max length specification, if applicable, similar to regex length
specifications:
+ Word(alphas) -> "W:(A-Za-z)"
Word(nums) -> "W:(0-9)"
Word(nums, exact=3) -> "W:(0-9){3}"
Word(nums, min=2) -> "W:(0-9){2,...}"
Word(nums, max=3) -> "W:(0-9){1,3}"
Word(nums, min=2, max=3) -> "W:(0-9){2,3}"
+ For expressions of the Char class (similar to Word(..., exact=1), the expression
+ is simply the character range in parentheses:
+
+ Char(nums) -> "(0-9)"
+ Char(alphas) -> "(A-Za-z)"
+
- Removed copy() override in Keyword class which did not preserve definition
of ident chars from the original expression. PR #233 submitted by jgrey4296,
thanks!
+- In addition to pyparsing.__version__, there is now also a pyparsing.__version_info__,
+ following the same structure and names as in sys.version_info.
+
Version 3.0.0a2 - June, 2020
----------------------------
diff --git a/pyparsing/__init__.py b/pyparsing/__init__.py
index c2d0ffb..4e6ec5e 100644
--- a/pyparsing/__init__.py
+++ b/pyparsing/__init__.py
@@ -93,9 +93,17 @@ classes inherit from. Use the docstrings for examples of how to:
- find more useful common expressions in the :class:`pyparsing_common`
namespace class
"""
-
-__version__ = "3.0.0b1"
-__versionTime__ = "19 July 2020 22:54 UTC"
+from collections import namedtuple
+
+version_info = namedtuple("version_info", "major minor micro releaseLevel serial")
+__version_info__ = version_info(3, 0, 0, "beta", 1)
+__version__ = (
+ "{}.{}.{}".format(*__version_info__[:3])
+ + ("{}{}".format(__version_info__.releaseLevel[0], __version_info__.serial), "")[
+ __version_info__.releaseLevel == "final"
+ ]
+)
+__versionTime__ = "19 August 2020 19:09 UTC"
__author__ = "Paul McGuire <ptmcg@users.sourceforge.net>"
from .util import *