Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce alphabetical sorting in ruff isort #569

Merged
merged 4 commits into from
Feb 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion matter_server/common/helpers/json.py
Original file line number Diff line number Diff line change
@@ -3,9 +3,9 @@
from base64 import b64encode
from typing import Any

import orjson
from chip.clusters.Types import Nullable
from chip.tlv import float32, uint
import orjson

JSON_ENCODE_EXCEPTIONS = (TypeError, ValueError)
JSON_DECODE_EXCEPTIONS = (orjson.JSONDecodeError,)
2 changes: 1 addition & 1 deletion matter_server/server/__main__.py
Original file line number Diff line number Diff line change
@@ -5,8 +5,8 @@
import os
from pathlib import Path

import coloredlogs
from aiorun import run
import coloredlogs

from matter_server.server import stack

5 changes: 2 additions & 3 deletions matter_server/server/device_controller.py
Original file line number Diff line number Diff line change
@@ -5,15 +5,14 @@
from __future__ import annotations

import asyncio
import logging
from collections import deque
from datetime import datetime
from functools import partial
import logging
from typing import TYPE_CHECKING, Any, Awaitable, Callable, Iterable, TypeVar, cast

from chip.ChipDeviceCtrl import DeviceProxyWrapper
from chip.clusters import Attribute
from chip.clusters import Objects as Clusters
from chip.clusters import Attribute, Objects as Clusters
from chip.clusters.Attribute import ValueDecodeFailure
from chip.clusters.ClusterObjects import ALL_ATTRIBUTES, ALL_CLUSTERS, Cluster
from chip.exceptions import ChipStackError
2 changes: 1 addition & 1 deletion matter_server/server/server.py
Original file line number Diff line number Diff line change
@@ -5,8 +5,8 @@
import asyncio
import ipaddress
import logging
import weakref
from typing import Any, Callable, Set, cast
import weakref

from aiohttp import web

4 changes: 2 additions & 2 deletions matter_server/server/stack.py
Original file line number Diff line number Diff line change
@@ -4,9 +4,8 @@
import os
from typing import TYPE_CHECKING

import chip.logging
import chip.native
from chip.ChipStack import ChipStack
import chip.logging
from chip.logging import (
ERROR_CATEGORY_DETAIL,
ERROR_CATEGORY_ERROR,
@@ -15,6 +14,7 @@
)
from chip.logging.library_handle import _GetLoggingLibraryHandle
from chip.logging.types import LogRedirectCallback_t
import chip.native

if TYPE_CHECKING:
from chip.CertificateAuthority import CertificateAuthorityManager
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -168,7 +168,6 @@ ignore = [
"TD004", # Just annoying, not really useful
"COM812", # Conflict with the Ruff formatter
"ISC001", # Conflict with the Ruff formatter
"I001", # TEMPORARY DISABLED
"TCH003", # TEMPORARY DISABLED
"UP035", # TEMPORARY DISABLED
"TCH002", # TEMPORARY DISABLED
@@ -252,6 +251,8 @@ fixture-parentheses = false
mark-parentheses = false

[tool.ruff.lint.isort]
combine-as-imports = true
force-sort-within-sections = true
known-first-party = ["matter_server"]

[tool.ruff.lint.mccabe]
2 changes: 1 addition & 1 deletion tests/common/test_parser.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Test parser functions that converts the incoming json from API into dataclass models."""

import datetime
from dataclasses import dataclass
import datetime
from enum import Enum, IntEnum
from typing import Optional