Locale en_CA¶
faker.providers.address
¶
-
class
faker.providers.address.en_CA.
Provider
(generator: Any)¶ Bases:
faker.providers.address.en.Provider
-
address
() → str¶ Example: ‘791 Crist Parks, Sashabury, IL 86039-9874’ Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.address() ... '48764 Howard Forge Apt. 421\nVanessaside, SK M6E 8C9' '5938 Ramos Pike Suite 080\nLake Marytown, PE N2K4N4' '711 Golden Overpass\nWest Andreaville, ON Y5J8Y2' '342 Lori Bypass Suite 711\nEast Sandra, BC X4L4X7' '5159 Tom Roads Suite 330\nDavebury, NT N2S 3B4'
-
administrative_unit
() → str¶ Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.administrative_unit() ... 'Nova Scotia' 'Yukon Territory' 'Nova Scotia' 'Alberta' 'Newfoundland and Labrador'
-
building_number
() → str¶ Example: ‘791’ Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.building_number() ... '6048' '6475' '382' '2194' '924'
-
city
() → str¶ Example: ‘Sashabury’ Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.city() ... 'Changchester' 'West Tammyfort' 'Hullport' 'Howardborough' 'West Donald'
-
city_prefix
() → str¶ Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.city_prefix() ... 'Port' 'South' 'Port' 'South' 'North'
-
city_suffix
() → str¶ Example: ‘town’ Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.city_suffix() ... 'furt' 'chester' 'ton' 'view' 'haven'
-
country
() → str¶ Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.country() ... 'Tanzania' 'Hungary' 'Senegal' 'Tuvalu' 'Italy'
-
country_code
(representation: str = 'alpha-2') → str¶ Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.country_code() ... 'MV' 'PS' 'NL' 'BB' 'IL'
-
current_country
() → str¶ Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.current_country() ... 'Canada' 'Canada' 'Canada' 'Canada' 'Canada'
-
current_country_code
() → str¶ Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.current_country_code() ... 'CA' 'CA' 'CA' 'CA' 'CA'
-
postal_code_letter
() → str¶ Returns a random letter from the list of allowable letters in a canadian postal code
Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.postal_code_letter() ... 'R' 'S' 'B' 'L' 'X'
-
postalcode
() → str¶ Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.postalcode() ... 'S9B8L7' 'V9P3J5' 'E3L 5Y2' 'N2V 6Y7' 'J8Y9V5'
-
postalcode_in_province
(province_abbr: Optional[str] = None) → str¶ Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.postalcode_in_province() ... 'B8L7X5' 'X5X3G2' 'C2M6E8' 'M4S 9N8' 'X2Y7A1'
-
postcode
() → str¶ Returns a random postcode
Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.postcode() ... 'S9B8L7' 'V9P3J5' 'E3L 5Y2' 'N2V 6Y7' 'J8Y9V5'
-
postcode_in_province
(province_abbr: Optional[str] = None) → str¶ Returns a random postcode within the provided province abbreviation
Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.postcode_in_province() ... 'B8L7X5' 'X5X3G2' 'C2M6E8' 'M4S 9N8' 'X2Y7A1'
-
province
() → str¶ Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.province() ... 'Nova Scotia' 'Yukon Territory' 'Nova Scotia' 'Alberta' 'Newfoundland and Labrador'
-
province_abbr
() → str¶ Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.province_abbr() ... 'NS' 'YT' 'NS' 'AB' 'NL'
-
secondary_address
() → str¶ Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.secondary_address() ... 'Suite 604' 'Suite 647' 'Suite 938' 'Apt. 421' 'Suite 892'
-
street_address
() → str¶ Example: ‘791 Crist Parks’ Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.street_address() ... '0487 Hull Village Suite 759' '242 Christine Glen' '1157 Michael Island' '778 Brown Plaza' '60975 Jessica Squares'
-
street_name
() → str¶ Example: ‘Crist Parks’ Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.street_name() ... 'Chang Manor' 'Jonathan Pass' 'Sullivan Tunnel' 'Faulkner Knolls' 'William Haven'
-
street_suffix
() → str¶ Example: ‘Avenue’ Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.street_suffix() ... 'Vista' 'Lights' 'Trace' 'Manor' 'Canyon'
-
faker.providers.automotive
¶
-
class
faker.providers.automotive.en_CA.
Provider
(generator: Any)¶ Bases:
faker.providers.automotive.Provider
Implement automotive provider for
en_CA
locale.Sources:
-
license_plate
() → str¶ Generate a license plate.
Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.license_plate() ... '048 7YN' '759 3ZJ' 'E19 JEY' '892 411' 'PRDL 659'
-
faker.providers.barcode
¶
-
class
faker.providers.barcode.en_CA.
Provider
(generator: Any)¶ Bases:
faker.providers.barcode.en_US.Provider
Implement barcode provider for
en_CA
locale.Canada uses UPC as well, so there are similarities between this and the
en_US
implementation.Sources:
- https://gs1.org/standards/id-keys/company-prefix
- https://www.nationwidebarcode.com/upc-country-codes/
-
ean
(length: int = 13, prefixes: Tuple[Union[int, str, Tuple[Union[int, str], ...]], ...] = ()) → str¶ Generate an EAN barcode of the specified
length
.The value of
length
can only be8
or13
(default) which will create an EAN-8 or an EAN-13 barcode respectively.If a value for
prefixes
is specified, the result will begin with one of the sequences inprefixes
.Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.ean(length=13) ... '6604876475937' '8242194892418' '1578156593879' '7840801609759' '3513933287112'
>>> Faker.seed(0) >>> for _ in range(5): ... fake.ean(length=8) ... '66048763' '47593824' '42194897' '24115780' '15659385'
>>> Faker.seed(0) >>> for _ in range(5): ... fake.ean(prefixes=('00', )) ... '0004876475931' '0019489241156' '0056593877840' '0016097535134' '0087115871480'
>>> Faker.seed(0) >>> for _ in range(5): ... fake.ean(prefixes=('45', '49')) ... '4504876475932' '4919489241155' '4556593877841' '4516097535135' '4987115871489'
-
ean13
(prefixes: Tuple[Union[int, str, Tuple[Union[int, str], ...]], ...] = (), leading_zero: Optional[bool] = None) → str¶ Generate an EAN-13 barcode.
If
leading_zero
isTrue
, the leftmost digit of the barcode will be set to0
. IfFalse
, the leftmost digit cannot be0
. IfNone
(default), the leftmost digit can be any digit.If a value for
prefixes
is specified, the result will begin with one of the sequences inprefixes
and will ignoreleading_zero
.This method uses the standard barcode provider’s
ean13()
under the hood with theprefixes
argument set to the correct value to attain the behavior described above.Note
EAN-13 barcode that starts with a zero can be converted to UPC-A by dropping the leading zero. This may cause problems with readers that treat all of these code as UPC-A codes and drop the first digit when reading it.
You can set the argument
prefixes
( orleading_zero
for convenience) explicitly to avoid or to force the generated barcode to start with a zero. You can also generate actual UPC-A barcode withEnUsBarcodeProvider.upc_a()
.Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.ean13() ... '6604876475937' '8242194892418' '1578156593879' '7840801609759' '3513933287112'
>>> Faker.seed(0) >>> for _ in range(5): ... fake.ean13(leading_zero=False) ... '7048764759386' '5194892411572' '6593877840809' '7975351393329' '2587148418587'
>>> Faker.seed(0) >>> for _ in range(5): ... fake.ean13(leading_zero=True) ... '0604876475933' '0219489241150' '0156593877847' '0016097535134' '0287115871484'
>>> Faker.seed(0) >>> for _ in range(5): ... fake.ean13(prefixes=('00', )) ... '0004876475931' '0019489241156' '0056593877840' '0016097535134' '0087115871480'
>>> Faker.seed(0) >>> for _ in range(5): ... fake.ean13(prefixes=('45', '49')) ... '4504876475932' '4919489241155' '4556593877841' '4516097535135' '4987115871489'
-
ean8
(prefixes: Tuple[()] = ()) → str¶ Generate an EAN-8 barcode.
This method uses
ean()
under the hood with thelength
argument explicitly set to8
.If a value for
prefixes
is specified, the result will begin with one of the sequences inprefixes
.Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.ean8() ... '66048763' '47593824' '42194897' '24115780' '15659385'
>>> Faker.seed(0) >>> for _ in range(5): ... fake.ean8(prefixes=('00', )) ... '00048767' '00938242' '00489249' '00781565' '00877848'
>>> Faker.seed(0) >>> for _ in range(5): ... fake.ean8(prefixes=('45', '49')) ... '49048766' '45938245' '45489242' '49781564' '45877841'
-
localized_ean
(length: int = 13) → str¶ Generate a localized EAN barcode of the specified
length
.The value of
length
can only be8
or13
(default) which will create an EAN-8 or an EAN-13 barcode respectively.This method uses the standard barcode provider’s
ean()
under the hood with theprefixes
argument explicitly set tolocal_prefixes
of a localized barcode provider implementation.Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.localized_ean() ... '0804876475937' '7521948924119' '7581565938777' '0908016097536' '0839332871152'
>>> Faker.seed(0) >>> for _ in range(5): ... fake.localized_ean(length=13) ... '0804876475937' '7521948924119' '7581565938777' '0908016097536' '0839332871152'
>>> Faker.seed(0) >>> for _ in range(5): ... fake.localized_ean(length=8) ... '75048761' '06593827' '06948924' '07578151' '06387785'
-
localized_ean13
() → str¶ Generate a localized EAN-13 barcode.
This method uses
localized_ean()
under the hood with thelength
argument explicitly set to13
.Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.localized_ean13() ... '0804876475937' '7521948924119' '7581565938777' '0908016097536' '0839332871152'
-
localized_ean8
() → str¶ Generate a localized EAN-8 barcode.
This method uses
localized_ean()
under the hood with thelength
argument explicitly set to8
.Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.localized_ean8() ... '75048761' '06593827' '06948924' '07578151' '06387785'
-
upc_a
(upc_ae_mode: bool = False, base: Optional[str] = None, number_system_digit: Optional[int] = None) → str¶ Generate a 12-digit UPC-A barcode.
The value of
upc_ae_mode
controls how barcodes will be generated. IfFalse
(default), barcodes are not guaranteed to have a UPC-E equivalent. In this mode, the method usesEnUsBarcodeProvider.ean13()
under the hood, and the values ofbase
andnumber_system_digit
will be ignored.If
upc_ae_mode
isTrue
, the resulting barcodes are guaranteed to have a UPC-E equivalent, and the values ofbase
andnumber_system_digit
will be used to control what is generated.Under this mode,
base
is expected to have a 6-digit string value. If any other value is supplied, a random 6-digit string will be used instead. As fornumber_system_digit
, the expected value is a0
or a1
. If any other value is provided, this method will randomly choose from the two.Important
When
upc_ae_mode
is enabled, you might encounter instances where different values ofbase
(e.g.'120003'
and'120004'
) produce the same UPC-A barcode. This is normal, and the reason lies within the whole conversion process. To learn more about this and whatbase
andnumber_system_digit
actually represent, please refer toEnUsBarcodeProvider.upc_e()
.Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.upc_a() ... '604876475933' '219489241150' '156593877847' '016097535134' '287115871484'
>>> Faker.seed(0) >>> for _ in range(5): ... fake.upc_a(upc_ae_mode=True, number_system_digit=0) ... '066048000075' '064700000593' '082421000098' '048100009240' '015781000057'
>>> Faker.seed(0) >>> for _ in range(5): ... fake.upc_a(upc_ae_mode=True, number_system_digit=1) ... '166048000072' '164700000590' '182421000095' '148100009247' '115781000054'
>>> Faker.seed(0) >>> for _ in range(5): ... fake.upc_a(upc_ae_mode=True, base='123456', number_system_digit=0) ... '012345000065' '012345000065' '012345000065' '012345000065' '012345000065'
>>> Faker.seed(0) >>> for _ in range(5): ... fake.upc_a(upc_ae_mode=True, base='120003', number_system_digit=0) ... '012000000003' '012000000003' '012000000003' '012000000003' '012000000003'
>>> Faker.seed(0) >>> for _ in range(5): ... fake.upc_a(upc_ae_mode=True, base='120004', number_system_digit=0) ... '012000000003' '012000000003' '012000000003' '012000000003' '012000000003'
-
upc_e
(base: Optional[str] = None, number_system_digit: Optional[int] = None, safe_mode: bool = True) → str¶ Generate an 8-digit UPC-E barcode.
UPC-E barcodes can be expressed in 6, 7, or 8-digit formats, but this method uses the 8 digit format, since it is trivial to convert to the other two formats. The first digit (starting from the left) is controlled by
number_system_digit
, and it can only be a0
or a1
. The last digit is the check digit that is inherited from the UPC-E barcode’s UPC-A equivalent. The middle six digits are collectively referred to as thebase
(for a lack of a better term).On that note, this method uses
base
andnumber_system_digit
to first generate a UPC-A barcode for the check digit, and what happens next depends on the value ofsafe_mode
. The argumentsafe_mode
exists, because there are some UPC-E values that share the same UPC-A equivalent. For example, any UPC-E barcode of the formabc0000d
,abc0003d
, andabc0004d
share the same UPC-A valueabc00000000d
, but that UPC-A value will only convert toabc0000d
because of (a) how UPC-E is just a zero-suppressed version of UPC-A and (b) the rules around the conversion.If
safe_mode
isTrue
(default), this method performs another set of conversions to guarantee that the UPC-E barcodes generated can be converted to UPC-A, and that UPC-A barcode can be converted back to the original UPC-E barcode. Using the example above, even if the bases120003
or120004
are used, the resulting UPC-E barcode will always use the base120000
.If
safe_mode
isFalse
, then thenumber_system_digit
,base
, and the computed check digit will just be concatenated together to produce the UPC-E barcode, and attempting to convert the barcode to UPC-A and back again to UPC-E will exhibit the behavior described above.Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.upc_e() ... '16604872' '04759386' '04219484' '04115786' '15659385'
>>> Faker.seed(0) >>> for _ in range(5): ... fake.upc_e(base='123456') ... '11234562' '11234562' '01234565' '11234562' '11234562'
>>> Faker.seed(0) >>> for _ in range(5): ... fake.upc_e(base='123456', number_system_digit=0) ... '01234565' '01234565' '01234565' '01234565' '01234565'
>>> Faker.seed(0) >>> for _ in range(5): ... fake.upc_e(base='123456', number_system_digit=1) ... '11234562' '11234562' '11234562' '11234562' '11234562'
>>> Faker.seed(0) >>> for _ in range(5): ... fake.upc_e(base='120000', number_system_digit=0) ... '01200003' '01200003' '01200003' '01200003' '01200003'
>>> Faker.seed(0) >>> for _ in range(5): ... fake.upc_e(base='120003', number_system_digit=0) ... '01200003' '01200003' '01200003' '01200003' '01200003'
>>> Faker.seed(0) >>> for _ in range(5): ... fake.upc_e(base='120004', number_system_digit=0) ... '01200003' '01200003' '01200003' '01200003' '01200003'
>>> Faker.seed(0) >>> for _ in range(5): ... fake.upc_e(base='120000', number_system_digit=0, safe_mode=False) ... '01200003' '01200003' '01200003' '01200003' '01200003'
>>> Faker.seed(0) >>> for _ in range(5): ... fake.upc_e(base='120003', number_system_digit=0, safe_mode=False) ... '01200033' '01200033' '01200033' '01200033' '01200033'
>>> Faker.seed(0) >>> for _ in range(5): ... fake.upc_e(base='120004', number_system_digit=0, safe_mode=False) ... '01200043' '01200043' '01200043' '01200043' '01200043'
faker.providers.currency
¶
-
class
faker.providers.currency.en_CA.
Provider
(generator: Any)¶ Bases:
faker.providers.currency.Provider
-
cryptocurrency
() → Tuple[str, str]¶ Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.cryptocurrency() ... ('XRP', 'Ripple') ('STC', 'SwiftCoin') ('BC', 'BlackCoin') ('NXT', 'Nxt') ('IOTA', 'IOTA')
-
cryptocurrency_code
() → str¶ Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.cryptocurrency_code() ... 'XRP' 'STC' 'BC' 'NXT' 'IOTA'
-
cryptocurrency_name
() → str¶ Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.cryptocurrency_name() ... 'Ripple' 'SwiftCoin' 'BlackCoin' 'Nxt' 'IOTA'
-
currency
() → Tuple[str, str]¶ Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.currency() ... ('MWK', 'Malawian kwacha') ('NZD', 'New Zealand dollar') ('BAM', 'Bosnia and Herzegovina convertible mark') ('IRR', 'Iranian rial') ('SPL', 'Seborga luigino')
-
currency_code
() → str¶ Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.currency_code() ... 'MWK' 'NZD' 'BAM' 'IRR' 'SPL'
-
currency_name
() → str¶ Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.currency_name() ... 'Malawian kwacha' 'New Zealand dollar' 'Bosnia and Herzegovina convertible mark' 'Iranian rial' 'Seborga luigino'
-
currency_symbol
(code: Optional[str] = None) → str¶ Example: $ Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.currency_symbol() ... '$' '$' 'KM' 'kr' 'L'
-
pricetag
()¶ Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.pricetag() ... '$\xa07,604.87' '$\xa0975.93' '$\xa054.21' '$\xa089,241.15' '$\xa091,565.93'
-
faker.providers.phone_number
¶
-
class
faker.providers.phone_number.en_CA.
Provider
(generator: Any)¶ Bases:
faker.providers.phone_number.Provider
-
country_calling_code
() → str¶ Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.country_calling_code() ... '+687' '+595' '+880' '+964' '+41'
-
msisdn
() → str¶ https://en.wikipedia.org/wiki/MSISDN
Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.msisdn() ... '6048764759382' '2194892411578' '5659387784080' '6097535139332' '1158714841858'
-
phone_number
() → str¶ Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.phone_number() ... '+1 (460) 487-6475' '(624) 219-4892 x411' '181-565-9387 x784' '(401) 609-7535 x139' '(528) 711-5871'
-
faker.providers.ssn
¶
-
class
faker.providers.ssn.en_CA.
Provider
(generator: Any)¶ Bases:
faker.providers.ssn.Provider
-
ssn
() → str¶ Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.ssn() ... '640 146 171' '774 564 306' '127 764 306' '173 201 831' '388 220 535'
-