Skip to content

Commit c1740cb

Browse files
author
Kevin J Walters
committed
More pylint happiness and minor reST formatting corrections. #3
1 parent 1811478 commit c1740cb

8 files changed

Lines changed: 32 additions & 26 deletions

File tree

adafruit_midi/channel_pressure.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ def __init__(self, pressure):
6868
def as_bytes(self, channel=None):
6969
return bytearray([self._STATUS | (channel & self.CHANNELMASK),
7070
self.pressure])
71-
71+
7272
@classmethod
7373
def from_bytes(cls, databytes):
74-
return cls(databytes[0])
74+
return cls(databytes[0])
7575

7676
ChannelPressure.register_message_type()

adafruit_midi/control_change.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class ControlChange(MIDIMessage):
6060
_STATUSMASK = 0xf0
6161
LENGTH = 3
6262
CHANNELMASK = 0x0f
63-
63+
6464
def __init__(self, control, value):
6565
self.control = control
6666
self.value = value
@@ -74,6 +74,6 @@ def as_bytes(self, channel=None):
7474

7575
@classmethod
7676
def from_bytes(cls, databytes):
77-
return cls(databytes[0], databytes[1])
78-
77+
return cls(databytes[0], databytes[1])
78+
7979
ControlChange.register_message_type()

adafruit_midi/note_off.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
class NoteOff(MIDIMessage):
5252
"""Note Off Change MIDI message.
5353
54-
:param note: The note (key) number either as an int (0-127) or a str which is parsed, e.g. "C4" (middle C) is 60, "A4" is 69.
54+
:param note: The note (key) number either as an ``int`` (0-127) or a
55+
``str`` which is parsed, e.g. "C4" (middle C) is 60, "A4" is 69.
5556
:param int velocity: The release velocity, 0-127.
5657
5758
"""
@@ -60,7 +61,7 @@ class NoteOff(MIDIMessage):
6061
_STATUSMASK = 0xf0
6162
LENGTH = 3
6263
CHANNELMASK = 0x0f
63-
64+
6465
def __init__(self, note, velocity):
6566
self.note = note_parser(note)
6667
self.velocity = velocity
@@ -70,10 +71,10 @@ def __init__(self, note, velocity):
7071
# channel value is mandatory
7172
def as_bytes(self, channel=None):
7273
return bytearray([self._STATUS | (channel & self.CHANNELMASK),
73-
self.note, self.velocity])
74+
self.note, self.velocity])
7475

7576
@classmethod
7677
def from_bytes(cls, databytes):
77-
return cls(databytes[0], databytes[1])
78+
return cls(databytes[0], databytes[1])
7879

7980
NoteOff.register_message_type()

adafruit_midi/note_on.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,10 @@
5151
class NoteOn(MIDIMessage):
5252
"""Note On Change MIDI message.
5353
54-
:param note: The note (key) number either as an int (0-127) or a str which is parsed, e.g. "C4" (middle C) is 60, "A4" is 69.
55-
:param int velocity: The strike velocity, 0-127, 0 is equivalent to a Note Off.
54+
:param note: The note (key) number either as an ``int`` (0-127) or a
55+
``str`` which is parsed, e.g. "C4" (middle C) is 60, "A4" is 69.
56+
:param int velocity: The strike velocity, 0-127, 0 is equivalent
57+
to a Note Off.
5658
"""
5759

5860
_STATUS = 0x90
@@ -65,14 +67,14 @@ def __init__(self, note, velocity):
6567
self.velocity = velocity
6668
if not 0 <= self.note <= 127 or not 0 <= self.velocity <= 127:
6769
raise ValueError("Out of range")
68-
70+
6971
# channel value is mandatory
7072
def as_bytes(self, channel=None):
7173
return bytearray([self._STATUS | (channel & self.CHANNELMASK),
72-
self.note, self.velocity])
74+
self.note, self.velocity])
7375

7476
@classmethod
7577
def from_bytes(cls, databytes):
76-
return cls(databytes[0], databytes[1])
78+
return cls(databytes[0], databytes[1])
7779

7880
NoteOn.register_message_type()

