faker.providers.bank.es_MX
¶
Package Contents¶
Classes¶
Implement default bank provider for Faker. |
|
Bank provider for |
Functions¶
|
Generate the checksum digit for a CLABE. |
|
Check if a CLABE is valid using the checksum. |
- class faker.providers.bank.es_MX.BankProvider(generator: Any)¶
Bases:
faker.providers.BaseProvider
Implement default bank provider for Faker.
Important
Bank codes, account numbers, and other ID’s generated by this provider are only valid in form, i.e. they conform to some standard/format, are of the expected lengths, and have valid checksums (where applicable). Results generated that turn out to be valid in real life are purely coincidental.
Sources:
- swift8(use_dataset: bool = False) str ¶
Generate an 8-digit SWIFT code.
This method uses |swift| under the hood with the
length
argument set to8
and with theprimary
argument omitted. All 8-digit SWIFT codes already refer to the primary branch/office.- Sample
- Sample
use_dataset=True
- swift11(primary: bool = False, use_dataset: bool = False) str ¶
Generate an 11-digit SWIFT code.
This method uses |swift| under the hood with the
length
argument set to11
. Ifprimary
is set toTrue
, the SWIFT code will always end with'XXX'
. All 11-digit SWIFT codes use this convention to refer to the primary branch/office.- Sample
- Sample
use_dataset=True
- swift(length: Optional[int] = None, primary: bool = False, use_dataset: bool = False) str ¶
Generate a SWIFT code.
SWIFT codes, reading from left to right, are composed of a 4 alphabet character bank code, a 2 alphabet character country code, a 2 alphanumeric location code, and an optional 3 alphanumeric branch code. This means SWIFT codes can only have 8 or 11 characters, so the value of
length
can only beNone
or the integers8
or11
. If the value isNone
, then a value of8
or11
will randomly be assigned.Because all 8-digit SWIFT codes already refer to the primary branch or office, the
primary
argument only has an effect if the value oflength
is11
. Ifprimary
isTrue
andlength
is11
, the 11-digit SWIFT codes generated will always end in'XXX'
to denote that they belong to primary branches/offices.For extra authenticity, localized providers may opt to include SWIFT bank codes, location codes, and branch codes used in their respective locales. If
use_dataset
isTrue
, this method will generate SWIFT codes based on those locale-specific codes if included. If those codes were not included, then it will behave as ifuse_dataset
wereFalse
, and in that mode, all those codes will just be randomly generated as per the specification.- Sample
- Sample
length=8
- Sample
length=8, use_dataset=True
- Sample
length=11
- Sample
length=11, primary=True
- Sample
length=11, use_dataset=True
- Sample
length=11, primary=True, use_dataset=True
- faker.providers.bank.es_MX.get_clabe_control_digit(clabe: str) int ¶
Generate the checksum digit for a CLABE.
- Parameters
clabe – CLABE.
- Returns
The CLABE checksum digit.
- faker.providers.bank.es_MX.is_valid_clabe(clabe: str) bool ¶
Check if a CLABE is valid using the checksum.
- Parameters
clabe – CLABE.
- Returns
True if the CLABE is valid, False otherwise.
- class faker.providers.bank.es_MX.Provider(generator: Any)¶
Bases:
faker.providers.bank.Provider
Bank provider for
es_MX
locale.- banks: Tuple[str, Ellipsis] = ('ABC Capital, S.A. I.B.M.', 'Acciones y Valores Banamex, S.A. de C.V., Casa de Bolsa',...¶
- bank_codes: Tuple[int, Ellipsis] = (2, 6, 9, 12, 14, 19, 21, 22, 30, 32, 36, 37, 42, 44, 58, 59, 60, 62, 72, 102, 103, 106, 108,...¶