From 80cc74a016f90469311d7c10ccacc978c71150fe Mon Sep 17 00:00:00 2001 From: Stefano Dalla Palma Date: Tue, 1 Mar 2022 16:28:47 +0100 Subject: [PATCH] Update tutorial.rst Made doc consistent with current version --- docs/tutorial.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/tutorial.rst b/docs/tutorial.rst index 1e4ef763..772d7fed 100644 --- a/docs/tutorial.rst +++ b/docs/tutorial.rst @@ -27,8 +27,8 @@ We can also pass a list of repositories (both local and remote), and PyDriller w Let's make another example: print all the modified files for every commit. This does the magic:: for commit in Repository('path/to/the/repo').traverse_commits(): - for modification in commit.modifications: - print('Author {} modified {} in commit {}'.format(commit.author.name, modification.filename, commit.hash)) + for file in commit.modified_files: + print('Author {} modified {} in commit {}'.format(commit.author.name, file.filename, commit.hash)) That's it! @@ -37,6 +37,6 @@ Behind the scenes, PyDriller opens the Git repository and extracts all the neces Furthermore, PyDriller can calculate structural metrics of every file changed in a commit. To calculate these metrics, Pydriller relies on `Lizard `_, a powerful tool that can analyze source code of many different programming languages, both at class and method level! :: for commit in Repository('path/to/the/repo').traverse_commits(): - for mod in commit.modifications: + for file in commit.modified_files: print('{} has complexity of {}, and it contains {} methods'.format( - mod.filename, mod.complexity, len(mod.methods))) + file.filename, file.complexity, len(file.methods)))