Skip to content

Commit

Permalink
feat : #1 dummy data 생성기 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
Yujin-nKim committed Mar 31, 2024
1 parent da103a0 commit 7963b12
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion openAPI/dummy_data_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,40 @@
import string
from datetime import datetime


def generate_dummy_email():
domains = ["example.com", "test.com", "dummy.com"]
username = ''.join(random.choices(string.ascii_lowercase + string.digits, k=7))
domain = random.choice(domains)
return f"{username}@{domain}"


def preprocessing_book_index(book_index):
dummy_book_indx = "<p>Dummy Book Index<br>1.example index<br>2.example index<br>3.example index</p>"
if not book_index.strip():
return dummy_book_indx

return book_index.replace("\r\n", "")


def generate_book_discount():
values = [0, 10, 20]
weights = [5, 3, 2] # 각 값에 대한 가중치, 50%, 30%, 20%의 비율
return random.choices(values, weights=weights)[0]


def generate_book_package():
values = [0, 1]
weights = [3, 7] # 각 값에 대한 가중치, 30%, 70%의 비율
return random.choices(values, weights=weights)[0]

def preprocessing_book_published(date):

def preprocessing_book_published(date):
date_object = datetime.strptime(date, '%a, %d %b %Y %H:%M:%S %Z')

return date_object.strftime('%Y-%m-%d')


def generate_book_stock():
values = [200, 300]
weights = [5, 5] # 각 값에 대한 가중치, 30%, 70%의 비율
Expand Down

0 comments on commit 7963b12

Please sign in to comment.