update shared dependencies

This commit is contained in:
j 2016-02-23 11:36:55 +05:30
commit 736cd598a8
521 changed files with 45146 additions and 22574 deletions

View file

@ -1,6 +1,6 @@
# cpr.py - functions for handling Danish CPR numbers
#
# 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
@ -59,7 +59,7 @@ def checksum(number):
"""Calculate the checksum. Note that the checksum isn't actually used
any more. Valid numbers used to have a checksum of 0."""
weights = (4, 3, 2, 7, 6, 5, 4, 3, 2, 1)
return sum(weights[i] * int(n) for i, n in enumerate(number)) % 11
return sum(w * int(n) for w, n in zip(weights, number)) % 11
def get_birth_date(number):
@ -81,7 +81,7 @@ def get_birth_date(number):
def validate(number):
"""Checks to see if the number provided is a valid CPR number. This
checks the length, formatting, embedded date and check digit."""
checks the length, formatting, embedded date and check digit."""
number = compact(number)
if not number.isdigit():
raise InvalidFormat()
@ -95,7 +95,7 @@ def validate(number):
def is_valid(number):
"""Checks to see if the number provided is a valid CPR number. This
checks the length, formatting, embedded date and check digit."""
checks the length, formatting, embedded date and check digit."""
try:
return bool(validate(number))
except ValidationError:

View file

@ -1,6 +1,6 @@
# cvr.py - functions for handling Danish CVR numbers
#
# 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
@ -46,7 +46,7 @@ def compact(number):
def checksum(number):
"""Calculate the checksum."""
weights = (2, 7, 6, 5, 4, 3, 2, 1)
return sum(weights[i] * int(n) for i, n in enumerate(number)) % 11
return sum(w * int(n) for w, n in zip(weights, number)) % 11
def validate(number):