Skip to content

Commit 047d1ce

Browse files
author
Kevin J Walters
committed
Forcing the channel argument to as_bytes() in MIDIMessage and its children to be specified as a named (non-positional) arg. This is the variable that is ignored by some children. #3
1 parent 14d69d3 commit 047d1ce

9 files changed

Lines changed: 9 additions & 9 deletions

adafruit_midi/channel_pressure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def __init__(self, pressure):
5656
raise self._EX_VALUEERROR_OOR
5757

5858
# channel value is mandatory
59-
def as_bytes(self, channel=None):
59+
def as_bytes(self, *, channel=None):
6060
return bytearray([self._STATUS | (channel & self.CHANNELMASK),
6161
self.pressure])
6262

adafruit_midi/control_change.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def __init__(self, control, value):
5959
raise self._EX_VALUEERROR_OOR
6060

6161
# channel value is mandatory
62-
def as_bytes(self, channel=None):
62+
def as_bytes(self, *, channel=None):
6363
return bytearray([self._STATUS | (channel & self.CHANNELMASK),
6464
self.control, self.value])
6565

adafruit_midi/midi_message.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ def from_message_bytes(cls, midibytes, channel_in):
280280
# A default method for constructing wire messages with no data.
281281
# Returns a (mutable) bytearray with just the status code in.
282282
# pylint: disable=unused-argument
283-
def as_bytes(self, channel=None):
283+
def as_bytes(self, *, channel=None):
284284
"""Return the ``bytearray`` wire protocol representation of the object."""
285285
return bytearray([self._STATUS])
286286

adafruit_midi/note_off.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def __init__(self, note, velocity):
6060
raise self._EX_VALUEERROR_OOR
6161

6262
# channel value is mandatory
63-
def as_bytes(self, channel=None):
63+
def as_bytes(self, *, channel=None):
6464
return bytearray([self._STATUS | (channel & self.CHANNELMASK),
6565
self.note, self.velocity])
6666

adafruit_midi/note_on.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def __init__(self, note, velocity):
6060
raise self._EX_VALUEERROR_OOR
6161

6262
# channel value is mandatory
63-
def as_bytes(self, channel=None):
63+
def as_bytes(self, *, channel=None):
6464
return bytearray([self._STATUS | (channel & self.CHANNELMASK),
6565
self.note, self.velocity])
6666

adafruit_midi/pitch_bend_change.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def __init__(self, pitch_bend):
5757
raise self._EX_VALUEERROR_OOR
5858

5959
# channel value is mandatory
60-
def as_bytes(self, channel=None):
60+
def as_bytes(self, *, channel=None):
6161
return bytearray([self._STATUS | (channel & self.CHANNELMASK),
6262
self.pitch_bend & 0x7f,
6363
(self.pitch_bend >> 7) & 0x7f])

adafruit_midi/polyphonic_key_pressure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def __init__(self, note, pressure):
5959
raise self._EX_VALUEERROR_OOR
6060

6161
# channel value is mandatory
62-
def as_bytes(self, channel=None):
62+
def as_bytes(self, *, channel=None):
6363
return bytearray([self._STATUS | (channel & self.CHANNELMASK),
6464
self.note, self.pressure])
6565

adafruit_midi/program_change.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def __init__(self, patch):
5656
raise self._EX_VALUEERROR_OOR
5757

5858
# channel value is mandatory
59-
def as_bytes(self, channel=None):
59+
def as_bytes(self, *, channel=None):
6060
return bytearray([self._STATUS | (channel & self.CHANNELMASK),
6161
self.patch])
6262

adafruit_midi/system_exclusive.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def __init__(self, manufacturer_id, data):
5959
self.data = bytearray(data)
6060

6161
# channel value present to keep interface uniform but unused
62-
def as_bytes(self, channel=None):
62+
def as_bytes(self, *, channel=None):
6363
return (bytearray([self._STATUS])
6464
+ self.manufacturer_id
6565
+ self.data

0 commit comments

Comments
 (0)