Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/stdnum/us
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2011-08-19 10:22:13 +0200
committerArthur de Jong <arthur@arthurdejong.org>2011-08-19 10:22:13 +0200
commit881e8a6a2429b43180e1ece0148077bdb77c59d5 (patch)
treea68cb2dc12bd38f3d73528b9bb7ec705b5fe2093 /stdnum/us
parent8dbcedd38baa7b04ae66fd4c1908b8eb2dddc613 (diff)
make source code layout follow PEP8 more
git-svn-id: http://arthurdejong.org/svn/python-stdnum/python-stdnum@76 9dea7c4f-944c-4273-ac1a-574ede026edc
Diffstat (limited to 'stdnum/us')
-rw-r--r--stdnum/us/ssn.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/stdnum/us/ssn.py b/stdnum/us/ssn.py
index 507b1b5..62752e6 100644
--- a/stdnum/us/ssn.py
+++ b/stdnum/us/ssn.py
@@ -38,13 +38,15 @@ import re
_ssn_re = re.compile('^(?P<area>[0-9]{3})-?(?P<group>[0-9]{2})-?(?P<serial>[0-9]{4})$')
# blacklist of SSNs
-_ssn_blacklist = set(( '078-05-1120', '457-55-5462', '219-09-9999' ))
+_ssn_blacklist = set(('078-05-1120', '457-55-5462', '219-09-9999'))
+
def compact(number):
"""Convert the number to the minimal representation. This strips the
number of any valid separators and removes surrounding whitespace."""
return number.replace('-', '').strip()
+
def is_valid(number):
"""Checks to see if the number provided is a valid SSN. This checks
the length, groups and formatting if it is present."""
@@ -65,6 +67,7 @@ def is_valid(number):
# check blacklists
return format(number) not in _ssn_blacklist
+
def format(number):
"""Reformat the passed number to the standard format."""
if len(number) == 9: