A Python library to provide functions to handle, parse and validate standard numbers. branch master updated. 2d956eb37601c712286792518aadaccded3de950
[Date Prev][
Date Next]
[Thread Prev][
Thread Next]
A Python library to provide functions to handle, parse and validate standard numbers. branch master updated. 2d956eb37601c712286792518aadaccded3de950
- From: Commits of the python-stdnum project <python-stdnum-commits [at] lists.arthurdejong.org>
- To: python-stdnum-commits [at] lists.arthurdejong.org
- Reply-to: python-stdnum-users [at] lists.arthurdejong.org
- Subject: A Python library to provide functions to handle, parse and validate standard numbers. branch master updated. 2d956eb37601c712286792518aadaccded3de950
- Date: Fri, 26 Apr 2013 23:23:16 +0200 (CEST)
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "A Python library to provide functions to handle, parse and
validate standard numbers.".
The branch, master has been updated
via 2d956eb37601c712286792518aadaccded3de950 (commit)
via 30c832f22577fc951d41fb8a80f6ecb94e0dec31 (commit)
via 51a55be5208b567e1a0a7bd17c7a7c17ea360756 (commit)
from 3f6d52a1aa5489484a83833dc194ad9ed380bf65 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://arthurdejong.org/git/python-stdnum/commit/?id=2d956eb37601c712286792518aadaccded3de950
commit 2d956eb37601c712286792518aadaccded3de950
Author: Arthur de Jong <arthur@arthurdejong.org>
Date: Fri Apr 26 23:22:29 2013 +0200
Use a cleaner way to get all stdnum modules
This mechanism should work from Python 2.6 up to and including Python 3.3.
diff --git a/stdnum/util.py b/stdnum/util.py
index 451c116..ee12508 100644
--- a/stdnum/util.py
+++ b/stdnum/util.py
@@ -1,6 +1,6 @@
# util.py - common utility functions
#
-# Copyright (C) 2012 Arthur de Jong
+# Copyright (C) 2012, 2013 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -27,6 +27,7 @@ stdnum.
import pkgutil
import pydoc
import re
+import sys
_strip_doctest_re = re.compile('^>>> .*\Z', re.DOTALL | re.MULTILINE)
@@ -43,12 +44,14 @@ def clean(number, deletechars):
def get_number_modules(base='stdnum'):
"""Yield all the module and package names under the specified module."""
- module = __import__(base, globals(), locals(), [base])
+ __import__(base)
+ module = sys.modules[base]
for loader, name, is_pkg in pkgutil.walk_packages(
module.__path__, module.__name__ + '.',
onerror=lambda x: None
):
- module = __import__(name, globals(), locals(), [name])
+ __import__(name)
+ module = sys.modules[name]
if hasattr(module, 'is_valid'):
yield module
http://arthurdejong.org/git/python-stdnum/commit/?id=30c832f22577fc951d41fb8a80f6ecb94e0dec31
commit 30c832f22577fc951d41fb8a80f6ecb94e0dec31
Author: Arthur de Jong <arthur@arthurdejong.org>
Date: Fri Apr 26 23:22:20 2013 +0200
Fix doctest to not be dependant on dict ordering
diff --git a/stdnum/numdb.py b/stdnum/numdb.py
index b3f690e..4c05b17 100644
--- a/stdnum/numdb.py
+++ b/stdnum/numdb.py
@@ -1,7 +1,7 @@
# numdb.py - module for handling hierarchically organised numbers
#
-# Copyright (C) 2010, 2011 Arthur de Jong
+# Copyright (C) 2010, 2011, 2012, 2013 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -39,20 +39,47 @@ To split a number:
To split the number and get properties for each part:
->>> dbfile.info('01006')
-[('0', {'prop1': 'foo'}), ('100', {'prop2': 'bar'}), ('6', {})]
->>> dbfile.info('02006')
-[('0', {'prop1': 'foo'}), ('200', {'prop2': 'bar', 'prop3': 'baz'}), ('6', {})]
->>> dbfile.info('03456')
-[('0', {'prop1': 'foo'}), ('345', {'prop2': 'bar', 'prop3': 'baz'}), ('6', {})]
->>> dbfile.info('902006')
-[('90', {'prop1': 'booz'}), ('20', {'prop2': 'foo'}), ('06', {})]
->>> dbfile.info('909856')
-[('90', {'prop1': 'booz'}), ('985', {'prop2': 'fooz'}), ('6', {})]
->>> dbfile.info('9889')
-[('98', {'prop1': 'booz'}), ('89', {'prop2': 'foo'})]
->>> dbfile.info('633322')
-[('6', {'prop1': 'boo'}), ('333', {'prop2': 'bar', 'prop3': 'baz'}), ('22',
{})]
+>>> dbfile.info('01006') == [
+... ('0', {'prop1': 'foo'}),
+... ('100', {'prop2': 'bar'}),
+... ('6', {}),
+... ]
+True
+>>> dbfile.info('02006') == [
+... ('0', {'prop1': 'foo'}),
+... ('200', {'prop2': 'bar', 'prop3': 'baz'}),
+... ('6', {}),
+... ]
+True
+>>> dbfile.info('03456') == [
+... ('0', {'prop1': 'foo'}),
+... ('345', {'prop2': 'bar', 'prop3': 'baz'}),
+... ('6', {}),
+... ]
+True
+>>> dbfile.info('902006') == [
+... ('90', {'prop1': 'booz'}),
+... ('20', {'prop2': 'foo'}),
+... ('06', {}),
+... ]
+True
+>>> dbfile.info('909856') == [
+... ('90', {'prop1': 'booz'}),
+... ('985', {'prop2': 'fooz'}),
+... ('6', {}),
+... ]
+True
+>>> dbfile.info('9889') == [
+... ('98', {'prop1': 'booz'}),
+... ('89', {'prop2': 'foo'}),
+... ]
+True
+>>> dbfile.info('633322') == [
+... ('6', {'prop1': 'boo'}),
+... ('333', {'prop2': 'bar', 'prop3': 'baz'}),
+... ('22', {}),
+... ]
+True
"""
http://arthurdejong.org/git/python-stdnum/commit/?id=51a55be5208b567e1a0a7bd17c7a7c17ea360756
commit 51a55be5208b567e1a0a7bd17c7a7c17ea360756
Author: Arthur de Jong <arthur@arthurdejong.org>
Date: Fri Apr 26 23:22:11 2013 +0200
Add a .gitignore file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..0df1d5c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,11 @@
+# global
+*.pyc
+*.pyo
+__pycache__
+
+# /
+/build
+/dist
+/python_stdnum.egg-info
+/.coverage
+/coverage
-----------------------------------------------------------------------
Summary of changes:
.gitignore | 11 ++++++++++
stdnum/numdb.py | 57 ++++++++++++++++++++++++++++++++++++++++--------------
stdnum/util.py | 9 +++++--
3 files changed, 59 insertions(+), 18 deletions(-)
create mode 100644 .gitignore
hooks/post-receive
--
A Python library to provide functions to handle, parse and validate standard
numbers.
--
To unsubscribe send an email to
python-stdnum-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/python-stdnum-commits/
- A Python library to provide functions to handle, parse and validate standard numbers. branch master updated. 2d956eb37601c712286792518aadaccded3de950,
Commits of the python-stdnum project