Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit cde14ea

Browse files
committed
Improve create projects methodes :)
1 parent e3fdbbe commit cde14ea

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

‎utils/projcets_helpers.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,12 @@ def create_c_project(path: str) -> None:
2828
""" Create a c project """
2929
run(f"touch {path}/main.c")
3030
run(f"touch {path}/Makefile")
31-
run(f"touch {path}/.gitignore")
3231

3332
def create_python_project(path: str) -> None:
3433
""" Create a python project """
35-
run(f"touch {path}/main.py")
36-
with open(f"{path}/test.py", "w") as f:
34+
with open(f"{path}/main.py", "w") as f:
3735
f.write("import unittest\n")
38-
f.write("from main import *\n\n")
36+
f.write("class Solution:\n\t pass\n\n")
3937
f.write("class Test(unittest.TestCase):\n")
4038
f.write("\t def test(self):\n")
4139
f.write("\t\t self.assertEqual(True, True)\n\n")
@@ -55,17 +53,13 @@ def create_java_project(path: str) -> None:
5553

5654
def create_cpp_project(path: str) -> None:
5755
with open(f"{path}/main.cpp", "w") as f:
58-
f.write("#include <iostream>\n\n")
59-
f.write("using namespace std;\n\n")
60-
61-
with open(f"{path}/test.cpp", "w") as f:
62-
f.write("#include <catch2/catch.hpp>\n")
63-
f.write("#include \"main.cpp\"\n\n")
56+
f.write(f"#include <iostream>\n \
57+
#include <catch2/catch.hpp>\n\n \
58+
using namespace std;\n\n")
6459

6560
with open(f"{path}/Makefile", "w") as f:
66-
f.write("all: main.cpp test.cpp\n")
67-
f.write("\t g++ -o main main.cpp\n")
68-
f.write("\t g++ -o test test.cpp -I /usr/local/include -L /usr/local/lib -lcatch2\n")
61+
f.write("all: main.cpp\n")
62+
f.write("\t g++ -o test main.cpp -I /usr/local/include -L /usr/local/lib -lcatch2\n")
6963
f.write("\t ./test\n")
7064

7165
def create_go_project(path: str) -> None:

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /