Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

template.py 1.3 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
  1. import os
  2. from pathlib import Path
  3. import logging
  4. logging.basicConfig(level= logging.INFO, format='[%(asctime)s]: %(message)s:')
  5. project_name = "cnnClassifier"
  6. list_of_files = [
  7. ".gimthub\\workflows\\.gitkeep",
  8. f"src\\{project_name}\\__init__.py",
  9. f"src\\{project_name}\\components\\__init__.py",
  10. f"src\\{project_name}\\utils\\__init__.py",
  11. f"src\\{project_name}\\config\\__init__.py",
  12. f"src\\{project_name}\\config\\configuration.py",
  13. f"src\\{project_name}\\pipeline\\__init__.py",
  14. f"src\\{project_name}\\entity\\__init__.py",
  15. f"src\\{project_name}\\constants\\__init__.py",
  16. "config\\config.yaml",
  17. "dvc.yaml",
  18. "params.yaml",
  19. "requirements.txt",
  20. "setup.py",
  21. "research\\trials.ipynb",
  22. "templates\\index.html"
  23. ]
  24. for filepath in list_of_files:
  25. filepath = Path(filepath)
  26. filedir, filename = os.path.split(filepath)
  27. if filedir !="":
  28. os.makedirs(filedir, exist_ok=True)
  29. logging.info(f"Creating Directory: {filedir} for the file: {filename}")
  30. if (not os.path.exists(filepath)) or (os.path.getsize(filepath) == 0):
  31. with open(filepath, "w") as f:
  32. pass
  33. logging.info(f" Creating empty file: {filepath}")
  34. else:
  35. logging.info(f"{filename} already exists")
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...