[code-quality] Apply ruff linting suggestions to core (#7207)

This commit is contained in:
tomaszduda23 2024-08-07 09:33:41 +02:00 committed by GitHub
parent 2a8424a7f2
commit 4b91ef5123
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -336,7 +336,7 @@ class ID:
else: else:
self.is_manual = is_manual self.is_manual = is_manual
self.is_declaration = is_declaration self.is_declaration = is_declaration
self.type: Optional["MockObjClass"] = type self.type: Optional[MockObjClass] = type
def resolve(self, registered_ids): def resolve(self, registered_ids):
from esphome.config_validation import RESERVED_IDS from esphome.config_validation import RESERVED_IDS
@ -500,7 +500,7 @@ class EsphomeCore:
# The relative path to where all build files are stored # The relative path to where all build files are stored
self.build_path: Optional[str] = None self.build_path: Optional[str] = None
# The validated configuration, this is None until the config has been validated # The validated configuration, this is None until the config has been validated
self.config: Optional["ConfigType"] = None self.config: Optional[ConfigType] = None
# The pending tasks in the task queue (mostly for C++ generation) # The pending tasks in the task queue (mostly for C++ generation)
# This is a priority queue (with heapq) # This is a priority queue (with heapq)
# Each item is a tuple of form: (-priority, unique number, task) # Each item is a tuple of form: (-priority, unique number, task)
@ -508,17 +508,17 @@ class EsphomeCore:
# Task counter for pending tasks # Task counter for pending tasks
self.task_counter = 0 self.task_counter = 0
# The variable cache, for each ID this holds a MockObj of the variable obj # The variable cache, for each ID this holds a MockObj of the variable obj
self.variables: dict[str, "MockObj"] = {} self.variables: dict[str, MockObj] = {}
# A list of statements that go in the main setup() block # A list of statements that go in the main setup() block
self.main_statements: list["Statement"] = [] self.main_statements: list[Statement] = []
# A list of statements to insert in the global block (includes and global variables) # A list of statements to insert in the global block (includes and global variables)
self.global_statements: list["Statement"] = [] self.global_statements: list[Statement] = []
# A set of platformio libraries to add to the project # A set of platformio libraries to add to the project
self.libraries: list[Library] = [] self.libraries: list[Library] = []
# A set of build flags to set in the platformio project # A set of build flags to set in the platformio project
self.build_flags: set[str] = set() self.build_flags: set[str] = set()
# A set of defines to set for the compile process in esphome/core/defines.h # A set of defines to set for the compile process in esphome/core/defines.h
self.defines: set["Define"] = set() self.defines: set[Define] = set()
# A map of all platformio options to apply # A map of all platformio options to apply
self.platformio_options: dict[str, Union[str, list[str]]] = {} self.platformio_options: dict[str, Union[str, list[str]]] = {}
# A set of strings of names of loaded integrations, used to find namespace ID conflicts # A set of strings of names of loaded integrations, used to find namespace ID conflicts