From 8c6d5a522fd940acbd5725619849e8e5825301dc Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Thu, 26 May 2016 19:54:01 +0200 Subject: [PATCH] Add docstring to gen_volume() --- git-sound.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/git-sound.py b/git-sound.py index 314dab0..97e7b85 100644 --- a/git-sound.py +++ b/git-sound.py @@ -139,6 +139,14 @@ class GitMIDI(MIDIFile): self.__setup_repo() def gen_volume(self, deletions, insertions, deviation=10): + """ + Generate a volume based on the number of modified lines + (insertions - deletions). + + deviation specifies the minimum and maximum volume (minimum is + the value of deviation, maximum is 255 - deviation). + """ + return max( deviation, min(255 - deviation,