[code-quality] Organise script imports (#7198)

This commit is contained in:
Jesse Hills 2024-08-07 15:46:37 +12:00 committed by GitHub
parent 1e63fddf36
commit 73f786c606
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 45 additions and 50 deletions

View File

@ -1,13 +1,13 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from pathlib import Path
import sys
import argparse import argparse
from collections import defaultdict from collections import defaultdict
from pathlib import Path
import sys
from esphome.helpers import write_file_if_changed
from esphome.config import get_component, get_platform from esphome.config import get_component, get_platform
from esphome.core import CORE
from esphome.const import KEY_CORE, KEY_TARGET_FRAMEWORK from esphome.const import KEY_CORE, KEY_TARGET_FRAMEWORK
from esphome.core import CORE
from esphome.helpers import write_file_if_changed
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument( parser.add_argument(

View File

@ -1,9 +1,10 @@
import argparse
import glob
import inspect import inspect
import json import json
import argparse
import os import os
import glob
import re import re
import voluptuous as vol import voluptuous as vol
# NOTE: Cannot import other esphome components globally as a modification in vol_schema # NOTE: Cannot import other esphome components globally as a modification in vol_schema
@ -94,13 +95,12 @@ load_components()
# Import esphome after loading components (so schema is tracked) # Import esphome after loading components (so schema is tracked)
# pylint: disable=wrong-import-position # pylint: disable=wrong-import-position
import esphome.core as esphome_core from esphome import automation, pins
import esphome.config_validation as cv
from esphome import automation
from esphome import pins
from esphome.components import remote_base from esphome.components import remote_base
from esphome.loader import get_platform, CORE_COMPONENTS_PATH import esphome.config_validation as cv
import esphome.core as esphome_core
from esphome.helpers import write_file_if_changed from esphome.helpers import write_file_if_changed
from esphome.loader import CORE_COMPONENTS_PATH, get_platform
from esphome.util import Registry from esphome.util import Registry
# pylint: enable=wrong-import-position # pylint: enable=wrong-import-position

View File

@ -1,8 +1,8 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import argparse import argparse
import re
from dataclasses import dataclass from dataclasses import dataclass
import re
import sys import sys

View File

@ -1,15 +1,6 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from helpers import (
print_error_for_file,
get_output,
git_ls_files,
filter_changed,
get_binary,
)
import argparse import argparse
import click
import colorama
import multiprocessing import multiprocessing
import os import os
import queue import queue
@ -18,6 +9,9 @@ import subprocess
import sys import sys
import threading import threading
import click
import colorama
from helpers import filter_changed, get_binary, git_ls_files, print_error_for_file
def run_format(executable, args, queue, lock, failed_files): def run_format(executable, args, queue, lock, failed_files):

View File

@ -1,21 +1,6 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from helpers import (
print_error_for_file,
get_output,
filter_grep,
build_all_include,
temp_header_file,
git_ls_files,
filter_changed,
load_idedata,
root_path,
basepath,
get_binary,
)
import argparse import argparse
import click
import colorama
import multiprocessing import multiprocessing
import os import os
import queue import queue
@ -26,6 +11,20 @@ import sys
import tempfile import tempfile
import threading import threading
import click
import colorama
from helpers import (
basepath,
build_all_include,
filter_changed,
filter_grep,
get_binary,
git_ls_files,
load_idedata,
print_error_for_file,
root_path,
temp_header_file,
)
def clang_options(idedata): def clang_options(idedata):

View File

@ -1,8 +1,8 @@
import json import json
import os.path import os.path
from pathlib import Path
import re import re
import subprocess import subprocess
from pathlib import Path
import colorama import colorama

View File

@ -1,19 +1,20 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from helpers import (
styled,
print_error_for_file,
get_output,
get_err,
git_ls_files,
filter_changed,
)
import argparse import argparse
import colorama
import os import os
import re import re
import sys import sys
import colorama
from helpers import (
filter_changed,
get_err,
get_output,
git_ls_files,
print_error_for_file,
styled,
)
curfile = None curfile = None

View File

@ -1,11 +1,10 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import argparse
from pathlib import Path from pathlib import Path
import sys import sys
import argparse
from helpers import git_ls_files, changed_files from helpers import changed_files, git_ls_files
from esphome.loader import get_component, get_platform
from esphome.core import CORE
from esphome.const import ( from esphome.const import (
KEY_CORE, KEY_CORE,
KEY_TARGET_FRAMEWORK, KEY_TARGET_FRAMEWORK,
@ -13,6 +12,8 @@ from esphome.const import (
PLATFORM_ESP32, PLATFORM_ESP32,
PLATFORM_ESP8266, PLATFORM_ESP8266,
) )
from esphome.core import CORE
from esphome.loader import get_component, get_platform
def filter_component_files(str): def filter_component_files(str):