style: edtlib: Sort the import statements

Sort the import statements to fix the
Ruff I001 warning.

Signed-off-by: James Roy <rruuaanng@outlook.com>
This commit is contained in:
James Roy 2025-02-17 12:13:13 +08:00 committed by Henrik Brix Andersen
parent f2eb205d6d
commit 8b142ded55
3 changed files with 12 additions and 14 deletions

View File

@ -437,14 +437,12 @@
]
"./scripts/dts/python-devicetree/src/devicetree/dtlib.py" = [
"E701", # https://docs.astral.sh/ruff/rules/multiple-statements-on-one-line-colon
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
"SIM201", # https://docs.astral.sh/ruff/rules/negate-equal-op
"UP007", # https://docs.astral.sh/ruff/rules/non-pep604-annotation
]
"./scripts/dts/python-devicetree/src/devicetree/edtlib.py" = [
"B904", # https://docs.astral.sh/ruff/rules/raise-without-from-inside-except
"E713", # https://docs.astral.sh/ruff/rules/not-in-test
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
"SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if
"SIM118", # https://docs.astral.sh/ruff/rules/in-dict-keys
"UP007", # https://docs.astral.sh/ruff/rules/non-pep604-annotation

View File

@ -20,9 +20,8 @@ import re
import string
import sys
import textwrap
from typing import (Any, Iterable,
NamedTuple, NoReturn, Optional,
TYPE_CHECKING, Union)
from collections.abc import Iterable
from typing import TYPE_CHECKING, Any, NamedTuple, NoReturn, Optional, Union
# NOTE: tests/test_dtlib.py is the test suite for this library.

View File

@ -67,31 +67,32 @@ bindings_from_paths() helper function.
# @properties are documented in the class docstring, as if they were
# variables. See the existing @properties for a template.
from collections import defaultdict
from copy import deepcopy
from dataclasses import dataclass
from typing import (Any, Callable, Iterable, NoReturn,
Optional, TYPE_CHECKING, Union)
import base64
import hashlib
from collections.abc import Callable, Iterable
import logging
import os
import re
from collections import defaultdict
from collections.abc import Callable, Iterable
from copy import deepcopy
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, NoReturn, Optional, Union
import yaml
try:
# Use the C LibYAML parser if available, rather than the Python parser.
# This makes e.g. gen_defines.py more than twice as fast.
from yaml import CLoader as Loader
except ImportError:
from yaml import Loader # type: ignore
from yaml import Loader # type: ignore
from devicetree.dtlib import DT, DTError, to_num, to_nums, Type
from devicetree._private import _slice_helper
from devicetree.dtlib import DT, DTError, Type, to_num, to_nums
from devicetree.dtlib import Node as dtlib_Node
from devicetree.dtlib import Property as dtlib_Property
from devicetree.grutils import Graph
from devicetree._private import _slice_helper
def _compute_hash(path: str) -> str:
# Calculates the hash associated with the node's full path.