File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 26
26
27
27
This module only supports the "new" format that was introduced in 2011 which
28
28
completely replaced the "old" 6-digit format in 2014.
29
+ Stripped numbers without the CHE prefix are allowed and validated,
30
+ but are returned with the prefix prepended.
29
31
30
32
More information:
31
33
34
36
35
37
>>> validate('CHE-100.155.212')
36
38
'CHE100155212'
39
+ >>> validate('100.155.212')
40
+ 'CHE100155212'
37
41
>>> validate('CHE-100.155.213')
38
42
Traceback (most recent call last):
39
43
...
49
53
def compact (number ):
50
54
"""Convert the number to the minimal representation. This strips
51
55
surrounding whitespace and separators."""
52
- return clean (number , ' -.' ).strip ().upper ()
56
+ number = clean (number , ' -.' ).strip ().upper ()
57
+ if len (number ) == 9 and isdigits (number ):
58
+ number = 'CHE' + number
59
+ return number
53
60
54
61
55
62
def calc_check_digit (number ):
You can’t perform that action at this time.
0 commit comments