Skip to content

Commit

Permalink
style: edtlib: Use a better type annotations
Browse files Browse the repository at this point in the history
Use built-in types for annotations instead
of types from the typing module.

Signed-off-by: James Roy <[email protected]>
  • Loading branch information
rruuaanng committed Jan 22, 2025
1 parent e2b1eff commit 4cc3f16
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
1 change: 0 additions & 1 deletion .ruff-excludes.toml
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,6 @@
]
"./scripts/dts/python-devicetree/src/devicetree/dtlib.py" = [
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
"UP007", # https://docs.astral.sh/ruff/rules/non-pep604-annotation
"UP035", # https://docs.astral.sh/ruff/rules/deprecated-import
"UP037", # https://docs.astral.sh/ruff/rules/quoted-annotation
]
Expand Down
7 changes: 3 additions & 4 deletions scripts/dts/python-devicetree/src/devicetree/dtlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@
import string
import sys
import textwrap
from typing import (Any, Iterable,
NamedTuple, NoReturn, Optional,
TYPE_CHECKING, Union)
from typing import (Any, Iterable, NamedTuple,
NoReturn, Optional, TYPE_CHECKING)

# NOTE: tests/test_dtlib.py is the test suite for this library.

Expand Down Expand Up @@ -674,7 +673,7 @@ class _FileStackElt(NamedTuple):
contents: str
pos: int

_TokVal = Union[int, str]
_TokVal = int | str

class _Token(NamedTuple):
id: int
Expand Down

0 comments on commit 4cc3f16

Please sign in to comment.