Skip to content

Commit 28c16c2

Browse files
inishchithjgbarah
authored andcommitted
[graal] Add example script
Signed-off-by: inishchith <[email protected]>
1 parent c4d0b1b commit 28c16c2

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

graal/cocom.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ Once you've successfully installed Graal, you can get started real quick with th
7070
[2019-03-27 21:35:59,117] - Quest completed.
7171
```
7272

73-
- In the above graal output, you can read one commit item obtained which contains "analysis" attribute under "data".
73+
- In the above graal output, you can read one commit item obtained which contains `analysis` attribute under `data`.
7474

7575
**Note:** Some of the intermediate output items are skipped for representational purposes.
7676

7777
## Using Graal as a Python script
7878

79-
- We can also use the backend provided by Graal in python scripts via importing the appropriate modules. Show below is using `cocom` backend in a python script. [ Example: [graal_cocom_1.py](./scripts/graal_cocom_1.py) ]
79+
- We can also use the backend provided by Graal in python scripts via importing the appropriate modules. Shown below is using `cocom` backend in a python script. [ Example: [graal_cocom_1.py](./scripts/graal_cocom_1.py) ]
8080

8181
```python3
8282
#! /usr/bin/env python3

graal/scripts/graal_cocom_1.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#! /usr/bin/env python3
2+
from graal.backends.core.cocom import CoCom
3+
4+
# URL for the git repo to analyze
5+
repo_uri = "http://github.com/chaoss/grimoirelab-graal"
6+
7+
# directory where to mirror the repo
8+
repo_dir = "/tmp/graal-cocom"
9+
10+
# Cocom object initialization
11+
cc = CoCom(uri=repo_uri, git_path=repo_dir)
12+
13+
# fetch all commits
14+
commits = [commit for commit in cc.fetch()]

0 commit comments

Comments
 (0)