From fbac0ce9ce2df9e9d5e73e052b34ab4bb5284d47 Mon Sep 17 00:00:00 2001 From: ben05allen Date: Mon, 9 Oct 2023 15:58:53 +0900 Subject: [PATCH] adding project files --- .gitignore | 73 ++++++++++++++++++++++++++++++++++++++++++++++++ create_dat.py | 10 +++---- models.py | 5 ++++ requirements.txt | 1 + 4 files changed, 83 insertions(+), 6 deletions(-) create mode 100644 .gitignore create mode 100644 models.py create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ba60c4a --- /dev/null +++ b/.gitignore @@ -0,0 +1,73 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*.pyo +*.egg-info/ +*.egg + +# C extensions +*.so + +# Distribution / packaging +.Python +.venv/ +venv/ +.vscode/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ +.pytest_cache/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IDEs and editors +# VSCode +.vscode/ +# PyCharm +.idea/ + +# Operating systems +*.swp +*.swo +.DS_Store +._* +.Spotlight-V100 +.Trashes + +# Custom exclusions +# You can add custom exclusions specific to your project here +# e.g., exclude a secrets file +# secrets.yml diff --git a/create_dat.py b/create_dat.py index 531fde5..d8f9c3d 100644 --- a/create_dat.py +++ b/create_dat.py @@ -1,12 +1,8 @@ -from fake import Faker +from faker import Faker +from models import Student import random import pickle -class Student: - def __init__(self, roll, name, percentage): - self.roll = roll - self.name = name - self.percentage = percentage def generate_fake_records(n): fake = Faker() @@ -22,6 +18,7 @@ def generate_fake_records(n): return records + def save_to_dat(records): try: with open("fake_stud.dat", "wb") as file: @@ -31,6 +28,7 @@ def save_to_dat(records): except Exception as e: print(f"Error: {e}") + if __name__ == "__main__": n = int(input("Enter the number of fake records to generate: ")) fake_records = generate_fake_records(n) diff --git a/models.py b/models.py new file mode 100644 index 0000000..dc09470 --- /dev/null +++ b/models.py @@ -0,0 +1,5 @@ +class Student: + def __init__(self, roll, name, percentage): + self.roll = roll + self.name = name + self.percentage = percentage diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..ea45cd0 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +Faker \ No newline at end of file