19.0 vanilla

This commit is contained in:
Ernad Husremovic 2026-03-09 09:30:07 +01:00
parent ba20ce7443
commit 768b70e05e
2357 changed files with 1057103 additions and 712486 deletions

View file

@ -1,28 +1,8 @@
from itertools import zip_longest
import requests
from urllib3.util.ssl_ import create_urllib3_context
def calc_check_digits(number: str) -> str:
"""Calculate the extra digits that should be appended to the number to make it a valid number.
Source: python-stdnum iso7064.mod_97_10.calc_check_digits
"""
number_base10 = ''.join(str(int(x, 36)) for x in number)
checksum = int(number_base10) % 97
return '%02d' % ((98 - 100 * checksum) % 97)
def format_rf_reference(number: str) -> str:
"""Format a string into a Structured Creditor Reference.
The Creditor Reference is an international standard (ISO 11649).
Example: `123456789` -> `RF18 1234 5678 9`
"""
check_digits = calc_check_digits('{}RF'.format(number))
return 'RF{} {}'.format(
check_digits,
" ".join("".join(x) for x in zip_longest(*[iter(str(number))]*4, fillvalue=""))
)
from .structured_reference import *
from .dict_to_xml import dict_to_xml
class LegacyHTTPAdapter(requests.adapters.HTTPAdapter):