]> git.donarmstrong.com Git - lilypond.git/blobdiff - python/musicexp.py
MusicXML: coding style fixes.
[lilypond.git] / python / musicexp.py
index b543dbc2e6056d5267406d485c13137d4dc25d15..38f772c38ad6f8168b332c87d8ac6365c23fcea6 100644 (file)
@@ -481,13 +481,13 @@ class SlurEvent (SpanEvent):
     def ly_expression (self):
         return {-1: '(',
             0:'',
-            1:')'}[self.span_direction]
+            1:')'}.get (self.span_direction, '')
 
 class BeamEvent (SpanEvent):
     def ly_expression (self):
         return {-1: '[',
             0:'',
-            1:']'}[self.span_direction]
+            1:']'}.get (self.span_direction, '')
 
 class ArpeggioEvent(Event):
     def ly_expression (self):
@@ -503,11 +503,7 @@ class HairpinEvent (Event):
     def __init__ (self, type):
         self.type = type
     def hairpin_to_ly (self):
-        val = ''
-        tp = { 0: '\!', 1: '\<', -1: '\>' }.get (self.type)
-        if tp:
-            val += tp
-        return val
+        return { 0: '\!', 1: '\<', -1: '\>' }.get (self.type, '')
     
     def ly_expression (self):
         return self.hairpin_to_ly ()
@@ -549,11 +545,7 @@ class ArticulationEvent (Event):
         self.force_direction = None
 
     def direction_mod (self):
-        dirstr = { 1: '^', -1: '_', 0: '-' }.get (self.force_direction)
-        if dirstr:
-            return dirstr
-        else:
-            return ''
+        return { 1: '^', -1: '_', 0: '-' }.get (self.force_direction, '')
 
     def ly_expression (self):
         return '%s\\%s' % (self.direction_mod (), self.type)
@@ -679,7 +671,7 @@ class ClefChange (Music):
         }
     
     def lisp_expression (self):
-        (glyph, pos, c0) = self.clef_dict [self.type]
+        (glyph, pos, c0) = self.clef_dict.get (self.type)
         clefsetting = """
         (make-music 'SequentialMusic
         'elements (list