]> git.immae.eu Git - perso/Immae/Projets/Python/MusicSampler.git/blobdiff - helpers/__init__.py
Coding styles
[perso/Immae/Projets/Python/MusicSampler.git] / helpers / __init__.py
index da447d8c589a417efb85ab92218326a21339936e..9d6663893bc32634b1163f7a525b8b04a7bdf9a5 100644 (file)
@@ -17,12 +17,12 @@ def path():
         return path + "/../"
 
 def parse_args():
-    argv = sys.argv[1:]
-    sys.argv = sys.argv[:1]
+    argv = sys.argv[1 :]
+    sys.argv = sys.argv[: 1]
     if "--" in argv:
         index = argv.index("--")
-        kivy_args = argv[index+1:]
-        argv = argv[:index]
+        kivy_args = argv[index+1 :]
+        argv = argv[: index]
 
         sys.argv.extend(kivy_args)
 
@@ -39,7 +39,8 @@ def parse_args():
             help="Print messages in console")
     parser.add_argument("-m", "--builtin-mixing",
             action="store_true",
-            help="Make the mixing of sounds manually (do it if the system cannot handle it correctly)")
+            help="Make the mixing of sounds manually\
+                    (do it if the system cannot handle it correctly)")
     parser.add_argument("-l", "--latency",
             default="high",
             required=False,
@@ -48,7 +49,8 @@ def parse_args():
             default=0,
             type=int,
             required=False,
-            help="Blocksize: If not 0, the numbe of frames to take at each step for the mixer")
+            help="Blocksize: If not 0, the number of frames to take\
+                    at each step for the mixer")
     parser.add_argument("-f", "--frame-rate",
             default=44100,
             type=int,
@@ -66,7 +68,8 @@ def parse_args():
             help="Sample width (number of bytes for each frame)")
     parser.add_argument("-V", "--version",
             action="version",
-            help="Displays the current version and exits. Only use in bundled package",
+            help="Displays the current version and exits. Only use\
+                    in bundled package",
             version=show_version())
     parser.add_argument("--device",
             action=SelectDeviceAction,
@@ -79,7 +82,8 @@ def parse_args():
             )
     parser.add_argument('--',
             dest="args",
-            help="Kivy arguments. All arguments after this are interpreted by Kivy. Pass \"-- --help\" to get Kivy's usage.")
+            help="Kivy arguments. All arguments after this are interpreted\
+                    by Kivy. Pass \"-- --help\" to get Kivy's usage.")
 
     from kivy.logger import Logger
     Logger.setLevel(logging.ERROR)
@@ -125,11 +129,13 @@ def duration_to_min_sec(duration):
     else:
         return "{}:{:0>2}".format(minutes, seconds)
 
-def gain(volume, old_volume = None):
+def gain(volume, old_volume=None):
     if old_volume is None:
         return 20 * math.log10(volume / 100)
     else:
-        return [20 * math.log10(max(volume, 0.1) / max(old_volume, 0.1)), max(volume, 0)]
+        return [
+                20 * math.log10(max(volume, 0.1) / max(old_volume, 0.1)),
+                max(volume, 0)]
 
 def debug_print(message):
     from kivy.logger import Logger