Skip to content

Commit

Permalink
Updated tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
AryazE committed Nov 6, 2024
1 parent 3c0742b commit abb0cf4
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
2 changes: 2 additions & 0 deletions tutorial/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ To isolate the packages that you install during this tutorial either [use Docker
2. Build the image: `docker build -t dynapyt_tutorial .`
3. Run bash in the container: `docker run -it dynapyt_tutorial /bin/bash`

Note: Changing the code in your host machine does not change the code inside the container. So you either need to share the directory using `-v` option when running docker (`-v .:/dynapyt/`), or repeat steps 2 and 3 each time you modify or implement an analysis.

### Virtual Environment
1. Install virtual environment:
- With pipx: `pipx install virtualenv`
Expand Down
4 changes: 2 additions & 2 deletions tutorial/task1/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
a = 1
b = 2
c = a + b
if c > 3:
print("c > 3")
if c >= 3:
print("c >= 3")
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@


class BranchCoverageAnalysis(BaseAnalysis):
def __init__(self):
super().__init__()
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.branches = {}

def enter_control_flow(self, dyn_ast: str, iid: int, cond_value: bool):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@


class CallGraphAnalysis(BaseAnalysis):
def __init__(self):
super(CallGraphAnalysis, self).__init__()
def __init__(self, *args, **kwargs):
super(CallGraphAnalysis, self).__init__(*args, **kwargs)
logging.basicConfig(filename="dynapyt.json", format="%(message)s", level=logging.INFO)
self.graph = {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@


class SlowStringConcatAnalysis(BaseAnalysis):
def __init__(self):
super().__init__()
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.in_loop = []
self.concat_count = []
self.threshold = 5
Expand Down

0 comments on commit abb0cf4

Please sign in to comment.