update shared dependencies
This commit is contained in:
parent
d4d3d82be3
commit
736cd598a8
521 changed files with 45146 additions and 22574 deletions
|
|
@ -1,7 +1,7 @@
|
|||
# egn.py - functions for handling Bulgarian national identification numbers
|
||||
# coding: utf-8
|
||||
#
|
||||
# Copyright (C) 2012, 2013 Arthur de Jong
|
||||
# Copyright (C) 2012-2015 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
|
||||
|
|
@ -57,7 +57,7 @@ def calc_check_digit(number):
|
|||
"""Calculate the check digit. The number passed should not have the
|
||||
check digit included."""
|
||||
weights = (2, 4, 8, 5, 10, 9, 7, 3, 6)
|
||||
return str(sum(weights[i] * int(n) for i, n in enumerate(number)) % 11 % 10)
|
||||
return str(sum(w * int(n) for w, n in zip(weights, number)) % 11 % 10)
|
||||
|
||||
|
||||
def get_birth_date(number):
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# pnf.py - functions for handling Bulgarian personal number of a foreigner
|
||||
# coding: utf-8
|
||||
#
|
||||
# Copyright (C) 2012, 2013 Arthur de Jong
|
||||
# Copyright (C) 2012-2015 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
|
||||
|
|
@ -49,7 +49,7 @@ def calc_check_digit(number):
|
|||
"""Calculate the check digit. The number passed should not have the
|
||||
check digit included."""
|
||||
weights = (21, 19, 17, 13, 11, 9, 7, 3, 1)
|
||||
return str(sum(weights[i] * int(n) for i, n in enumerate(number)) % 10)
|
||||
return str(sum(w * int(n) for w, n in zip(weights, number)) % 10)
|
||||
|
||||
|
||||
def validate(number):
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# vat.py - functions for handling Bulgarian VAT numbers
|
||||
# coding: utf-8
|
||||
#
|
||||
# Copyright (C) 2012, 2013 Arthur de Jong
|
||||
# Copyright (C) 2012-2015 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
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
The Bulgarian VAT (Данък върху добавената стойност) number is either 9
|
||||
(for legal entities) or 10 digits (for physical persons, foreigners and
|
||||
others) long. Each type of number has it's own check digit algorithm.
|
||||
others) long. Each type of number has its own check digit algorithm.
|
||||
|
||||
>>> compact('BG 175 074 752')
|
||||
'175074752'
|
||||
|
|
@ -61,7 +61,7 @@ def calc_check_digit_other(number):
|
|||
"""Calculate the check digit for others. The number passed should not
|
||||
have the check digit included."""
|
||||
weights = (4, 3, 2, 7, 6, 5, 4, 3, 2)
|
||||
return str((11 - sum(weights[i] * int(n) for i, n in enumerate(number))) % 11)
|
||||
return str((11 - sum(w * int(n) for w, n in zip(weights, number))) % 11)
|
||||
|
||||
|
||||
def validate(number):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue