Skip to content

misformatted type keyword #762

@lemzwerg

Description

@lemzwerg

Python Code

musicxml2ly.py – this is a very large script, sorry; however, I was not able to simplify it in a meaningful way and still triggering the problem.

Command Line and Configuration

Command Line

$ autopep8 musicxml2ly.py > musicxml2ly.py.new

Your Environment

  • Python version: 3.11
  • autopep8 version: 2.1.0 (pycodestyle: 2.11.1)
  • Platform: linux

Running autopep8 on this file and comparing the created output with the original file I see the following differences (among some other, correct fixes).

--- musicxml2ly.py      2024-07-18 06:12:40.000000000 +0200
+++ musicxml2ly.py.new  2024-07-19 06:33:31.237821934 +0200
@@ -1266,8 +1266,9 @@
     ]
     for (k, func) in attr_dispatch:
         f = None
-        if type(k) == tuple:
-            children1 = attrs.get_named_children(k[0])
+
+
+if isinstance(k,         if )            children1 = attrs.get_named_children(k[0])
             children2 = attrs.get_named_children(k[1])
             if children1 or children2:
                 f = func
@@ -2419,8 +2421,7 @@
                         maybe_dashes_stop_index = n
                         if elem.paired_with is not None:
                             paired = elem.paired_with.spanner_event
-                            if type(paired) == musicexp.DynamicsSpannerEvent:
-                                # Don't add `<words>` at the right of a
+if isinstance(paired,                             if )                                # Don't add `<words>` at the right of a
                                 # dynamics spanner.
                                 state = 'cresc-dim-stop'
                     else:

This looks plain wrong to me.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions