Skip to content

Commit

Permalink
Simplify handling of the locale argument to Faker
Browse files Browse the repository at this point in the history
Reviewed-by: Jon Dufresne
  • Loading branch information
francoisfreitag committed Nov 26, 2020
1 parent f3775af commit bacfd73
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions factory/faker.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,11 @@ class Faker(declarations.ParameteredDeclaration):
>>> foo = factory.Faker('name')
"""
def __init__(self, provider, **kwargs):
locale = kwargs.pop('locale', None)
self.provider = provider
super().__init__(
locale=locale,
**kwargs)
super().__init__(**kwargs)

def generate(self, params):
locale = params.pop('locale')
locale = params.pop('locale', None)
subfaker = self._get_faker(locale)
return subfaker.format(self.provider, **params)

Expand Down

0 comments on commit bacfd73

Please sign in to comment.