summaryrefslogtreecommitdiff
path: root/src/update_pyparsing_timestamp.py
diff options
context:
space:
mode:
authorPaul McGuire <ptmcg@austin.rr.com>2016-03-19 22:50:29 +0000
committerPaul McGuire <ptmcg@austin.rr.com>2016-03-19 22:50:29 +0000
commit5af6ed19674e67f2a0434eb942a6e280f95902a1 (patch)
tree4fcec2571f7a538e7bd29148d6f147f28fdfe24c /src/update_pyparsing_timestamp.py
parent7924141daf8fab288b13889a907b1a80c9bca367 (diff)
downloadpyparsing-git-5af6ed19674e67f2a0434eb942a6e280f95902a1.tar.gz
Added default behavior to QuotedString to convert embedded '\t', '\n', etc. characters to their whitespace counterparts; added support in new init arg, convertWhitespaceEscapes.
Diffstat (limited to 'src/update_pyparsing_timestamp.py')
-rw-r--r--src/update_pyparsing_timestamp.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/update_pyparsing_timestamp.py b/src/update_pyparsing_timestamp.py
new file mode 100644
index 0000000..80ea3d4
--- /dev/null
+++ b/src/update_pyparsing_timestamp.py
@@ -0,0 +1,17 @@
+from pyparsing import quotedString
+from datetime import datetime
+
+nw = datetime.utcnow()
+nowstring = '"%s"' % (nw.strftime("%d %b %Y %X")[:-3] + " UTC")
+print (nowstring)
+
+quoted_time = quotedString()
+quoted_time.setParseAction(lambda: nowstring)
+
+version_time = "__versionTime__ = " + quoted_time
+with open('pyparsing.py') as oldpp:
+ new_code = version_time.transformString(oldpp.read())
+
+with open('pyparsing.py','w') as newpp:
+ newpp.write(new_code)
+