Skip to content

Commit

Permalink
Merge pull request #2 from joke2k/master
Browse files Browse the repository at this point in the history
update April 21, 2018
  • Loading branch information
confirmationbias616 committed Apr 22, 2018
2 parents 31f4298 + 9d1face commit 30c383d
Show file tree
Hide file tree
Showing 25 changed files with 2,139 additions and 2,326 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.8.12
current_version = 0.8.13
files = setup.py faker/__init__.py docs/conf.py
commit = True
tag = True
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
Changelog
=========

`0.8.13 - 12-April-2018 <https://github.com/joke2k/faker/compare/v0.8.12...v0.8.13>`__
--------------------------------------------------------------------------------------

* Add ``no_NO`` bank provider. Thanks @cloveras.
* Add ``ipv4_network_class``, ``ipv4_private``, ``ipv4_public`` providers. Thanks @ZuluPro.
* Add ``address_class`` and ``private`` arguments to ``ipv4`` provider. Thanks @ZuluPro.
* Add ``currency``, ``currency_name``, ``cryptocurrency``, ``cryptocurrency_code`` and ``cryptocurrency_name`` to currency provider. Thanks @ZuluPro.
* Add automotive provider for ``de_DE``. Thanks @gsilvan.
* Fix edgecases for Finnish ``ssn`` provider. Thanks @sanga.
* Add job provider for ``pt_BR``. Thanks @paladini.
* Add ``unix_device`` and ``unix_partition`` to ``file`` provider. Thanks @ZuluPro.
* Add ``random_lowercase_letter`` and ``random_uppercase_letter`` to the base provider. Thanks @ZuluPro.
* Clarify CLI help. Thanks @confirmationbias616.


`0.8.12 - 12-March-2018 <https://github.com/joke2k/faker/compare/v0.8.11...v0.8.12>`__
--------------------------------------------------------------------------------------

Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ test:
release:
rm -rf build dist
python setup.py sdist bdist_wheel
git push --tags
twine upload dist/*
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@
# built documents.
#
# The short X.Y version.
version = '0.8.12'
version = '0.8.13'
# The full version, including alpha/beta/rc tags.
release = '0.8.12'
release = '0.8.13'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 1 addition & 1 deletion faker/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION = '0.8.12'
VERSION = '0.8.13'

from faker.generator import Generator
from faker.factory import Factory
Expand Down
15 changes: 11 additions & 4 deletions faker/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,14 @@ def execute(self):
{0}
faker can take a locale as an argument, to return localized data. If no
localized provider is found, the factory falls back to the default en_US
locale.
Faker can take a locale as an optional argument, to return localized data. If
no locale argument is specified, the factory falls back to the user's OS
locale as long as it is supported by at least one of the providers.
- for this user, the default locale is {1}.
If the optional argument locale and/or user's default locale is not available
for the specified provider, the factory falls back to faker's default locale,
which is {2}.
examples:
Expand All @@ -160,7 +165,9 @@ def execute(self):
Josiah Maggio;
Gayla Schmitt;
""".format(', '.join(sorted(AVAILABLE_LOCALES)))
""".format(', '.join(sorted(AVAILABLE_LOCALES)),
default_locale,
DEFAULT_LOCALE)

formatter_class = argparse.RawDescriptionHelpFormatter
parser = argparse.ArgumentParser(
Expand Down
1,165 changes: 472 additions & 693 deletions faker/providers/address/nl_BE/__init__.py

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions faker/providers/bank/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Provider(BaseProvider):
IBAN/BBANs for the given country. But the ids of the banks are random and
not valid banks! Same for account numbers.
"""

ALPHA = {c: str(ord(c) % 55) for c in string.ascii_uppercase}

# see https://en.wikipedia.org/wiki/International_Bank_Account_Number
Expand All @@ -26,7 +26,7 @@ def bank_country(self):

def bban(self):
temp = re.sub(r'\?',
lambda x: self.random_element(ascii_uppercase),
lambda x: self.random_element(ascii_uppercase),
self.bban_format)
return self.numerify(temp)

Expand Down
2 changes: 1 addition & 1 deletion faker/providers/barcode/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class Provider(BaseProvider):

def ean(self, length=13):
code = [self.random_digit() for i in range(length - 1)]
code = [self.random_digit() for _ in range(length - 1)]

if length not in (8, 13):
raise AssertionError("length can only be 8 or 13")
Expand Down
10 changes: 5 additions & 5 deletions faker/providers/company/fi_FI/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ def company_business_id(self):
def calculate_checksum(number):
"""Calculate the checksum using mod 11,2 method"""
factors = [7, 9, 10, 5, 8, 4, 2]
sum = 0
sum_ = 0
for x, y in zip(number, factors):
sum = sum + int(x) * y
if sum % 11 == 0:
sum_ = sum_ + int(x) * y
if sum_ % 11 == 0:
return '0'
else:
return str(11 - sum % 11)
return str(11 - sum_ % 11)

first_digit = str(self.random_digit_not_null())
body = first_digit + self.bothify(self.random_element(('######',)))
cs = calculate_checksum(body)
return (body + '-' + str(cs))
return body + '-' + str(cs)

def company_vat(self):
"""
Expand Down
12 changes: 6 additions & 6 deletions faker/providers/company/fr_CH/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ def ide(self):
"""
def _checksum(digits):
factors = (5, 4, 3, 2, 7, 6, 5, 4)
sum = 0
sum_ = 0
for i in range(len(digits)):
sum += digits[i] * factors[i]
return sum % 11
sum_ += digits[i] * factors[i]
return sum_ % 11

while True:
# create an array of first 8 elements initialized randomly
digits = self.generator.random.sample(range(10), 8)
# sum those 8 digits according to (part of) the "modulo 11"
sum = _checksum(digits)
sum_ = _checksum(digits)
# determine the last digit to make it qualify the test
control_number = 11 - sum
if (control_number != 10):
control_number = 11 - sum_
if control_number != 10:
digits.append(control_number)
break

Expand Down
6 changes: 3 additions & 3 deletions faker/providers/date_time/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1271,9 +1271,9 @@ def _parse_date_string(cls, value):
raise ParseError("Can't parse date string `{}`.".format(value))
parts = parts.groupdict()
time_params = {}
for (name, param) in parts.items():
if param:
time_params[name] = int(param)
for (name_, param_) in parts.items():
if param_:
time_params[name_] = int(param_)

if 'years' in time_params:
if 'days' not in time_params:
Expand Down
2 changes: 1 addition & 1 deletion faker/providers/file/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def file_path(self, depth=1, category=None, extension=None):
"""
file = self.file_name(category, extension)
path = "/{0}".format(file)
for d in range(0, depth):
for _ in range(0, depth):
path = "/{0}{1}".format(self.generator.word(), path)
return path

Expand Down
2 changes: 1 addition & 1 deletion faker/providers/internet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def ipv6(self, network=False):
return address

def mac_address(self):
mac = [self.generator.random.randint(0x00, 0xff) for i in range(0, 6)]
mac = [self.generator.random.randint(0x00, 0xff) for _ in range(0, 6)]
return ":".join(map(lambda x: "%02x" % x, mac))

def uri_page(self):
Expand Down

0 comments on commit 30c383d

Please sign in to comment.