Skip to content

Commit e711ca4

Browse files
AaronTohwoojiahao
andauthored
[hp-view-graph] Implement hands on hp-view-graph (#82)
# Exercise Review ## Exercise Discussion Link the exercise discussion issue ## Checklist - [ ] If you require a new remote repository on the `Git-Mastery` organization, have you [created a request](https://github.com/git-mastery/exercises/issues/new?template=request_exercise_repository.md) for it? - [ ] Have you written unit tests using [`repo-smith`](https://github.com/git-mastery/repo-smith) to validate the exercise grading scheme? - [x] Have you tested the download script using `test-download.sh`? - [x] Have you verified that this exercise does not already exist or is not currently in review? - [ ] Did you introduce a new grading mechanism that should belong to [`git-autograder`](https://github.com/git-mastery/git-autograder)? - [ ] Did you introduce a new dependency that should belong to [`app`](https://github.com/git-mastery/app)? --------- Co-authored-by: Jiahao <woojiahao1234@gmail.com>
1 parent 95e85e5 commit e711ca4

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

hands_on/view_graph.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import os
2+
3+
from exercise_utils.file import create_or_update_file, append_to_file
4+
from exercise_utils.git import add, init, commit
5+
6+
__requires_git__ = True
7+
__requires_github__ = False
8+
9+
10+
def download(verbose: bool = False) -> None:
11+
os.makedirs("things")
12+
os.chdir("things")
13+
14+
init(verbose)
15+
16+
create_or_update_file(
17+
"fruits.txt",
18+
"""
19+
apples
20+
bananas
21+
cherries
22+
dragon fruits
23+
""",
24+
)
25+
add(["fruits.txt"], verbose)
26+
commit("Add fruits.txt", verbose)
27+
28+
append_to_file("fruits.txt", "figs\n")
29+
add(["fruits.txt"], verbose)
30+
commit("Insert figs into fruits.txt", verbose)
31+
32+
create_or_update_file("colours.txt", "a file for colours\n")
33+
create_or_update_file("shapes.txt", "a file for shapes\n")
34+
add(["colours.txt", "shapes.txt"], verbose)
35+
commit("Add colours.txt, shapes.txt", verbose)

0 commit comments

Comments
 (0)