Skip to content

Commit 1a267ca

Browse files
committed
Add lib to VCS
1 parent 488a1b4 commit 1a267ca

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ dist/
1717
downloads/
1818
eggs/
1919
.eggs/
20-
lib/
2120
lib64/
2221
parts/
2322
sdist/

lib/__init__.py

Whitespace-only changes.

lib/utils.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import os
2+
import shutil
3+
4+
5+
class CodeGenSandbox:
6+
7+
project_path: str
8+
class_skeleton_path: str
9+
test_path: str
10+
sandbox_path: str
11+
12+
def __init__(self, project_path: str, class_skeleton_path: str, test_path: str, sandbox_path: str):
13+
assert os.path.exists(project_path), "The project_dir directory does not exist!"
14+
assert os.path.exists(os.path.join(project_path, class_skeleton_path)), "The class_skeleton path does not exist!"
15+
assert os.path.exists(os.path.join(project_path, test_path)), "The test_path path does not exist!s"
16+
self.project_path = project_path
17+
self.class_skeleton_path = class_skeleton_path
18+
self.test_path = test_path
19+
self.sandbox_path = sandbox_path
20+
21+
def init_sandbox(self) -> None:
22+
if os.path.exists(self.sandbox_path):
23+
shutil.rmtree(self.sandbox_path)
24+
# os.makedirs(self.sandbox_path)
25+
shutil.copytree(self.project_path, self.sandbox_path)
26+
27+
def get_sandboxed_project_path(self) -> str:
28+
return self.sandbox_path
29+
30+
def get_sandboxed_test_path(self) -> str:
31+
return os.path.join(self.sandbox_path, self.test_path)
32+
33+
def get_sandboxed_class_path(self) -> str:
34+
return os.path.join(self.sandbox_path, self.class_skeleton_path)

0 commit comments

Comments
 (0)