From e9f0b0f182f92ca7048d34cda6d0b3bd699049f8 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Tue, 22 Nov 2011 14:49:33 +1100 Subject: [PATCH] tweaks --- README.rst | 7 +++++-- parse.py | 7 ++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/README.rst b/README.rst index 13aa69e..d11a046 100644 --- a/README.rst +++ b/README.rst @@ -55,7 +55,7 @@ where a more complex format specification might have been used. Most of the `Format Specification Mini-Language`_ is supported:: - [[fill]align][sign][0][width][type] + [[fill]align][0][width][type] The align operators will cause spaces (or specified fill character) to be stripped from the value. Similarly width is not enforced; it @@ -64,7 +64,8 @@ just indicates there may be whitespace or "0"s to strip. The "#" format character is handled automatically by d, b, o and x - that is: if there is a "0b", "0o" or "0x" prefix respectively, it's handled. For "d" any will be accepted, but for the others the correct -prefix must be present if at all. +prefix must be present if at all. Similarly number sign is handled +automatically. The types supported are a slightly different mix to the format() types. Some format() types come directly over: d, n, %, f, e, b, o and x. @@ -176,6 +177,8 @@ spans **Version history (in brief)**: +- 1.1.9 to keep things simpler number sign is handled automatically; + significant robustification in the face of edge-case input. - 1.1.8 allow "d" fields to have number base "0x" etc. prefixes; fix up some field type interactions after stress-testing the parser; implement "%" type. diff --git a/parse.py b/parse.py index 9c14be0..a75f8f8 100644 --- a/parse.py +++ b/parse.py @@ -68,7 +68,8 @@ just indicates there may be whitespace or "0"s to strip. The "#" format character is handled automatically by d, b, o and x - that is: if there is a "0b", "0o" or "0x" prefix respectively, it's handled. For "d" any will be accepted, but for the others the correct -prefix must be present if at all. +prefix must be present if at all. Similarly number sign is handled +automatically. The types supported are a slightly different mix to the format() types. Some format() types come directly over: d, n, %, f, e, b, o and x. @@ -181,7 +182,7 @@ spans **Version history (in brief)**: - 1.1.9 to keep things simpler number sign is handled automatically; - more parsing edge-cases handled. + significant robustification in the face of edge-case input. - 1.1.8 allow "d" fields to have number base "0x" etc. prefixes; fix up some field type interactions after stress-testing the parser; implement "%" type. @@ -1119,10 +1120,10 @@ class TestParse(unittest.TestCase): self.assertRaises(TooManyFields, compile, '{:ti}' * 20) - if __name__ == '__main__': unittest.main() + # Copyright (c) 2011 eKit.com Inc (http://www.ekit.com/) # # Permission is hereby granted, free of charge, to any person obtaining a copy