[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
from pathlib import Path
import sys
import argparse
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.core import CORE
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.add_argument(

View file

@ -1,9 +1,10 @@
import argparse
import glob
import inspect
import json
import argparse
import os
import glob
import re
import voluptuous as vol
# 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)
# pylint: disable=wrong-import-position
import esphome.core as esphome_core
import esphome.config_validation as cv
from esphome import automation
from esphome import pins
from esphome import automation, pins
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.loader import CORE_COMPONENTS_PATH, get_platform
from esphome.util import Registry
# pylint: enable=wrong-import-position

View file

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

View file

@ -1,15 +1,6 @@
#!/usr/bin/env python3
from helpers import (
print_error_for_file,
get_output,
git_ls_files,
filter_changed,
get_binary,
)
import argparse
import click
import colorama
import multiprocessing
import os
import queue
@ -18,6 +9,9 @@ import subprocess
import sys
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):

View file

@ -1,21 +1,6 @@
#!/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 click
import colorama
import multiprocessing
import os
import queue
@ -26,6 +11,20 @@ import sys
import tempfile
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):

View file

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

View file

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

View file

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