fix(lint): lint all the things; be more flexible in boards dir

This commit is contained in:
Josh Klar 2021-06-20 13:59:59 -07:00
parent 7400f43cf8
commit f79e508566
No known key found for this signature in database
GPG Key ID: A4A0C7B4E8EEE222
6 changed files with 291 additions and 57 deletions

View File

@ -1,9 +1,10 @@
import usb_hid
from micropython import const
from kmk.keys import FIRST_KMK_INTERNAL_KEY, ConsumerKey, ModifierKey
from storage import getmount
from kmk.keys import FIRST_KMK_INTERNAL_KEY, ConsumerKey, ModifierKey
try:
from adafruit_ble import BLERadio
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
@ -259,7 +260,7 @@ class BLEHID(AbstractHID):
@property
def devices(self):
'''Search through the provided list of devices to find the ones with the
send_report attribute.'''
send_report attribute.'''
if not self.ble.connected:
return []

View File

@ -22,7 +22,7 @@ class KeyAttrDict(AttrDict):
def __getattr__(self, key):
try:
return super(KeyAttrDict, self).__getattr__(key)
except:
except Exception:
pass
# Modifiers
if key in ('LEFT_CONTROL', 'LCTRL', 'LCTL'):
@ -514,7 +514,7 @@ class KeyAttrDict(AttrDict):
elif key in ('HID_SWITCH', 'HID'):
make_key(names=('HID_SWITCH', 'HID'), on_press=handlers.hid_switch)
else:
raise ValueError("Invalid key")
raise ValueError('Invalid key')
return self.__getattr__(key)

View File

@ -43,7 +43,7 @@ class ModTap(Module):
return keyboard
def mt_released(self, key, keyboard, *args, **kwargs):
''' On keyup, check timer, and press key if needed.'''
'''On keyup, check timer, and press key if needed.'''
keyboard.keys_pressed.discard(key.meta.mods)
if self._mod_tap_timer and (
accurate_ticks_diff(

View File

@ -2,11 +2,11 @@
import busio
from micropython import const
from kmk.hid import HIDModes
from storage import getmount
from kmk.kmktime import ticks_diff, ticks_ms
from kmk.matrix import intify_coordinate
from kmk.modules import Module
from storage import getmount
class SplitSide:
@ -141,8 +141,10 @@ class Split(Module):
def after_matrix_scan(self, keyboard):
if keyboard.matrix_update:
if self.split_type == SplitType.UART and self._is_target:
pass # explicit pass just for dev sanity...
elif self.split_type == SplitType.UART and (self.data_pin2 or not self._is_target):
pass # explicit pass just for dev sanity...
elif self.split_type == SplitType.UART and (
self.data_pin2 or not self._is_target
):
self._send_uart(keyboard.matrix_update)
elif self.split_type == SplitType.BLE:
self._send_ble(keyboard.matrix_update)

View File

@ -22,7 +22,7 @@ per-file-ignores =
# multiple spaces after commas in lists (for grid alignment), and put
# your imports in whatever order you want
user_keymaps/**/*.py: E131,F401,E501,E241,E131,BLK100,I003
boards/**/main.py: E131,F401,E501,E241,E131,BLK100
boards/**/main.py: E131,F401,E501,E241,E131,BLK100,I003
tests/test_data/keymaps/**/*.py: F401,E501
[isort]

View File

@ -1,11 +1,12 @@
# OLED
import board
#import adafruit_displayio_ssd1306
#import displayio
#import terminalio
#from adafruit_display_text import label
# import adafruit_displayio_ssd1306
# import displayio
# import terminalio
# from adafruit_display_text import label
from kb import KMKKeyboard
from kmk.extensions.rgb import RGB
from kmk.hid import HIDModes
from kmk.keys import KC
@ -19,7 +20,14 @@ keyboard = KMKKeyboard()
keyboard.tap_time = 320
keyboard.debug_enabled = False
rgb_ext = RGB(pixel_pin=keyboard.rgb_pixel_pin, num_pixels=6, val_limit=100, hue_default=190, sat_default=100, val_default=5)
rgb_ext = RGB(
pixel_pin=keyboard.rgb_pixel_pin,
num_pixels=6,
val_limit=100,
hue_default=190,
sat_default=100,
val_default=5,
)
split = Split(split_type=SplitType.BLE)
power = Power(powersave_pin=keyboard.powersave_pin)
@ -66,12 +74,49 @@ keyboard.keymap = [
#
[
# DVORAK
KC.GESC, KC.QUOT, KC.COMM, KC.DOT, KC.P, KC.Y, KC.F, KC.G, KC.C, KC.R, KC.L, KC.BSPC, \
TAB_SB, KC.A, KC.O, KC.E, KC.U, KC.I, KC.D, KC.H, KC.T, KC.N, KC.S, KC.ENT, \
KC.LSFT, KC.SCLN, KC.Q, KC.J, KC.K, KC.X, KC.B, KC.M, KC.W, KC.V, KC.Z, KC.SLSH, \
KC.LALT, SUPER_L, LT1_SP, LT2_SP, KC.LCTL, KC.N0
KC.GESC,
KC.QUOT,
KC.COMM,
KC.DOT,
KC.P,
KC.Y,
KC.F,
KC.G,
KC.C,
KC.R,
KC.L,
KC.BSPC,
TAB_SB,
KC.A,
KC.O,
KC.E,
KC.U,
KC.I,
KC.D,
KC.H,
KC.T,
KC.N,
KC.S,
KC.ENT,
KC.LSFT,
KC.SCLN,
KC.Q,
KC.J,
KC.K,
KC.X,
KC.B,
KC.M,
KC.W,
KC.V,
KC.Z,
KC.SLSH,
KC.LALT,
SUPER_L,
LT1_SP,
LT2_SP,
KC.LCTL,
KC.N0,
],
# GAMING
# ,-----------------------------------------. ,-----------------------------------------.
# | Tab | ' | , | . | P | Y | | F | G | C | R | L | BKSP |
@ -86,10 +131,48 @@ keyboard.keymap = [
#
[
# GAMING
KC.ESC, KC.QUOT, KC.COMM, KC.DOT, KC.P, KC.Y, KC.F, KC.G, KC.C, KC.R, KC.L, KC.BSPC, \
KC.LCTL, KC.A, KC.O, KC.E, KC.U, KC.I, KC.D, KC.H, KC.T, KC.N, KC.S, KC.ENT, \
KC.LSFT, KC.SCLN, KC.Q, KC.J, KC.K, KC.X, KC.B, KC.M, KC.W, KC.V, KC.Z, KC.SLSH, \
KC.LALT, KC.SPC, KC.SPC, LT2_SP, KC.LCTL, KC.UP,
KC.ESC,
KC.QUOT,
KC.COMM,
KC.DOT,
KC.P,
KC.Y,
KC.F,
KC.G,
KC.C,
KC.R,
KC.L,
KC.BSPC,
KC.LCTL,
KC.A,
KC.O,
KC.E,
KC.U,
KC.I,
KC.D,
KC.H,
KC.T,
KC.N,
KC.S,
KC.ENT,
KC.LSFT,
KC.SCLN,
KC.Q,
KC.J,
KC.K,
KC.X,
KC.B,
KC.M,
KC.W,
KC.V,
KC.Z,
KC.SLSH,
KC.LALT,
KC.SPC,
KC.SPC,
LT2_SP,
KC.LCTL,
KC.UP,
],
# RAISE1
# ,-----------------------------------------. ,-----------------------------------------.
@ -105,10 +188,48 @@ keyboard.keymap = [
#
[
# RAISE1
_______, _______, _______, _______, _______, _______, KC.PS_TOG, XXXXXXX, KC.N7, KC.N8, KC.N9, KC.DEL, \
_______, _______, _______, _______, _______, _______, XXXXXXX, XXXXXXX, KC.N4, KC.N5, KC.N6, KC.BSLS, \
_______, _______, _______, _______, _______, _______, XXXXXXX, XXXXXXX, KC.N1, KC.N2, KC.N3, KC.MINS, \
_______, _______, _______, _______, KC.EQL, KC.N0,
_______,
_______,
_______,
_______,
_______,
_______,
KC.PS_TOG,
XXXXXXX,
KC.N7,
KC.N8,
KC.N9,
KC.DEL,
_______,
_______,
_______,
_______,
_______,
_______,
XXXXXXX,
XXXXXXX,
KC.N4,
KC.N5,
KC.N6,
KC.BSLS,
_______,
_______,
_______,
_______,
_______,
_______,
XXXXXXX,
XXXXXXX,
KC.N1,
KC.N2,
KC.N3,
KC.MINS,
_______,
_______,
_______,
_______,
KC.EQL,
KC.N0,
],
# RAISE2
# ,-----------------------------------------. ,-----------------------------------------.
@ -122,13 +243,50 @@ keyboard.keymap = [
# | | |/ / \ \ | | |
# `---------------------' '------''-------------'
#
[
# RAISE2
_______, KC.F9, KC.F10, KC.F11, KC.F12, _______, _______, _______, _______, KC.LBRC, KC.RBRC, KC.LSHIFT(KC.INS), \
_______, KC.F5, KC.F6, KC.F7, KC.F8, _______, KC.HOME, KC.LEFT, KC.DOWN, KC.UP, KC.RGHT, KC.END, \
_______, KC.F1, KC.F2, KC.F3, KC.F4, _______, _______, _______, _______, _______, _______, KC.BSLS, \
_______, _______, _______, _______, KC.DF(0), KC.DF(1),
_______,
KC.F9,
KC.F10,
KC.F11,
KC.F12,
_______,
_______,
_______,
_______,
KC.LBRC,
KC.RBRC,
KC.LSHIFT(KC.INS),
_______,
KC.F5,
KC.F6,
KC.F7,
KC.F8,
_______,
KC.HOME,
KC.LEFT,
KC.DOWN,
KC.UP,
KC.RGHT,
KC.END,
_______,
KC.F1,
KC.F2,
KC.F3,
KC.F4,
_______,
_______,
_______,
_______,
_______,
_______,
KC.BSLS,
_______,
_______,
_______,
_______,
KC.DF(0),
KC.DF(1),
],
# GUI
# ,-----------------------------------------. ,-----------------------------------------.
@ -141,35 +299,108 @@ keyboard.keymap = [
# | LALT | LGUI | /LT1_SP / \LT2_SP\ | | |
# | | |/ / \ \ | | |
# `---------------------' '------''-------------'
[
# GUI
_______, KC.N1, KC.N2, KC.N3, KC.N4, KC.N5, _______, _______, _______, _______, _______, _______, \
_______, KC.N6, KC.N7, KC.N8, KC.N9, KC.N0, _______, _______, _______, _______, _______, _______, \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
_______, _______, _______, _______, _______, _______ \
_______,
KC.N1,
KC.N2,
KC.N3,
KC.N4,
KC.N5,
_______,
_______,
_______,
_______,
_______,
_______,
_______,
KC.N6,
KC.N7,
KC.N8,
KC.N9,
KC.N0,
_______,
_______,
_______,
_______,
_______,
_______,
_______,
_______,
_______,
_______,
_______,
_______,
_______,
_______,
_______,
_______,
_______,
_______,
_______,
_______,
_______,
_______,
_______,
_______,
],
# SYMBOLS
# ,-----------------------------------------. ,-----------------------------------------.
# | | ! | @ | # | $ | % | | ^ | & | * | ( | ) | Del |
# |------+------+------+------+------+------| |------+------+------+------+------+------|
# | | | | | | | | | | | [ | ] | |
# |------+------+------+------+------+------| |------+------+------+------+------+------|
# | | | | | | |-------. ,-------| | | | | | |
# `-----------------------------------------/ / \ \-----------------------------------------'
# | LALT | LGUI | /LT1_SP / \LT2_SP\ | | |
# | | |/ / \ \ | | |
# `---------------------' '------''-------------'
#
# SYMBOLS
# ,-----------------------------------------. ,-----------------------------------------.
# | | ! | @ | # | $ | % | | ^ | & | * | ( | ) | Del |
# |------+------+------+------+------+------| |------+------+------+------+------+------|
# | | | | | | | | | | | [ | ] | |
# |------+------+------+------+------+------| |------+------+------+------+------+------|
# | | | | | | |-------. ,-------| | | | | | |
# `-----------------------------------------/ / \ \-----------------------------------------'
# | LALT | LGUI | /LT1_SP / \LT2_SP\ | | |
# | | |/ / \ \ | | |
# `---------------------' '------''-------------'
#
[
# SYMBOLS
_______, KC.EXLM, KC.AT, KC.HASH, KC.DLR, KC.PERC, KC.CIRC, KC.AMPR, KC.ASTR, KC.LPRN, KC.RPRN, KC.DEL, \
_______, KC.RGB_HUI, KC.RGB_HUD, KC.RGB_VAI, KC.RGB_VAD, _______, _______, _______, _______, KC.LBRC, KC.RBRC, _______, \
_______, KC.RGB_RST, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
KC.RGB_TOG, _______, _______, _______, _______, _______,
]
_______,
KC.EXLM,
KC.AT,
KC.HASH,
KC.DLR,
KC.PERC,
KC.CIRC,
KC.AMPR,
KC.ASTR,
KC.LPRN,
KC.RPRN,
KC.DEL,
_______,
KC.RGB_HUI,
KC.RGB_HUD,
KC.RGB_VAI,
KC.RGB_VAD,
_______,
_______,
_______,
_______,
KC.LBRC,
KC.RBRC,
_______,
_______,
KC.RGB_RST,
_______,
_______,
_______,
_______,
_______,
_______,
_______,
_______,
_______,
_______,
KC.RGB_TOG,
_______,
_______,
_______,
_______,
_______,
],
]
if __name__ == '__main__':