Skip to content

Commit

Permalink
Deal with dotty_dict.
Browse files Browse the repository at this point in the history
  • Loading branch information
tzarc committed Nov 1, 2023
1 parent 329d0ff commit 34df028
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions lib/python/qmk/build_targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__(self, keyboard: str, keymap: str, json: Union[dict, Dotty] = None):
self._target = f'{self._keyboard_safe}_{self.keymap}'
self._intermediate_output = Path(f'{INTERMEDIATE_OUTPUT_PREFIX}{self._target}')
self._generated_files_path = self._intermediate_output / 'src'
self._json = json if isinstance(json, Dotty) else dotty(json)
self._json = json.to_dict() if isinstance(json, Dotty) else json

def __str__(self):
return f'{self.keyboard}:{self.keymap}'
Expand Down Expand Up @@ -52,9 +52,13 @@ def json(self) -> dict:
if not self._json:
self._load_json()
if not self._json:
return dotty({})
return {}
return self._json

@property
def dotty(self) -> Dotty:
return dotty(self.json)

def _common_make_args(self, dry_run: bool = False, build_target: str = None):
compile_args = [
find_make(),
Expand Down Expand Up @@ -131,7 +135,7 @@ def __repr__(self):
return f'KeyboardKeymapTarget(keyboard={self.keyboard}, keymap={self.keymap})'

def _load_json(self):
self._json = dotty(keymap_json(self.keyboard, self.keymap))
self._json = keymap_json(self.keyboard, self.keymap)

def prepare_build(self, build_target: str = None, dry_run: bool = False, **env_vars) -> None:
pass
Expand Down
2 changes: 1 addition & 1 deletion lib/python/qmk/cli/find.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ def find(cli):
print(f'{target}')

for key in cli.args.print:
print(f' {key}={target.json.get(key, None)}')
print(f' {key}={target.dotty.get(key, None)}')

0 comments on commit 34df028

Please sign in to comment.