Skip to content

Commit

Permalink
More
Browse files Browse the repository at this point in the history
  • Loading branch information
barseghyanartur committed Dec 1, 2023
1 parent 67ba8a5 commit dcd28fe
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions fake.py
Original file line number Diff line number Diff line change
Expand Up @@ -1404,10 +1404,7 @@ def __init__(
):
self.method_name = method_name
self.kwargs = kwargs
if faker is None:
self.faker = FAKER
else:
self.faker = faker
self.faker = faker or FAKER

def __call__(self):
method = getattr(self.faker, self.method_name)
Expand All @@ -1416,7 +1413,7 @@ def __call__(self):

class FactoryMeta(type):
# List of methods to be created in the Factory class
enabled_methods = [
enabled_methods = {
"bmp_file",
"date",
"date_time",
Expand All @@ -1443,7 +1440,7 @@ class FactoryMeta(type):
"username",
"uuid",
"word",
]
}

def __new__(cls, name, bases, attrs):
for method_name in cls.enabled_methods:
Expand Down Expand Up @@ -1479,10 +1476,7 @@ class Factory(metaclass=FactoryMeta):
"""Factory."""

def __init__(self, faker: Optional[Faker] = None) -> None:
if faker is None:
self.faker = FAKER
else:
self.faker = faker
self.faker = faker or FAKER


FACTORY = Factory(faker=FAKER)
Expand Down

0 comments on commit dcd28fe

Please sign in to comment.