-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
139 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
class BaseProvider: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from faker import Faker | ||
|
||
from faker_cli.templates import CloudFrontLogs, S3AccessLogs | ||
|
||
|
||
class FakerProvider: | ||
def __init__(self) -> None: | ||
self.fake = Faker() | ||
self.fake.add_provider(S3AccessLogs) | ||
self.fake.add_provider(CloudFrontLogs) | ||
|
||
def generate_row(self, column_types: list[tuple[str, list]]) -> list[str]: | ||
return [ | ||
self.fake.format(ctype, *args) | ||
if not ctype.startswith("unique.") | ||
else self.fake.unique.format(ctype.removeprefix("unique."), *args) | ||
for ctype, args in column_types | ||
] | ||
|
||
def format(self, log_entry) -> list[str]: | ||
return self.fake.format(log_entry) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from mimesis import Field | ||
|
||
|
||
class MimesisProvider: | ||
def __init__(self) -> None: | ||
self.field = Field() | ||
|
||
def generate_row(self, column_types: list[tuple[str, list]]) -> list[str]: | ||
return [self.field(ctype) for ctype, args in column_types] | ||
|
||
def format(self, log_entry) -> list[str]: | ||
raise NotImplementedError | ||
|
||
|
||
# field("person.username", mask="U_d", drange=(100, 1000)) |
Oops, something went wrong.