From dc1a5ec85bef86add8a49cddab27d70b8deb552f Mon Sep 17 00:00:00 2001 From: xi Date: Sat, 25 Feb 2006 20:13:09 +0000 Subject: [PATCH] Remove y/n from the boolean constants. git-svn-id: http://svn.pyyaml.org/branches/pyyaml3000@59 18f92427-320e-0410-9341-c67f048884a3 --- MANIFEST.in | 1 + Makefile | 5 ++++- lib/yaml/constructor.py | 2 -- lib/yaml/resolver.py | 2 +- setup.py | 4 ++-- tests/data/bool.data | 2 +- tests/data/construct-bool.data | 2 +- tests/test_constructor.py | 4 ++++ tests/test_errors.py | 11 ++++++----- 9 files changed, 20 insertions(+), 13 deletions(-) create mode 100644 MANIFEST.in diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..c41487f --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +include README LICENSE diff --git a/Makefile b/Makefile index ca53bd7..4536e72 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -.PHONY: default build force install test clean +.PHONY: default build force install test dist-src clean PYTHON=/usr/bin/python TEST= @@ -17,6 +17,9 @@ install: build test: build ${PYTHON} tests/test_build.py ${TEST} +dist-src: + ${PYTHON} setup.py sdist --formats=zip,gztar + clean: ${PYTHON} setup.py clean -a diff --git a/lib/yaml/constructor.py b/lib/yaml/constructor.py index 0660f54..1fc3b7d 100644 --- a/lib/yaml/constructor.py +++ b/lib/yaml/constructor.py @@ -161,9 +161,7 @@ class Constructor(BaseConstructor): return None bool_values = { - u'y': True, u'yes': True, - u'n': False, u'no': False, u'true': True, u'false': False, diff --git a/lib/yaml/resolver.py b/lib/yaml/resolver.py index e3706c5..a3c041e 100644 --- a/lib/yaml/resolver.py +++ b/lib/yaml/resolver.py @@ -93,7 +93,7 @@ class Resolver(BaseResolver): Resolver.add_detector( u'tag:yaml.org,2002:bool', - re.compile(ur'''^(?:y|Y|yes|Yes|YES|n|N|no|No|NO + re.compile(ur'''^(?:yes|Yes|YES|n|N|no|No|NO |true|True|TRUE|false|False|FALSE |on|On|ON|off|Off|OFF)$''', re.X), list(u'yYnNtTfFoO')) diff --git a/setup.py b/setup.py index e6c1652..e1f12d1 100644 --- a/setup.py +++ b/setup.py @@ -1,10 +1,10 @@ NAME = 'PyYAML3000' VERSION = '0.1' -DESCRIPTION = "YAML parser (and emitter)" +DESCRIPTION = "The next generation YAML parser for Python" AUTHOR = "Kirill Simonov" AUTHOR_EMAIL = 'xi@resolvent.net' -LICENSE = "BSD" +LICENSE = "MIT" from distutils.core import setup diff --git a/tests/data/bool.data b/tests/data/bool.data index 3f28955..0988b63 100644 --- a/tests/data/bool.data +++ b/tests/data/bool.data @@ -1,4 +1,4 @@ -- y +- yes - NO - True - on diff --git a/tests/data/construct-bool.data b/tests/data/construct-bool.data index 2a8f2e6..e751222 100644 --- a/tests/data/construct-bool.data +++ b/tests/data/construct-bool.data @@ -1,4 +1,4 @@ -canonical: y +canonical: yes answer: NO logical: True option: on diff --git a/tests/test_constructor.py b/tests/test_constructor.py index e3895fa..794d3e4 100644 --- a/tests/test_constructor.py +++ b/tests/test_constructor.py @@ -4,6 +4,10 @@ try: import datetime except ImportError: pass +try: + set +except NameError: + from sets import Set as set from yaml import * diff --git a/tests/test_errors.py b/tests/test_errors.py index 74ba9f2..626b4e4 100644 --- a/tests/test_errors.py +++ b/tests/test_errors.py @@ -26,6 +26,7 @@ class TestErrors(test_appliance.TestAppliance): #except ScannerError, exc: #except ParserError, exc: #except ComposerError, exc: + #except ConstructorError, exc: #print '.'*70 #print "%s:" % exc.__class__.__name__, exc raise @@ -39,14 +40,14 @@ class TestErrors(test_appliance.TestAppliance): resolver = Resolver(composer) constructor = Constructor(resolver) return list(constructor) - #except YAMLError, exc: + except YAMLError, exc: #except ScannerError, exc: #except ParserError, exc: #except ComposerError, exc: - except ConstructorError, exc: - print '.'*70 - print "%s:" % filename - print "%s:" % exc.__class__.__name__, exc + #except ConstructorError, exc: + #print '.'*70 + #print "%s:" % filename + #print "%s:" % exc.__class__.__name__, exc raise TestErrors.add_tests('testErrors', '.error-message') -- 2.11.4.GIT