Skip to content

Updates KMK's code style in line with Black's double quotes #571

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[flake8]
extend-ignore =
X100, E262,
# See https://github.com/PyCQA/pycodestyle/issues/373
E203,
# black
max-line-length = 88
# black
17 changes: 8 additions & 9 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@ name = "pypi"
[packages]

[dev-packages]
"flake8" = ">=3.9.0"
"flake8-commas" = "*"
"flake8-comprehensions" = "*"
"flake8-isort" = "*"
"python-magic" = "*"
black = "*"
isort = "*"
flake8 = "*"
flake8-black = "*"
flake8-isort = "*"
adafruit-ampy = "*"
ipdb = "*"
ipython = "*"
isort = "*"
neovim = "*"
s3cmd = "*"
black = "==21.6b0"
flake8-quotes = "*"
flake8-black = "*"

[requires]
python = "3.9"
510 changes: 244 additions & 266 deletions Pipfile.lock

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions boards/Pico87/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import board

from kb import KMKKeyboard

from kmk.extensions.lock_status import LockStatus
Expand All @@ -23,7 +22,9 @@ def set_lock_leds(self):
Pico87.leds.set_brightness(0, leds=[1])

def after_hid_send(self, sandbox):
super().after_hid_send(sandbox) # Critically important. Removing this will break lock status.
super().after_hid_send(
sandbox
) # Critically important. Removing this will break lock status.

if self.report_updated:
self.set_lock_leds()
Expand All @@ -36,8 +37,10 @@ def after_hid_send(self, sandbox):
MOLYR = KC.MO(1)

# Make this for better looking formatting...
______ = 'NO'
______ = "NO"

# flake8: noqa
# fmt: off
Pico87.keymap = [[
# Layer 0 QWERTY
'ESC', ______, 'F1', 'F2', 'F3', 'F4', ______, 'F5', 'F6', 'F7', 'F8', 'F9', 'F10', 'F11', 'F12', 'PSCR', 'SLCK', 'PAUS',
Expand All @@ -55,6 +58,7 @@ def after_hid_send(self, sandbox):
______, 'LSFT', 'Z', 'X', 'C', 'V', 'B', 'N', 'M', 'COMM', 'DOT', 'SLSH', ______, 'RSFT', ______, ______, 'UP', ______,
'LCTL', 'LGUI', ______, 'LALT', ______, ______, 'SPC', ______, ______, ______, 'RALT', 'RGUI', ______, MOLYR, 'RCTL', 'LEFT', 'DOWN', 'RGHT',
]]
# fmt: on

if __name__ == '__main__':
if __name__ == "__main__":
Pico87.go()
4 changes: 2 additions & 2 deletions boards/anavi/knob1/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
encoder_handler.map = (((KC.VOLD, KC.VOLU, KC.MUTE),),)
knob.modules.append(encoder_handler)

print('ANAVI Knob 1')
print("ANAVI Knob 1")

rgb_ext = RGB(
pixel_pin=board.NEOPIXEL,
Expand All @@ -32,5 +32,5 @@

knob.keymap = [[KC.MUTE]]

if __name__ == '__main__':
if __name__ == "__main__":
knob.go()
4 changes: 2 additions & 2 deletions boards/anavi/knobs3/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
)
knob.modules.append(encoder_handler)

print('ANAVI Knobs 3')
print("ANAVI Knobs 3")