adafruit_midi/pitch_bend_change.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,15 @@
5151
class PitchBendChange(MIDIMessage):
5252
"""Pitch Bend Change MIDI message.
5353
54-
:param int pitch_bend: A 14bit unsigned int representing the degree of bend from 0 through 8192 (midpoint, no bend) to 16383.
54+
:param int pitch_bend: A 14bit unsigned int representing the degree of
55+
bend from 0 through 8192 (midpoint, no bend) to 16383.
5556
"""
5657

5758
_STATUS = 0xe0
5859
_STATUSMASK = 0xf0
5960
LENGTH = 3
6061
CHANNELMASK = 0x0f
61-
62+
6263
def __init__(self, pitch_bend):
6364
self.pitch_bend = pitch_bend
6465
if not 0 <= self.pitch_bend <= 16383:
@@ -69,9 +70,9 @@ def as_bytes(self, channel=None):
6970
return bytearray([self._STATUS | (channel & self.CHANNELMASK),
7071
self.pitch_bend & 0x7f,
7172
(self.pitch_bend >> 7) & 0x7f])
72-
73+
7374
@classmethod
7475
def from_bytes(cls, databytes):
75-
return cls(databytes[1] << 7 | databytes[0])
76+
return cls(databytes[1] << 7 | databytes[0])
7677

7778
PitchBendChange.register_message_type()

adafruit_midi/polyphonic_key_pressure.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,16 @@
5151
class PolyphonicKeyPressure(MIDIMessage):
5252
"""Polyphonic Key Pressure MIDI message.
5353
54-
:param note: The note (key) number either as an int (0-127) or a str which is parsed, e.g. "C4" (middle C) is 60, "A4" is 69.
54+
:param note: The note (key) number either as an ``int`` (0-127) or a
55+
``str`` which is parsed, e.g. "C4" (middle C) is 60, "A4" is 69.
5556
:param int pressure: The pressure, 0-127.
5657
"""
5758

5859
_STATUS = 0xa0
5960
_STATUSMASK = 0xf0
6061
LENGTH = 3
6162
CHANNELMASK = 0x0f
62-
63+
6364
def __init__(self, note, pressure):
6465
self.note = note_parser(note)
6566
self.pressure = pressure
@@ -73,6 +74,6 @@ def as_bytes(self, channel=None):
7374

7475
@classmethod
7576
def from_bytes(cls, databytes):
76-
return cls(databytes[0], databytes[1])
77+
return cls(databytes[0], databytes[1])
7778

7879
PolyphonicKeyPressure.register_message_type()

adafruit_midi/program_change.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class ProgramChange(MIDIMessage):
5858
_STATUSMASK = 0xf0
5959
LENGTH = 2
6060
CHANNELMASK = 0x0f
61-
61+
6262
def __init__(self, patch):
6363
self.patch = patch
6464
if not 0 <= self.patch <= 127:
@@ -68,9 +68,9 @@ def __init__(self, patch):
6868
def as_bytes(self, channel=None):
6969
return bytearray([self._STATUS | (channel & self.CHANNELMASK),
7070
self.patch])
71-
71+
7272
@classmethod
7373
def from_bytes(cls, databytes):
74-
return cls(databytes[0])
74+
return cls(databytes[0])
7575

7676
ProgramChange.register_message_type()

adafruit_midi/system_exclusive.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
class SystemExclusive(MIDIMessage):
5252
"""System Exclusive MIDI message.
5353
54-
:param list manufacturer_id: The single byte or three byte manufacturer's id as a list or bytearray of numbers between 0-127.
54+
:param list manufacturer_id: The single byte or three byte
55+
manufacturer's id as a list or bytearray of numbers between 0-127.
5556
:param list data: The 7bit data as a list or bytearray of numbers between 0-127.
5657
"""
5758

@@ -74,7 +75,7 @@ def as_bytes(self, channel=None):
7475
@classmethod
7576
def from_bytes(cls, databytes):
7677
# -1 on second arg is to avoid the ENDSTATUS which is passed
77-
if databytes[0] != 0:
78+
if databytes[0] != 0: # pylint: disable=no-else-return
7879
return cls(databytes[0:1], databytes[1:-1])
7980
else:
8081
return cls(databytes[0:3], databytes[3:-1])

0 commit comments

Comments
 (0)