Skip to content

Commit 76ac152

Browse files
committed
chore: ruff format
Signed-off-by: Jos Verlinde <[email protected]>
1 parent da5cf97 commit 76ac152

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+2715
-1314
lines changed

src/stubber/board/createstubs.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,15 @@ def get_obj_attributes(self, item_instance: object):
144144
type_text = repr(type(val)).split("'")[1]
145145
except IndexError:
146146
type_text = ""
147-
if type_text in {"int", "float", "str", "bool", "tuple", "list", "dict"}:
147+
if type_text in {
148+
"int",
149+
"float",
150+
"str",
151+
"bool",
152+
"tuple",
153+
"list",
154+
"dict",
155+
}:
148156
order = 1
149157
elif type_text in {"function", "method"}:
150158
order = 2
@@ -263,7 +271,12 @@ def write_object_stub(self, fp, object_expr: object, obj_name: str, indent: str,
263271

264272
for item_name, item_repr, item_type_txt, item_instance, _ in items:
265273
# name_, repr_(value), type as text, item_instance, order
266-
if item_name in ["classmethod", "staticmethod", "BaseException", "Exception"]:
274+
if item_name in [
275+
"classmethod",
276+
"staticmethod",
277+
"BaseException",
278+
"Exception",
279+
]:
267280
# do not create stubs for these primitives
268281
continue
269282
if item_name[0].isdigit():
@@ -561,9 +574,7 @@ def _extract_hardware_info(info: OrderedDict[str, str]) -> None:
561574
info["mpy"] = (
562575
sys.implementation._mpy # type: ignore
563576
if "_mpy" in dir(sys.implementation)
564-
else sys.implementation.mpy
565-
if "mpy" in dir(sys.implementation)
566-
else "" # type: ignore
577+
else (sys.implementation.mpy if "mpy" in dir(sys.implementation) else "") # type: ignore
567578
)
568579
except (AttributeError, IndexError):
569580
pass

src/stubber/board/createstubs_db.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,15 @@ def get_obj_attributes(self, item_instance: object):
163163
type_text = repr(type(val)).split("'")[1]
164164
except IndexError:
165165
type_text = ""
166-
if type_text in {"int", "float", "str", "bool", "tuple", "list", "dict"}:
166+
if type_text in {
167+
"int",
168+
"float",
169+
"str",
170+
"bool",
171+
"tuple",
172+
"list",
173+
"dict",
174+
}:
167175
order = 1
168176
elif type_text in {"function", "method"}:
169177
order = 2
@@ -282,7 +290,12 @@ def write_object_stub(self, fp, object_expr: object, obj_name: str, indent: str,
282290

283291
for item_name, item_repr, item_type_txt, item_instance, _ in items:
284292
# name_, repr_(value), type as text, item_instance, order
285-
if item_name in ["classmethod", "staticmethod", "BaseException", "Exception"]:
293+
if item_name in [
294+
"classmethod",
295+
"staticmethod",
296+
"BaseException",
297+
"Exception",
298+
]:
286299
# do not create stubs for these primitives
287300
continue
288301
if item_name[0].isdigit():
@@ -580,9 +593,7 @@ def _extract_hardware_info(info: OrderedDict[str, str]) -> None:
580593
info["mpy"] = (
581594
sys.implementation._mpy # type: ignore
582595
if "_mpy" in dir(sys.implementation)
583-
else sys.implementation.mpy
584-
if "mpy" in dir(sys.implementation)
585-
else "" # type: ignore
596+
else (sys.implementation.mpy if "mpy" in dir(sys.implementation) else "") # type: ignore
586597
)
587598
except (AttributeError, IndexError):
588599
pass

0 commit comments

Comments
 (0)