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.4 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
45
46
47
48
49
  1. import os
  2. from pathlib import Path
  3. import logging
  4. logging.basicConfig(level=logging.INFO, format=' [%(asctime)s]: %(message)s: ')
  5. print(Path("x/y/a.txt"))
  6. package_name = "deppClassifier"
  7. list_of_files = [
  8. ".github/workflows/.gitkeep",
  9. f"src/{package_name}/__init__.py",
  10. f"src/{package_name}/components/__init__.py",
  11. f"src/{package_name}/utils/__init__.py",
  12. f"src/{package_name}/config/__init__.py",
  13. f"src/{package_name}/pipeline/__init__.py",
  14. f"src/{package_name}/entity/__init__.py",
  15. f"src/{package_name}/constants/__init__.py",
  16. "tests/__init__.py",
  17. "tests/unit/__init__.py",
  18. "tests/integration/__init__.py",
  19. "configs/config.yaml",
  20. "dvc.yaml",
  21. "params.yaml",
  22. "init_setup.sh",
  23. "requirements.txt",
  24. "requirements_dev.txt",
  25. "setup.py",
  26. "setup.cfg",
  27. "pyproject.toml",
  28. "tox.ini",
  29. "research/trials.ipynb"
  30. ]
  31. for filepath in list_of_files:
  32. filepath = Path(filepath)
  33. filedir, filename = os.path.split(filepath)
  34. if filedir != "":
  35. os.makedirs(filedir, exist_ok=True)
  36. logging.info(f"Creating directory: {filedir} for file: {filename}")
  37. if (not os.path.exists(filepath)) or (os.path.getsize(filepath) == 0):
  38. with open(filepath, "w") as f:
  39. pass #this helps create a empty file
  40. logging.info(f"Creating empty file: {filepath}")
  41. else:
  42. 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...