mirror of
https://github.com/Keychron/qmk_firmware.git
synced 2024-12-29 04:39:26 +06:00
c61f016fa4
Hide development specific options and don't require dev modules unless `user.developer` is set to `True`.
18 lines
575 B
Python
Executable File
18 lines
575 B
Python
Executable File
"""Format python code according to QMK's style.
|
|
"""
|
|
from milc import cli
|
|
|
|
import subprocess
|
|
|
|
|
|
@cli.subcommand("Format python code according to QMK's style.", hidden=False if cli.config.user.developer else True)
|
|
def pyformat(cli):
|
|
"""Format python code according to QMK's style.
|
|
"""
|
|
try:
|
|
subprocess.run(['yapf', '-vv', '-ri', 'bin/qmk', 'lib/python'], check=True)
|
|
cli.log.info('Successfully formatted the python code in `bin/qmk` and `lib/python`.')
|
|
|
|
except subprocess.CalledProcessError:
|
|
cli.log.error('Error formatting python code!')
|