[Python-modules-commits] [python-stdnum] 01/05: Import python-stdnum_1.6.orig.tar.gz
Arthur de Jong
adejong at moszumanska.debian.org
Tue Apr 11 21:04:10 UTC 2017
This is an automated email from the git hooks/post-receive script.
adejong pushed a commit to branch master
in repository python-stdnum.
commit 79be6751472c3af61d933f73c4900d375f5cc4e1
Author: Arthur de Jong <adejong at debian.org>
Date: Tue Apr 11 22:32:23 2017 +0200
Import python-stdnum_1.6.orig.tar.gz
---
ChangeLog | 144 +
MANIFEST.in | 3 +-
NEWS | 21 +-
PKG-INFO | 11 +-
README | 10 +-
docs/index.rst | 6 +
docs/stdnum.ar.cbu.rst | 5 +
docs/stdnum.eu.eic.rst | 5 +
docs/stdnum.eu.nace.rst | 5 +
docs/stdnum.lei.rst | 5 +
docs/stdnum.mc.tva.rst | 5 +
docs/stdnum.rs.pib.rst | 5 +
getnace.py | 74 +
online_check/README | 18 +
online_check/check.js | 96 +
online_check/jquery-1.7.1.js | 9266 +++++++++++++++++++++++++++++
online_check/jquery-1.7.1.min.js | 4 +
online_check/stdnum.wsgi | 87 +
online_check/template.html | 23 +
python_stdnum.egg-info/PKG-INFO | 11 +-
python_stdnum.egg-info/SOURCES.txt | 29 +-
setup.cfg | 1 -
setup.py | 1 +
stdnum/__init__.py | 12 +-
stdnum/{au/tfn.py => ar/cbu.py} | 62 +-
stdnum/au/tfn.py | 2 -
stdnum/cn/loc.dat | 2 +-
stdnum/cusip.py | 4 +-
stdnum/ean.py | 4 +-
stdnum/ec/ci.py | 4 +-
stdnum/es/nie.py | 4 +-
stdnum/es/referenciacatastral.py | 17 +-
stdnum/{cusip.py => eu/eic.py} | 73 +-
stdnum/eu/nace.dat | 999 ++++
stdnum/eu/nace.py | 109 +
stdnum/fi/associationid.py | 4 +-
stdnum/fr/tva.py | 8 +-
stdnum/iban.dat | 11 +-
stdnum/iban.py | 25 +-
stdnum/imsi.dat | 499 +-
stdnum/isbn.dat | 22 +-
stdnum/isin.py | 4 +-
stdnum/iso7064/mod_97_10.py | 17 +-
stdnum/lei.py | 68 +
test_tckimlik.py => stdnum/mc/__init__.py | 29 +-
stdnum/mc/tva.py | 62 +
stdnum/meid.py | 14 +-
test_tckimlik.py => stdnum/rs/__init__.py | 29 +-
stdnum/{ec/ci.py => rs/pib.py} | 45 +-
stdnum/tr/tckimlik.py | 4 +-
stdnum/us/ein.dat | 4 +-
test_vies.py | 45 -
tests/test_ar_cbu.doctest | 79 +
tests/test_es_referenciacatastral.doctest | 24 +-
tests/test_eu_eic.doctest | 118 +
tests/test_eu_vat.doctest | 26 +-
tests/test_lei.doctest | 134 +
tests/test_mx_rfc.doctest | 2 +-
tests/test_robustness.doctest | 6 +-
tests/test_rs_pib.doctest | 134 +
tox.ini | 9 +
61 files changed, 12072 insertions(+), 477 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8ba0abc..f4593ce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,147 @@
+2017-04-10 Arthur de Jong <arthur at arthurdejong.org>
+
+ * [93459d3] stdnum/cn/loc.dat, stdnum/eu/nace.dat, stdnum/iban.dat,
+ stdnum/imsi.dat, stdnum/isbn.dat: Update database files
+
+2017-04-10 Arthur de Jong <arthur at arthurdejong.org>
+
+ * [bb1712d] online_check/README, online_check/check.js,
+ online_check/jquery-1.7.1.js, online_check/jquery-1.7.1.min.js,
+ online_check/stdnum.wsgi, online_check/template.html: Add simple
+ online check example
+
+ This adds the code that is used to find formats for which a
+ supplied number is valid. This is the code that is used on
+ https://arthurdejong.org/python-stdnum/check/
+
+2017-04-10 Arthur de Jong <arthur at arthurdejong.org>
+
+ * [5398247] stdnum/lei.py, tests/test_lei.doctest: Add Legal
+ Entity Identifier
+
+2017-04-10 Arthur de Jong <arthur at arthurdejong.org>
+
+ * [e844b52] stdnum/iban.py, stdnum/iso7064/mod_97_10.py: Integrate
+ base10 conversion into Mod 97, 10
+
+ This moves the conversion of an alphanumeric string to a numeric
+ representation for modulo 97 calculation to the mod_97_10 module
+ because this mechanism seems to be used by multiple formats.
+
+2017-04-10 Arthur de Jong <arthur at arthurdejong.org>
+
+ * [1b3d16e] stdnum/es/nie.py: Add missing export (__all__)
+
+2017-04-10 Arthur de Jong <arthur at arthurdejong.org>
+
+ * [72f5c6c] stdnum/rs/__init__.py, stdnum/rs/pib.py,
+ tests/test_rs_pib.doctest: Add Serbian Poreski Identifikacioni Broj
+
+2017-04-10 Arthur de Jong <arthur at arthurdejong.org>
+
+ * [800205c] tox.ini: Print warnings during tox run
+
+2017-04-07 Arthur de Jong <arthur at arthurdejong.org>
+
+ * [7493eca] stdnum/cusip.py, stdnum/ean.py, stdnum/ec/ci.py,
+ stdnum/isin.py, stdnum/tr/tckimlik.py: Use a slightly more
+ readable weight alternation
+
+ Switch to a slightly more readable syntax for alternating between
+ two weights in checksums calculations.
+
+2017-04-01 Arthur de Jong <arthur at arthurdejong.org>
+
+ * [23b2150] stdnum/eu/eic.py, tests/test_eu_eic.doctest: Add
+ European EIC (Energy Identification Code)
+
+2017-03-26 Arthur de Jong <arthur at arthurdejong.org>
+
+ * [194f025] stdnum/meid.py, tests/test_robustness.doctest: Add
+ unicode robustness tests
+
+ This tests a few unicode strings and fixes a bug in the MEID
+ module.
+
+2017-03-26 Arthur de Jong <arthur at arthurdejong.org>
+
+ * [d43c394] stdnum/es/referenciacatastral.py,
+ tests/test_es_referenciacatastral.doctest: Add test for Ñ in
+ Referencia Catastral
+
+ This supports the Referencia Catastral with an Ñ in it for
+ both byte strings (Python 2) and unicode strings (Python 2 and
+ 3). Support for literal unicode strings in Python 2 doctests is
+ flaky so the test is a bit ugly.
+
+ This also adds a few numbers that were found online. Sadly no
+ real numbers with an Ñ in it have been found so the one in the
+ test was constructed.
+
+2017-03-26 Arthur de Jong <arthur at arthurdejong.org>
+
+ * [61d73c1] getnace.py, stdnum/eu/nace.dat, stdnum/eu/nace.py,
+ tests/test_robustness.doctest: Add European NACE classification
+
+ This number is used to classify business. Validation is done
+ based on a downloaded registry.
+
+2017-03-26 Arthur de Jong <arthur at arthurdejong.org>
+
+ * [649f073] stdnum/mc/tva.py: Remove unused import
+
+2017-03-19 Arthur de Jong <arthur at arthurdejong.org>
+
+ * [c957318] stdnum/fr/tva.py, stdnum/mc/__init__.py,
+ stdnum/mc/tva.py, tests/test_eu_vat.doctest: Add support for
+ Monaco VAT number
+
+ The number uses the French TVA number but, unlike normal French
+ VAT numbers, they are not valid French SIREN numbers.
+
+ See https://github.com/arthurdejong/python-stdnum/issues/46
+
+2016-12-11 Arthur de Jong <arthur at arthurdejong.org>
+
+ * [5b43857] stdnum/au/tfn.py: Remove unused import
+
+2016-12-01 Greg Kuwaye <gkuwaye at lyft.com>
+
+ * [7d16ea5] stdnum/us/ein.dat: Add new 47 EIN prefix; fix duplicate
+ 46; move 81
+
+ 47 appears to be a new Internet campus code. Prefix 46
+ was listed twice, once under the Philadelphia campus and
+ again under the Internet campus. This error may be seen
+ on the IRS website itself. The Wikipedia article on EIN
+ (https://en.wikipedia.org/wiki/Employer_Identification_Number)
+ does not have 46 listed twice. 81 has moved from the Philadelphia
+ campus to the Internet campus.
+
+2016-11-14 Luciano Rossi <lukio at gcoop.coop>
+
+ * [dcde8f4] stdnum/ar/cbu.py, tests/test_ar_cbu.doctest: Implement
+ CBU (unique bank code) of Argentina
+
+ See https://github.com/arthurdejong/python-stdnum/issues/43
+
+2016-11-14 Arthur de Jong <arthur at arthurdejong.org>
+
+ * [da18e3b] setup.py, stdnum/fi/associationid.py, stdnum/meid.py,
+ tests/test_mx_rfc.doctest, tox.ini: Add Python 2.6 support
+
+ This also brings the list of Python versions in setup.py in line
+ with tox.ini.
+
+2016-11-13 Arthur de Jong <arthur at arthurdejong.org>
+
+ * [62ebbce] ChangeLog, NEWS, README, docs/index.rst,
+ docs/stdnum.au.abn.rst, docs/stdnum.au.acn.rst,
+ docs/stdnum.au.tfn.rst, docs/stdnum.es.ccc.rst,
+ docs/stdnum.es.cups.rst, docs/stdnum.es.iban.rst,
+ docs/stdnum.es.referenciacatastral.rst, stdnum/__init__.py:
+ Get files ready for 1.5 release
+
2016-11-13 Arthur de Jong <arthur at arthurdejong.org>
* [c9beb00] stdnum/cn/loc.dat, stdnum/iban.dat, stdnum/imsi.dat,
diff --git a/MANIFEST.in b/MANIFEST.in
index bc3f093..faa84ef 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,3 +1,4 @@
-include README NEWS ChangeLog COPYING *.py
+include README NEWS ChangeLog COPYING *.py tox.ini
recursive-include tests *.doctest *.dat
recursive-include docs *.rst *.py
+recursive-include online_check *
diff --git a/NEWS b/NEWS
index 317f8bb..d1aee8e 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,20 @@
+changes from 1.5 to 1.6
+-----------------------
+
+* add modules for the following number formats:
+ - CBU (Clave Bancaria Uniforme, Argentine bank account number)
+ (thanks Luciano Rossi)
+ - EIC (European Energy Identification Code)
+ - NACE (classification for businesses in the European Union)
+ - LEI (Legal Entity Identifier)
+ - n° TVA (taxe sur la valeur ajoutée, Monacan VAT number)
+ - PIB (Poreski Identifikacioni Broj, Serbian tax identification number)
+* add online check example that finds valid formats for a given number
+* fix support for Ñ in Spanish Referencia Catastral
+* updates to U.S. Employer Identification Number (thanks Greg Kuwaye)
+* various minor improvements
+
+
changes from 1.4 to 1.5
-----------------------
@@ -9,8 +26,8 @@ changes from 1.4 to 1.5
- CUPS (Código Unificado de Punto de Suministro, Supply Point Unified Code)
- Spanish IBAN (International Bank Account Number)
- Referencia Catastral (Spanish real estate property id)
-* The IBAN module now support validating the country-specific part
-* The Belgian VAT number is now also referenced as businessid
+* the IBAN module now support validating the country-specific part
+* the Belgian VAT number is now also referenced as businessid
* add a Tox configuration file
diff --git a/PKG-INFO b/PKG-INFO
index a2bcf9d..e09cbcb 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: python-stdnum
-Version: 1.5
+Version: 1.6
Summary: Python module to handle standardized numbers and codes
Home-page: http://arthurdejong.org/python-stdnum/
Author: Arthur de Jong
@@ -14,6 +14,7 @@ Description: Parse, validate and reformat standard numbers and codes.
Currently this package supports the following formats:
* al.nipt: NIPT (Numri i Identifikimit për Personin e Tatueshëm, Albanian VAT number)
+ * ar.cbu: CBU (Clave Bancaria Uniforme, Argentine bank account number)
* ar.cuit: CUIT (Código Único de Identificación Tributaria, Argentinian tax number)
* at.businessid: Austrian Company Register Numbers
* at.uid: UID (Umsatzsteuer-Identifikationsnummer, Austrian VAT number)
@@ -56,6 +57,8 @@ Description: Parse, validate and reformat standard numbers and codes.
* es.nif: NIF (Número de Identificación Fiscal, Spanish VAT number)
* es.referenciacatastral: Referencia Catastral (Spanish real estate property id)
* eu.at_02: SEPA Identifier of the Creditor (AT-02)
+ * eu.eic: EIC (European Energy Identification Code)
+ * eu.nace: NACE (classification for businesses in the European Union)
* eu.vat: VAT (European Union VAT number)
* fi.alv: ALV nro (Arvonlisäveronumero, Finnish VAT number)
* fi.associationid: Finnish Association Identifier
@@ -91,9 +94,11 @@ Description: Parse, validate and reformat standard numbers and codes.
* issn: ISSN (International Standard Serial Number)
* it.codicefiscale: Codice Fiscale (Italian tax code for individuals)
* it.iva: Partita IVA (Italian VAT number)
+ * lei: LEI (Legal Entity Identifier)
* lt.pvm: PVM (Pridėtinės vertės mokestis mokėtojo kodas, Lithuanian VAT number)
* lu.tva: TVA (taxe sur la valeur ajoutée, Luxembourgian VAT number)
* lv.pvn: PVN (Pievienotās vērtības nodokļa, Latvian VAT number)
+ * mc.tva: n° TVA (taxe sur la valeur ajoutée, Monacan VAT number)
* meid: MEID (Mobile Equipment Identifier)
* mt.vat: VAT (Maltese VAT number)
* mx.rfc: RFC (Registro Federal de Contribuyentes, Mexican tax number)
@@ -111,6 +116,7 @@ Description: Parse, validate and reformat standard numbers and codes.
* pt.nif: NIF (Número de identificação fiscal, Portuguese VAT number)
* ro.cf: CF (Cod de înregistrare în scopuri de TVA, Romanian VAT number)
* ro.cnp: CNP (Cod Numeric Personal, Romanian Numerical Personal Code)
+ * rs.pib: PIB (Poreski Identifikacioni Broj, Serbian tax identification number)
* ru.inn: ИНН (Идентификационный номер налогоплательщика, Russian tax identifier)
* se.orgnr: Orgnr (Organisationsnummer, Swedish company number)
* se.vat: VAT (Moms, Mervärdesskatt, Swedish VAT number)
@@ -148,7 +154,7 @@ Description: Parse, validate and reformat standard numbers and codes.
...
InvalidChecksum: ...
- Apart from the validate() function, modules generally provide extra
+ Apart from the validate() function, many modules provide extra
parsing, validation, formatting or conversion functions.
Platform: UNKNOWN
@@ -166,6 +172,7 @@ Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
Classifier: Topic :: Office/Business :: Financial
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Processing :: General
diff --git a/README b/README
index 0cfdab8..02ce9de 100644
--- a/README
+++ b/README
@@ -10,6 +10,7 @@ Available formats
Currently this package supports the following formats:
* NIPT (Numri i Identifikimit për Personin e Tatueshëm, Albanian VAT number)
+ * CBU (Clave Bancaria Uniforme, Argentine bank account number)
* CUIT (Código Único de Identificación Tributaria, Argentinian tax number)
* Austrian Company Register Numbers
* UID (Umsatzsteuer-Identifikationsnummer, Austrian VAT number)
@@ -52,6 +53,8 @@ Currently this package supports the following formats:
* NIF (Número de Identificación Fiscal, Spanish VAT number)
* Referencia Catastral (Spanish real estate property id)
* SEPA Identifier of the Creditor (AT-02)
+ * EIC (European Energy Identification Code)
+ * NACE (classification for businesses in the European Union)
* VAT (European Union VAT number)
* ALV nro (Arvonlisäveronumero, Finnish VAT number)
* Finnish Association Identifier
@@ -87,9 +90,11 @@ Currently this package supports the following formats:
* ISSN (International Standard Serial Number)
* Codice Fiscale (Italian tax code for individuals)
* Partita IVA (Italian VAT number)
+ * LEI (Legal Entity Identifier)
* PVM (Pridėtinės vertės mokestis mokėtojo kodas, Lithuanian VAT number)
* TVA (taxe sur la valeur ajoutée, Luxembourgian VAT number)
* PVN (Pievienotās vērtības nodokļa, Latvian VAT number)
+ * n° TVA (taxe sur la valeur ajoutée, Monacan VAT number)
* MEID (Mobile Equipment Identifier)
* VAT (Maltese VAT number)
* RFC (Registro Federal de Contribuyentes, Mexican tax number)
@@ -107,6 +112,7 @@ Currently this package supports the following formats:
* NIF (Número de identificação fiscal, Portuguese VAT number)
* CF (Cod de înregistrare în scopuri de TVA, Romanian VAT number)
* CNP (Cod Numeric Personal, Romanian Numerical Personal Code)
+ * PIB (Poreski Identifikacioni Broj, Serbian tax identification number)
* ИНН (Идентификационный номер налогоплательщика, Russian tax identifier)
* Orgnr (Organisationsnummer, Swedish company number)
* VAT (Moms, Mervärdesskatt, Swedish VAT number)
@@ -159,13 +165,13 @@ Requirements
------------
The modules should not require any external Python modules and should be pure
-Python. The modules are developed and tested with Python 2.7 and 3.5 but may
+Python. The modules are developed and tested with Python 2.7 and 3.6 but may
also work with older versions of Python.
Copyright
---------
-Copyright (C) 2010-2016 Arthur de Jong and others
+Copyright (C) 2010-2017 Arthur de Jong and others
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
diff --git a/docs/index.rst b/docs/index.rst
index 3e4096f..56c6fc7 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -87,6 +87,7 @@ Available formats
:toctree:
al.nipt
+ ar.cbu
ar.cuit
at.businessid
at.uid
@@ -129,6 +130,8 @@ Available formats
es.nif
es.referenciacatastral
eu.at_02
+ eu.eic
+ eu.nace
eu.vat
fi.alv
fi.associationid
@@ -164,9 +167,11 @@ Available formats
issn
it.codicefiscale
it.iva
+ lei
lt.pvm
lu.tva
lv.pvn
+ mc.tva
meid
mt.vat
mx.rfc
@@ -184,6 +189,7 @@ Available formats
pt.nif
ro.cf
ro.cnp
+ rs.pib
ru.inn
se.orgnr
se.vat
diff --git a/docs/stdnum.ar.cbu.rst b/docs/stdnum.ar.cbu.rst
new file mode 100644
index 0000000..5cf6781
--- /dev/null
+++ b/docs/stdnum.ar.cbu.rst
@@ -0,0 +1,5 @@
+stdnum.ar.cbu
+=============
+
+.. automodule:: stdnum.ar.cbu
+ :members:
\ No newline at end of file
diff --git a/docs/stdnum.eu.eic.rst b/docs/stdnum.eu.eic.rst
new file mode 100644
index 0000000..c9a8769
--- /dev/null
+++ b/docs/stdnum.eu.eic.rst
@@ -0,0 +1,5 @@
+stdnum.eu.eic
+=============
+
+.. automodule:: stdnum.eu.eic
+ :members:
\ No newline at end of file
diff --git a/docs/stdnum.eu.nace.rst b/docs/stdnum.eu.nace.rst
new file mode 100644
index 0000000..e474b40
--- /dev/null
+++ b/docs/stdnum.eu.nace.rst
@@ -0,0 +1,5 @@
+stdnum.eu.nace
+==============
+
+.. automodule:: stdnum.eu.nace
+ :members:
\ No newline at end of file
diff --git a/docs/stdnum.lei.rst b/docs/stdnum.lei.rst
new file mode 100644
index 0000000..c8aec9d
--- /dev/null
+++ b/docs/stdnum.lei.rst
@@ -0,0 +1,5 @@
+stdnum.lei
+==========
+
+.. automodule:: stdnum.lei
+ :members:
\ No newline at end of file
diff --git a/docs/stdnum.mc.tva.rst b/docs/stdnum.mc.tva.rst
new file mode 100644
index 0000000..0b20960
--- /dev/null
+++ b/docs/stdnum.mc.tva.rst
@@ -0,0 +1,5 @@
+stdnum.mc.tva
+=============
+
+.. automodule:: stdnum.mc.tva
+ :members:
\ No newline at end of file
diff --git a/docs/stdnum.rs.pib.rst b/docs/stdnum.rs.pib.rst
new file mode 100644
index 0000000..09e8710
--- /dev/null
+++ b/docs/stdnum.rs.pib.rst
@@ -0,0 +1,5 @@
+stdnum.rs.pib
+=============
+
+.. automodule:: stdnum.rs.pib
+ :members:
\ No newline at end of file
diff --git a/getnace.py b/getnace.py
new file mode 100755
index 0000000..0830563
--- /dev/null
+++ b/getnace.py
@@ -0,0 +1,74 @@
+#!/usr/bin/env python3
+
+# getnace.py - script to get the NACE v2 catalogue
+#
+# Copyright (C) 2017 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
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301 USA
+
+"""This script downloads XML data from the European commission RAMON Eurostat
+Metadata Server and extracts the information that is used for validating NACE
+codes."""
+
+from xml.etree import ElementTree
+import cgi
+import urllib.request
+
+
+# the location of the ISBN Ranges XML file
+download_url = 'http://ec.europa.eu/eurostat/ramon/nomenclatures/index.cfm?TargetUrl=ACT_OTH_CLS_DLD&StrNom=NACE_REV2&StrFormat=XML&StrLanguageCode=EN'
+
+
+def get(f=None):
+ if f is None:
+ f = urllib.request.urlopen(download_url)
+ _, params = cgi.parse_header(f.info().get('Content-Disposition', ''))
+ filename = params.get('filename', '?')
+ yield '# generated from %s, downloaded from' % filename
+ yield '# %s' % download_url
+ else:
+ yield '# generated from %s' % f
+
+ # parse XML document
+ doc = ElementTree.parse(f).getroot()
+
+ # output header
+ yield '# %s: %s' % (
+ doc.find('Classification').get('id'),
+ doc.find('Classification/Label/LabelText[@language="EN"]').text)
+
+ for item in doc.findall('Classification/Item'):
+ number = item.get('id')
+ level = int(item.get('idLevel', 0))
+ label = item.find('Label/LabelText[@language="EN"]').text
+ isic = item.find(
+ 'Property[@genericName="ISIC4_REF"]/PropertyQualifier/' +
+ 'PropertyText').text
+ if level == 1:
+ section = number
+ yield '%s label="%s" isic="%s"' % (number, label, isic)
+ elif level == 2:
+ yield '%s section="%s" label="%s" isic="%s"' % (
+ number, section, label, isic)
+ else:
+ yield '%s%s label="%s" isic="%s"' % (
+ ' ' * (level - 2), number[level], label, isic)
+
+
+if __name__ == '__main__':
+ #get('NACE_REV2_20170326_162216.xml')
+ for row in get():
+ print(row)
diff --git a/online_check/README b/online_check/README
new file mode 100644
index 0000000..38841e2
--- /dev/null
+++ b/online_check/README
@@ -0,0 +1,18 @@
+This is a sample application that uses python-stdnum to see which number
+formats are valid for a supplied number as can be seen online at:
+ https://arthurdejong.org/python-stdnum/check/
+
+Configuring the WSGI application in Apache.
+
+# /path/to/wsgi is the directory containing the WSGI scripts
+# /path/to/html is the directory containing the static files
+
+WSGIDaemonProcess stdnum threads=5 maximum-requests=100 display-name=%{GROUP}
+<Directory /path/to/wsgi>
+ <Files stdnum.wsgi>
+ WSGIProcessGroup stdnum
+ </Files>
+</Directory>
+Alias /check /path/to/html
+WSGIScriptAlias /check/stdnum.wsgi /path/to/wsgi/stdnum.wsgi
+RewriteRule ^/check/$ /check/stdnum.wsgi/$1 [QSA,PT,L]
diff --git a/online_check/check.js b/online_check/check.js
new file mode 100644
index 0000000..b52633f
--- /dev/null
+++ b/online_check/check.js
@@ -0,0 +1,96 @@
+/*
+ # check.js - simple application to check numbers
+ #
+ # Copyright (C) 2017 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
+ # License as published by the Free Software Foundation; either
+ # version 2.1 of the License, or (at your option) any later version.
+ #
+ # This library is distributed in the hope that it will be useful,
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ # Lesser General Public License for more details.
+ #
+ # You should have received a copy of the GNU Lesser General Public
+ # License along with this library; if not, write to the Free Software
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ # 02110-1301 USA
+ */
+
+$( document ).ready(function() {
+
+ function format(value) {
+ return $("<div/>").text(value).html().replace(
+ /\n\n/g, "<br/>\n"
+ ).replace(
+ /^[*] (.*)$/gm, "<ul><li>$1</li></ul>"
+ ).replace(
+ /(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig,
+ "<a href='$1'>$1</a>"
+ )
+ }
+
+ function updateresults(field, results) {
+ // build HTML to present
+ var h = ["<ul>"];
+ $.each(results, function(index, result) {
+ h.push(
+ "<li><b>",
+ $("<div/>").text(result["name"]).html(),
+ "</b><br/>",
+ $("<div/>").text(result["number"]).html(),
+ "<p>",
+ format(result["description"]),
+ "</p></li>")
+ });
+ h.push("</ul>");
+ // replace the results div
+ $("#" + $(field).attr("id") + "_results").slideUp("quick", function() {
+ $(this).html(h.join(""));
+ $(this).slideDown("quick");
+ });
+ }
+
+ function checkfield(field) {
+ var value = field.val();
+ // only trigger update if value changed from previous validation
+ if (value != $(this).data("oldvalue")) {
+ $(this).data("oldvalue", value);
+ $.get('', {number: value}, function(data) {
+ updateresults(field, data);
+ });
+ }
+ }
+
+ // trigger a check when user stopped typing
+ $(".stdnum_check").on("input propertychange", function (event) {
+ if (window.event && event.type == "propertychange" && event.propertyName != "value")
+ return;
+ var field = $(this);
+ window.clearTimeout($(this).data("timeout"));
+ $(this).data("timeout", setTimeout(function () {
+ checkfield(field);
+ }, 2000));
+ });
+
+ // trigger a check when losing focus
+ $(".stdnum_check").on("blur", function() {
+ window.clearTimeout($(this).data("timeout"));
+ checkfield($(this));
+ });
+
+ // prevent enter from submitting the form
+ $(".stdnum_check").keydown(function(event) {
+ if(event.keyCode == 13) {
+ event.preventDefault();
+ checkfield($(this));
+ return false;
+ }
+ });
+
+ // hide the submit button
+ $(".stdnum_hide").hide();
+
+});
diff --git a/online_check/jquery-1.7.1.js b/online_check/jquery-1.7.1.js
new file mode 100644
index 0000000..8ccd0ea
--- /dev/null
+++ b/online_check/jquery-1.7.1.js
@@ -0,0 +1,9266 @@
+/*!
+ * jQuery JavaScript Library v1.7.1
+ * http://jquery.com/
+ *
+ * Copyright 2011, John Resig
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ * Copyright 2011, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ *
+ * Date: Mon Nov 21 21:11:03 2011 -0500
+ */
+(function( window, undefined ) {
+
+// Use the correct document accordingly with window argument (sandbox)
+var document = window.document,
+ navigator = window.navigator,
+ location = window.location;
+var jQuery = (function() {
+
+// Define a local copy of jQuery
+var jQuery = function( selector, context ) {
+ // The jQuery object is actually just the init constructor 'enhanced'
+ return new jQuery.fn.init( selector, context, rootjQuery );
+ },
+
+ // Map over jQuery in case of overwrite
+ _jQuery = window.jQuery,
+
+ // Map over the $ in case of overwrite
+ _$ = window.$,
+
+ // A central reference to the root jQuery(document)
+ rootjQuery,
+
+ // A simple way to check for HTML strings or ID strings
+ // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
+ quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
+
+ // Check if a string has a non-whitespace character in it
+ rnotwhite = /\S/,
+
+ // Used for trimming whitespace
+ trimLeft = /^\s+/,
+ trimRight = /\s+$/,
+
+ // Match a standalone tag
+ rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
+
+ // JSON RegExp
+ rvalidchars = /^[\],:{}\s]*$/,
+ rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
+ rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
+ rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
+
+ // Useragent RegExp
+ rwebkit = /(webkit)[ \/]([\w.]+)/,
+ ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
+ rmsie = /(msie) ([\w.]+)/,
+ rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
+
+ // Matches dashed string for camelizing
+ rdashAlpha = /-([a-z]|[0-9])/ig,
+ rmsPrefix = /^-ms-/,
+
+ // Used by jQuery.camelCase as callback to replace()
+ fcamelCase = function( all, letter ) {
+ return ( letter + "" ).toUpperCase();
+ },
+
+ // Keep a UserAgent string for use with jQuery.browser
+ userAgent = navigator.userAgent,
+
+ // For matching the engine and version of the browser
+ browserMatch,
+
+ // The deferred used on DOM ready
+ readyList,
+
+ // The ready event handler
+ DOMContentLoaded,
+
+ // Save a reference to some core methods
+ toString = Object.prototype.toString,
+ hasOwn = Object.prototype.hasOwnProperty,
+ push = Array.prototype.push,
+ slice = Array.prototype.slice,
+ trim = String.prototype.trim,
+ indexOf = Array.prototype.indexOf,
+
+ // [[Class]] -> type pairs
+ class2type = {};
+
+jQuery.fn = jQuery.prototype = {
+ constructor: jQuery,
+ init: function( selector, context, rootjQuery ) {
+ var match, elem, ret, doc;
+
+ // Handle $(""), $(null), or $(undefined)
+ if ( !selector ) {
+ return this;
+ }
+
+ // Handle $(DOMElement)
+ if ( selector.nodeType ) {
+ this.context = this[0] = selector;
+ this.length = 1;
+ return this;
+ }
+
+ // The body element only exists once, optimize finding it
+ if ( selector === "body" && !context && document.body ) {
+ this.context = document;
+ this[0] = document.body;
+ this.selector = selector;
+ this.length = 1;
+ return this;
+ }
+
+ // Handle HTML strings
+ if ( typeof selector === "string" ) {
+ // Are we dealing with HTML string or an ID?
+ if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
+ // Assume that strings that start and end with <> are HTML and skip the regex check
+ match = [ null, selector, null ];
+
+ } else {
+ match = quickExpr.exec( selector );
+ }
+
+ // Verify a match, and that no context was specified for #id
+ if ( match && (match[1] || !context) ) {
+
+ // HANDLE: $(html) -> $(array)
+ if ( match[1] ) {
+ context = context instanceof jQuery ? context[0] : context;
+ doc = ( context ? context.ownerDocument || context : document );
+
+ // If a single string is passed in and it's a single tag
+ // just do a createElement and skip the rest
+ ret = rsingleTag.exec( selector );
+
+ if ( ret ) {
+ if ( jQuery.isPlainObject( context ) ) {
+ selector = [ document.createElement( ret[1] ) ];
+ jQuery.fn.attr.call( selector, context, true );
+
+ } else {
+ selector = [ doc.createElement( ret[1] ) ];
+ }
+
+ } else {
+ ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
+ selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes;
+ }
+
+ return jQuery.merge( this, selector );
+
+ // HANDLE: $("#id")
+ } else {
+ elem = document.getElementById( match[2] );
+
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document #6963
+ if ( elem && elem.parentNode ) {
+ // Handle the case where IE and Opera return items
+ // by name instead of ID
+ if ( elem.id !== match[2] ) {
+ return rootjQuery.find( selector );
+ }
+
+ // Otherwise, we inject the element directly into the jQuery object
+ this.length = 1;
+ this[0] = elem;
+ }
+
+ this.context = document;
+ this.selector = selector;
+ return this;
+ }
+
+ // HANDLE: $(expr, $(...))
+ } else if ( !context || context.jquery ) {
+ return ( context || rootjQuery ).find( selector );
+
+ // HANDLE: $(expr, context)
+ // (which is just equivalent to: $(context).find(expr)
+ } else {
+ return this.constructor( context ).find( selector );
+ }
+
+ // HANDLE: $(function)
+ // Shortcut for document ready
+ } else if ( jQuery.isFunction( selector ) ) {
+ return rootjQuery.ready( selector );
+ }
+
+ if ( selector.selector !== undefined ) {
+ this.selector = selector.selector;
+ this.context = selector.context;
+ }
+
+ return jQuery.makeArray( selector, this );
+ },
+
+ // Start with an empty selector
+ selector: "",
+
+ // The current version of jQuery being used
+ jquery: "1.7.1",
+
+ // The default length of a jQuery object is 0
+ length: 0,
+
+ // The number of elements contained in the matched element set
+ size: function() {
+ return this.length;
+ },
+
+ toArray: function() {
+ return slice.call( this, 0 );
+ },
+
+ // Get the Nth element in the matched element set OR
+ // Get the whole matched element set as a clean array
+ get: function( num ) {
+ return num == null ?
+
+ // Return a 'clean' array
+ this.toArray() :
+
+ // Return just the object
+ ( num < 0 ? this[ this.length + num ] : this[ num ] );
+ },
+
+ // Take an array of elements and push it onto the stack
+ // (returning the new matched element set)
+ pushStack: function( elems, name, selector ) {
+ // Build a new jQuery matched element set
+ var ret = this.constructor();
+
+ if ( jQuery.isArray( elems ) ) {
+ push.apply( ret, elems );
+
+ } else {
+ jQuery.merge( ret, elems );
+ }
+
+ // Add the old object onto the stack (as a reference)
+ ret.prevObject = this;
+
+ ret.context = this.context;
+
+ if ( name === "find" ) {
+ ret.selector = this.selector + ( this.selector ? " " : "" ) + selector;
+ } else if ( name ) {
+ ret.selector = this.selector + "." + name + "(" + selector + ")";
+ }
+
+ // Return the newly-formed element set
+ return ret;
+ },
+
+ // Execute a callback for every element in the matched set.
+ // (You can seed the arguments with an array of args, but this is
+ // only used internally.)
+ each: function( callback, args ) {
+ return jQuery.each( this, callback, args );
+ },
+
+ ready: function( fn ) {
+ // Attach the listeners
+ jQuery.bindReady();
+
+ // Add the callback
+ readyList.add( fn );
+
+ return this;
+ },
+
+ eq: function( i ) {
+ i = +i;
... 13753 lines suppressed ...
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-stdnum.git
More information about the Python-modules-commits
mailing list