Remove unused `qmk.keymap.write_file`/`qmk.keymap.write_json` (#25854)

This commit is contained in:
Joel Challis 2025-12-04 23:31:52 +00:00 committed by GitHub
parent a71a34eb52
commit 511f1ed9de
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 0 additions and 38 deletions

View File

@ -1,6 +1,5 @@
"""Functions that help you work with QMK keymaps.
"""
import json
import sys
from pathlib import Path
from subprocess import DEVNULL
@ -320,40 +319,6 @@ def generate_c(keymap_json):
return new_keymap
def write_file(keymap_filename, keymap_content):
keymap_filename.parent.mkdir(parents=True, exist_ok=True)
keymap_filename.write_text(keymap_content)
cli.log.info('Wrote keymap to {fg_cyan}%s', keymap_filename)
return keymap_filename
def write_json(keyboard, keymap, layout, layers, macros=None):
"""Generate the `keymap.json` and write it to disk.
Returns the filename written to.
Args:
keyboard
The name of the keyboard
keymap
The name of the keymap
layout
The LAYOUT macro this keymap uses.
layers
An array of arrays describing the keymap. Each item in the inner array should be a string that is a valid QMK keycode.
"""
keymap_json = generate_json(keyboard, keymap, layout, layers, macros=None)
keymap_content = json.dumps(keymap_json)
keymap_file = qmk.path.keymaps(keyboard)[0] / keymap / 'keymap.json'
return write_file(keymap_file, keymap_content)
def locate_keymap(keyboard, keymap, force_layout=None):
"""Returns the path to a keymap for a specific keyboard.
"""

View File

@ -42,6 +42,3 @@ def test_generate_json_pytest_basic():
def test_parse_keymap_c():
parsed_keymap_c = qmk.keymap.parse_keymap_c('keyboards/handwired/pytest/basic/keymaps/default/keymap.c')
assert parsed_keymap_c == {'layers': [{'name': '0', 'layout': 'LAYOUT_ortho_1x1', 'keycodes': ['KC_A']}]}
# FIXME(skullydazed): Add a test for qmk.keymap.write that mocks up an FD.