Add docstring to gen_volume()

This commit is contained in:
Gergely Polonkai 2016-05-26 19:54:01 +02:00
parent 85710c7ca5
commit 8c6d5a522f

View File

@ -139,6 +139,14 @@ class GitMIDI(MIDIFile):
self.__setup_repo() self.__setup_repo()
def gen_volume(self, deletions, insertions, deviation=10): 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( return max(
deviation, deviation,
min(255 - deviation, min(255 - deviation,