rgb_ext = RGB(
pixel_pin=board.NEOPIXEL,
Expand All @@ -38,5 +38,5 @@

knob.keymap = [[KC.MUTE]]

if __name__ == '__main__':
if __name__ == "__main__":
knob.go()
4 changes: 2 additions & 2 deletions boards/anavi/macro-pad-10/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from kmk.modules.encoder import EncoderHandler
from kmk.scanners import DiodeOrientation

print('ANAVI Macro Pad 10')
print("ANAVI Macro Pad 10")

keyboard = KMKKeyboard()
led_ext = LED(
Expand Down Expand Up @@ -82,5 +82,5 @@
encoder_handler.map = (((KC.VOLD, KC.VOLU, KC.MUTE),),)
keyboard.modules.append(encoder_handler)

if __name__ == '__main__':
if __name__ == "__main__":
keyboard.go()
7 changes: 4 additions & 3 deletions boards/atreus62/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import board

from kb import KMKKeyboard

from kmk.handlers.sequences import send_string, simple_key_sequence
Expand Down Expand Up @@ -174,6 +173,8 @@


# make keymap
# flake8: noqa
# fmt: off
keyboard.keymap = [
[ # qwerty
KC.ESC, KC.N1, KC.N2, KC.N3, KC.N4, KC.N5, KC.N6, KC.N7, KC.N8, KC.N9, KC.N0, KC.MINS,
Expand All @@ -200,7 +201,7 @@
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC.TRNS, KC.TRNS, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
],
]

# fmt: on

# for use in the encoder extension
encoder_map = [
Expand All @@ -219,5 +220,5 @@
],
]

if __name__ == '__main__':
if __name__ == "__main__":
keyboard.go()
5 changes: 4 additions & 1 deletion boards/boardsource/3x4/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

RAISE = KC.MO(1)

# flake8: noqa
# fmt: off
keyboard.keymap = [
[ #Base
KC.N0, KC.N1, KC.N4, KC.N7,
Expand All @@ -26,6 +28,7 @@
_______, _______, _______, _______
]
]
# fmt: on

if __name__ == '__main__':
if __name__ == "__main__":
keyboard.go()
5 changes: 4 additions & 1 deletion boards/boardsource/4x12/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
LOWER = KC.MO(1)
RAISE = KC.MO(2)

# flake8: noqa
# fmt:off
keyboard.keymap = [
[ #QWERTY
KC.TAB, KC.Q, KC.W, KC.E, KC.R, KC.T, KC.Y, KC.U, KC.I, KC.O, KC.P, KC.BSPC,
Expand All @@ -39,6 +41,7 @@
_______, _______, _______, _______, _______, _______, _______, _______, KC.MNXT, KC.VOLD, KC.VOLU, KC.MPLY
]
]
# fmt: on

if __name__ == '__main__':
if __name__ == "__main__":
keyboard.go()
5 changes: 4 additions & 1 deletion boards/boardsource/5x12/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
LOWER = KC.MO(1)
RAISE = KC.MO(2)

# flake8: noqa
# fmt: off
keyboard.keymap = [
[ #QWERTY
KC.GRV, KC.N1, KC.N2, KC.N3, KC.N4, KC.N5, KC.N6, KC.N7, KC.N8, KC.N9, KC.N0, KC.BSPC,
Expand All @@ -42,6 +44,7 @@
_______, _______, _______, _______, _______, _______, _______, _______, KC.MNXT, KC.VOLD, KC.VOLU, KC.MPLY
]
]
# fmt: on

if __name__ == '__main__':
if __name__ == "__main__":
keyboard.go()
25 changes: 14 additions & 11 deletions boards/boardsource/Lulu/kb.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,21 @@ def __init__(self):
self.matrix = [
MatrixScanner(
# required arguments:
column_pins = self.col_pins,
row_pins = self.row_pins,
column_pins=self.col_pins,
row_pins=self.row_pins,
# optional arguments with defaults:
columns_to_anodes=DiodeOrientation.COL2ROW,
interval=0.02,
max_events=64
max_events=64,
),
RotaryioEncoder(
pin_a=board.GP08,
pin_b=board.GP09,
# optional
divisor=4,
)
),
]

