1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201
|
.. module:: stdnum
python-stdnum
=============
A Python module to parse, validate and reformat standard numbers and codes
in different formats. It contains a large collection of number formats.
Basically any number or code that has some validation mechanism available
or some common formatting is eligible for inclusion in this library.
http://arthurdejong.org/python-stdnum/
Common Interface
----------------
Most of the number format modules implement the following functions:
.. function:: validate(number)
Validate the number and return a compact, consistent representation of
the number or code. If the validation fails,
:mod:`an exception <.exceptions>` is raised that indicates the type of
error.
.. function:: is_valid(number)
Return either True or False depending on whether the passed number is
in any supported and valid form and passes all embedded checks of the
number. This function should never raise an exception.
.. function:: compact(number)
Return a compact representation of the number or code. This function
generally does not do validation but may raise exceptions for wildly
invalid numbers.
.. function:: format(number)
Return a formatted version of the number in the preferred format.
This function generally expects to be passed a valid number or code and
may raise exceptions for invalid numbers.
The check digit modules generally also provide the following functions:
.. function:: checksum(number)
Calculate the checksum over the provided number. This is generally a
number that can be used to determine whether the provided number is
valid. It depends on the algorithm which checksum is considered valid.
.. function:: calc_check_digit(number)
Calculate the check digit that should be added to the number to make it
valid.
Apart from the above, the modules may add extra parsing, validation or
conversion functions.
Helper modules
--------------
.. autosummary::
:toctree:
exceptions
Generic check digit algorithms
------------------------------
.. autosummary::
:toctree:
damm
iso7064
luhn
verhoeff
Available formats
-----------------
.. autosummary::
:toctree:
al.nipt
ar.cuit
at.businessid
at.uid
au.abn
au.acn
au.tfn
be.vat
bg.egn
bg.pnf
bg.vat
br.cnpj
br.cpf
ch.ssn
ch.uid
ch.vat
cl.rut
cn.ric
co.nit
cusip
cy.vat
cz.dic
cz.rc
de.vat
de.wkn
dk.cpr
dk.cvr
do.cedula
do.rnc
ean
ec.ci
ec.ruc
ee.ik
ee.kmkr
es.ccc
es.cif
es.cups
es.dni
es.iban
es.nie
es.nif
es.referenciacatastral
eu.at_02
eu.vat
fi.alv
fi.associationid
fi.hetu
fi.ytunnus
fr.nif
fr.nir
fr.siren
fr.siret
fr.tva
gb.nhs
gb.sedol
gb.vat
gr.vat
grid
hr.oib
hu.anum
iban
ie.pps
ie.vat
imei
imo
imsi
is_.kennitala
is_.vsk
isan
isbn
isil
isin
ismn
iso6346
iso9362
issn
it.codicefiscale
it.iva
lt.pvm
lu.tva
lv.pvn
meid
mt.vat
mx.rfc
my.nric
nl.brin
nl.bsn
nl.btw
nl.onderwijsnummer
nl.postcode
no.mva
no.orgnr
pl.nip
pl.pesel
pl.regon
pt.nif
ro.cf
ro.cnp
ru.inn
se.orgnr
se.vat
si.ddv
sk.dph
sk.rc
sm.coe
tr.tckimlik
us.atin
us.ein
us.itin
us.ptin
us.rtn
us.ssn
us.tin
|