Menu

#5729 Fix SyntaxWarning's

Fixed
2020-02-06
2020-02-02
No

Fix SyntaxWarning's

Individual changes:
1) abc2ly: Fix SyntaxWarning

This line still works in Python 3.8, but it throws a warning:

SyntaxWarning: "is" with a literal. Did you mean "=="?

2) musicxml2ly: Remove drummode

This code is fundamentally broken: NoteEvent::ly_expression() and
NoteEvent::chord_element_ly() miss a '%' to format the string. Instead
the code "calls" the string which Python meets with a SyntaxWarning.

Trying to hit this code path, musicxml only sets the drum_type attribute
in Note::initialize_drum_event() called from Note::to_lily_object().
However as far as I understand the MusicXML specification, a <note>
must always have either a <pitch>, or <unpitched>, or <rest>.
If I try to construct an (invalid) input with only an instrument name,
musicxml2ly breaks at another function, so this is really dead code.</rest></unpitched></pitch></note>

http://codereview.appspot.com/559440043

Discussion

  • Jonas Hahnfeld

    Jonas Hahnfeld - 2020-02-02
     
  • Anonymous

    Anonymous - 2020-02-02
    • Description has changed:

    Diff:

    
    
    • Needs: -->
    • Patch: new --> review
    • Type: -->
     
  • Anonymous

    Anonymous - 2020-02-02

    Passes make. make check and a full make doc.

     
  • Anonymous

    Anonymous - 2020-02-04
    • Patch: review --> countdown
     
  • Anonymous

    Anonymous - 2020-02-04

    Patch on countdown for Feb 6th.

     
  • Anonymous

    Anonymous - 2020-02-06
    • Patch: countdown --> push
     
  • Anonymous

    Anonymous - 2020-02-06

    Patch counted down - please push.

     
  • Jonas Hahnfeld

    Jonas Hahnfeld - 2020-02-06
    • labels: --> Fixed_2_21_0
    • status: Started --> Fixed
    • Patch: push -->
     
  • Jonas Hahnfeld

    Jonas Hahnfeld - 2020-02-06

    pushed to staging

    commit 456b465c8657fa5346db9f122473e8e991e238c7
    Author:     Jonas Hahnfeld <hahnjo@hahnjo.de>
    AuthorDate: Sun Feb 2 15:35:29 2020 +0100
    Commit:     Jonas Hahnfeld <hahnjo@hahnjo.de>
    CommitDate: Thu Feb 6 12:03:06 2020 +0100
    
        Issue 5729/2: musicxml2ly: Remove drummode
    
        This code is fundamentally broken: NoteEvent::ly_expression() and
        NoteEvent::chord_element_ly() miss a '%' to format the string. Instead
        the code "calls" the string which Python meets with a SyntaxWarning.
    
        Trying to hit this code path, musicxml only sets the drum_type attribute
        in Note::initialize_drum_event() called from Note::to_lily_object().
        However as far as I understand the MusicXML specification, a <note>
        must always have either a <pitch>, or <unpitched>, or <rest>.
        If I try to construct an (invalid) input with only an instrument name,
        musicxml2ly breaks at another function, so this is really dead code.
    
    commit 72952db2cd4c548fda98a35b751906745cfe5ed5
    Author:     Jonas Hahnfeld <hahnjo@hahnjo.de>
    AuthorDate: Sun Feb 2 14:13:52 2020 +0100
    Commit:     Jonas Hahnfeld <hahnjo@hahnjo.de>
    CommitDate: Thu Feb 6 12:02:59 2020 +0100
    
        Issue 5729/1: abc2ly: Fix SyntaxWarning
    
        This line still works in Python 3.8, but it throws a warning:
        > SyntaxWarning: "is" with a literal. Did you mean "=="?