col_pins = (
board.GP02,
board.GP03,
Expand All @@ -43,12 +44,13 @@ def __init__(self):
data_pin = board.RX
rgb_pixel_pin = board.GP29
i2c = board.I2C
SCL=board.SCL
SDA=board.SDA
encoder_a=board.GP08
encoder_b=board.GP09
# NOQA
SCL = board.SCL
SDA = board.SDA
encoder_a = board.GP08
encoder_b = board.GP09

# flake8: noqa
# fmt: off
led_key_pos =[11,10,9 ,8 ,7 ,6 , 41,42,43,44,45,46,
12,13,14,15,16,17, 52,51,50,49,48,47,
23,22,21,20,19,18, 53,54,55,56,57,58,
Expand All @@ -57,11 +59,12 @@ def __init__(self):
3 ,4 ,5 , 40,39,38,
2 ,1 ,0 , 35,36,37
]
# fmt: on
brightness_limit = 0.5
num_pixels = 70

# NOQA
# flake8: noqa
# fmt: off
coord_mapping = [
0, 1, 2, 3, 4, 5, 37, 36, 35, 34, 33, 32,
6, 7, 8, 9, 10, 11, 43, 42, 41, 40, 39, 38,
Expand All @@ -70,4 +73,4 @@ def __init__(self):
25,26, 27, 28, 60, 59, 58, 57,
30,31, 62,63
]

# fmt: on
15 changes: 9 additions & 6 deletions boards/boardsource/Lulu/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import supervisor

from kb import KMKKeyboard

from kmk.extensions.peg_oled_Display import (
Expand All @@ -24,18 +23,18 @@

oled_ext = Oled(
OledData(
corner_one={0: OledReactionType.STATIC, 1: ['qwertyzzzz']},
corner_one={0: OledReactionType.STATIC, 1: ["qwertyzzzz"]},
corner_two={
0: OledReactionType.LAYER,
1: ['1', '2', '3', '4', '5', '6', '7', '8'],
1: ["1", "2", "3", "4", "5", "6", "7", "8"],
},
corner_three={
0: OledReactionType.LAYER,
1: ['base', 'raise', 'lower', 'adjust', '5', '6', '7', '8'],
1: ["base", "raise", "lower", "adjust", "5", "6", "7", "8"],
},
corner_four={
0: OledReactionType.LAYER,
1: ['qwertyzzz', 'nums', 'shifted', 'leds', '5', '6', '7', '8'],
1: ["qwertyzzz", "nums", "shifted", "leds", "5", "6", "7", "8"],
},
),
toDisplay=OledDisplayMode.TXT,
Expand Down Expand Up @@ -129,6 +128,8 @@
split = Split(data_pin=keyboard.rx, data_pin2=keyboard.tx, uart_flip=False)
keyboard.modules.append(split)

# flake8: noqa
# fmt: off
keyboard.keymap = [
[
KC.ESC, KC.N1, KC.N2, KC.N3, KC.N4, KC.N5, KC.N6, KC.N7, KC.N8, KC.N9, KC.N0, KC.GRV,
Expand Down Expand Up @@ -226,5 +227,7 @@
KC.TRNS,
],
]
if __name__ == '__main__':
# fmt: on

if __name__ == "__main__":
keyboard.go(hid_type=HIDModes.USB)
2 changes: 2 additions & 0 deletions boards/boardsource/microdox/kb.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ class KMKKeyboard(_KMKKeyboard):

# NOQA
# flake8: noqa
# fmt: off
coord_mapping = [
0, 1, 2, 3, 4, 20, 21, 22, 23, 24,
5, 6, 7, 8, 9, 25, 26, 27, 28, 29,
10, 11, 12, 13, 14, 30, 31, 32, 33, 34,
17, 18, 19, 35, 36, 37,
]
# fmt: on
5 changes: 4 additions & 1 deletion boards/boardsource/microdox/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
RGB_VAI = KC.RGB_VAI
RGB_VAD = KC.RGB_VAD

# flake8: noqa
# fmt: off
keyboard.keymap = [
[ #QWERTY
KC.Q, KC.W, KC.E, KC.R, KC.T, KC.Y, KC.U, KC.I, KC.O, KC.P,\
Expand All @@ -50,6 +52,7 @@
XXXXXXX, XXXXXXX, XXXXXXX, KC.ENT, XXXXXXX, KC.DEL
]
]
# fmt: on

if __name__ == '__main__':
if __name__ == "__main__":
keyboard.go()
3 changes: 2 additions & 1 deletion boards/crkbd/kb.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ class KMKKeyboard(_KMKKeyboard):
powersave_pin = board.P0_13

# flake8: noqa
# fmt: off
coord_mapping = [
0, 1, 2, 3, 4, 5, 29, 28, 27, 26, 25, 24,
6, 7, 8, 9, 10, 11, 35, 34, 33, 32, 31, 30,
12, 13, 14, 15, 16, 17, 41, 40, 39, 38, 37, 36,
21, 22, 23, 47, 46, 45,
]

# fmt: on
2 changes: 2 additions & 0 deletions boards/crkbd/kb_rp2040.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ class KMKKeyboard(_KMKKeyboard):
i2c = board.I2C

# flake8: noqa
# fmt: off
coord_mapping = [
0, 1, 2, 3, 4, 5, 29, 28, 27, 26, 25, 24,
6, 7, 8, 9, 10, 11, 35, 34, 33, 32, 31, 30,
12, 13, 14, 15, 16, 17, 41, 40, 39, 38, 37, 36,
21, 22, 23, 47, 46, 45,
]
# fmt: on
Loading