Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Feb 13, 2024
1 parent bd21687 commit c98a595
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 46 deletions.
88 changes: 47 additions & 41 deletions scripts/kconfiglib.py
Expand Up @@ -2095,9 +2095,11 @@ def status(flag):
(
"configuration with {} symbols".format(len(self.syms)),
'main menu prompt "{}"'.format(self.mainmenu_text),
"srctree is current directory"
if not self.srctree
else 'srctree "{}"'.format(self.srctree),
(
"srctree is current directory"
if not self.srctree
else 'srctree "{}"'.format(self.srctree)
),
'config symbol prefix "{}"'.format(self.config_prefix),
"warnings " + status(self.warn),
"printing of warnings to stderr " + status(self.warn_to_stderr),
Expand Down Expand Up @@ -3003,9 +3005,11 @@ def _parse_block(self, end_token, parent, prev):
self.linenr,
pattern,
self._line.strip(),
"set to '{}'".format(self.srctree)
if self.srctree
else "unset or blank",
(
"set to '{}'".format(self.srctree)
if self.srctree
else "unset or blank"
),
)
)

Expand Down Expand Up @@ -3116,23 +3120,27 @@ def _parse_block(self, end_token, parent, prev):
self._parse_error(
"no corresponding 'choice'"
if t0 is _T_ENDCHOICE
else "no corresponding 'if'"
if t0 is _T_ENDIF
else "no corresponding 'menu'"
if t0 is _T_ENDMENU
else "unrecognized construct"
else (
"no corresponding 'if'"
if t0 is _T_ENDIF
else (
"no corresponding 'menu'"
if t0 is _T_ENDMENU
else "unrecognized construct"
)
)
)

# End of file reached. Return the last node.

if end_token:
raise KconfigError(
"error: expected '{}' at end of '{}'".format(
"endchoice"
if end_token is _T_ENDCHOICE
else "endif"
if end_token is _T_ENDIF
else "endmenu",
(
"endchoice"
if end_token is _T_ENDCHOICE
else "endif" if end_token is _T_ENDIF else "endmenu"
),
self.filename,
)
)
Expand Down Expand Up @@ -4891,13 +4899,9 @@ def __init__(self):
self.implies = []
self.ranges = []

self.user_value = (
self.choice
) = (
self.env_var
) = (
self._cached_str_val
) = self._cached_tri_val = self._cached_vis = self._cached_assignable = None
self.user_value = self.choice = self.env_var = self._cached_str_val = (
self._cached_tri_val
) = self._cached_vis = self._cached_assignable = None

# _write_to_conf is calculated along with the value. If True, the
# Symbol gets a .config entry.
Expand Down Expand Up @@ -4956,9 +4960,9 @@ def _assignable(self):
def _invalidate(self):
# Marks the symbol as needing to be recalculated

self._cached_str_val = (
self._cached_tri_val
) = self._cached_vis = self._cached_assignable = None
self._cached_str_val = self._cached_tri_val = self._cached_vis = self._cached_assignable = (
None
)

def _rec_invalidate(self):
# Invalidates the symbol and all items that (possibly) depend on it
Expand Down Expand Up @@ -5493,9 +5497,9 @@ def __init__(self):
self.syms = []
self.defaults = []

self.name = (
self.user_value
) = self.user_selection = self._cached_vis = self._cached_assignable = None
self.name = self.user_value = self.user_selection = self._cached_vis = (
self._cached_assignable
) = None

self._cached_selection = _NO_CACHED_SELECTION

Expand Down Expand Up @@ -6136,15 +6140,15 @@ def expr_value(expr):
return 2 * (
comp == 0
if rel is EQUAL
else comp != 0
if rel is UNEQUAL
else comp < 0
if rel is LESS
else comp <= 0
if rel is LESS_EQUAL
else comp > 0
if rel is GREATER
else comp >= 0
else (
comp != 0
if rel is UNEQUAL
else (
comp < 0
if rel is LESS
else comp <= 0 if rel is LESS_EQUAL else comp > 0 if rel is GREATER else comp >= 0
)
)
)


Expand Down Expand Up @@ -6841,9 +6845,11 @@ def _decoding_error(e, filename, macro_linenr=None):
"Problematic data: {}\n"
"Reason: {}".format(
e.encoding,
"'{}'".format(filename)
if macro_linenr is None
else "output from macro at {}:{}".format(filename, macro_linenr),
(
"'{}'".format(filename)
if macro_linenr is None
else "output from macro at {}:{}".format(filename, macro_linenr)
),
e.object[max(e.start - 40, 0) : e.end + 40],
e.object[e.start : e.end],
e.reason,
Expand Down
10 changes: 5 additions & 5 deletions scripts/menuconfig.py
Expand Up @@ -2573,11 +2573,11 @@ def _draw_info_dialog(node, lines, scroll, top_line_win, text_win, bot_sep_win,
title = (
"Symbol"
if isinstance(node.item, Symbol)
else "Choice"
if isinstance(node.item, Choice)
else "Menu"
if node.item == MENU
else "Comment"
else (
"Choice"
if isinstance(node.item, Choice)
else "Menu" if node.item == MENU else "Comment"
)
) + " information"
_safe_addstr(top_line_win, 0, max((text_win_width - len(title)) // 2, 0), title)

Expand Down
1 change: 1 addition & 0 deletions tools/punchboot/punchboot/__main__.py
@@ -1,4 +1,5 @@
"""Punchboot CLI."""

import click
import logging
import sys
Expand Down

0 comments on commit c98a595

Please sign in to comment.