From 443883b6898f2a75e64d8d4797dd448ef3aeda70 Mon Sep 17 00:00:00 2001 From: "Clayton G. Hobbs" Date: Sun, 27 Dec 2015 12:23:14 -0500 Subject: Minor formatting improvements --- blather.py | 8 ++++---- recognizer.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/blather.py b/blather.py index b1c3777..00d0c49 100755 --- a/blather.py +++ b/blather.py @@ -106,7 +106,7 @@ class Blather: (key, value) = line.split(":", 1) print(key, value) self.commands[key.strip().lower()] = value.strip() - strings.write( key.strip()+"\n") + strings.write(key.strip() + "\n") # Close the strings file strings.close() @@ -127,7 +127,7 @@ class Blather: # Open and truncate the blather history file hfile = open(history_file, "w") for line in self.history: - hfile.write( line+"\n") + hfile.write(line + "\n") # Close the file hfile.close() @@ -221,7 +221,7 @@ class Blather: paths = ["/usr/share/blather/", "/usr/local/share/blather", local_data] for path in paths: resource = os.path.join(path, string) - if os.path.exists( resource ): + if os.path.exists(resource): return resource # If we get this far, no resource was found return False @@ -253,7 +253,7 @@ if __name__ == "__main__": action='store', help="command to run when a valid sentence is detected") - parser.add_argument( "--invalid-sentence-command", type=str, dest="invalid_sentence_command", + parser.add_argument("--invalid-sentence-command", type=str, dest="invalid_sentence_command", action='store', help="command to run when an invalid sentence is detected") diff --git a/recognizer.py b/recognizer.py index 0a65b7a..06a2b87 100755 --- a/recognizer.py +++ b/recognizer.py @@ -12,7 +12,7 @@ import os.path import sys # Define some global variables -this_dir = os.path.dirname( os.path.abspath(__file__) ) +this_dir = os.path.dirname(os.path.abspath(__file__)) class Recognizer(GObject.GObject): @@ -31,7 +31,7 @@ class Recognizer(GObject.GObject): # Build the pipeline cmd = audio_src + ' ! audioconvert ! audioresample ! pocketsphinx name=asr ! appsink sync=false' try: - self.pipeline = Gst.parse_launch( cmd ) + self.pipeline = Gst.parse_launch(cmd) except Exception as e: print(e.message) print("You may need to install gstreamer1.0-pocketsphinx") -- cgit 1.4.1