From 63507acf98e94ceffa4e82d588d6ec369f2b7646 Mon Sep 17 00:00:00 2001 From: dmitrygribenchuk Date: Mon, 5 Sep 2022 21:19:19 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20Clean=20up=20Python=20imports=20?= =?UTF-8?q?(#24736)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py | 1 - buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py | 1 - buildroot/share/PlatformIO/scripts/mc-apply.py | 1 - buildroot/share/PlatformIO/scripts/offset_and_rename.py | 2 +- buildroot/share/PlatformIO/scripts/openblt.py | 1 - buildroot/share/PlatformIO/scripts/preflight-checks.py | 2 +- buildroot/share/PlatformIO/scripts/preprocessor.py | 2 +- buildroot/share/dwin/bin/makeIco.py | 1 - buildroot/share/dwin/bin/splitIco.py | 1 - buildroot/share/scripts/gen-tft-image.py | 4 ++-- buildroot/share/vscode/create_custom_upload_command_CDC.py | 2 +- buildroot/share/vscode/create_custom_upload_command_DFU.py | 2 +- 12 files changed, 7 insertions(+), 13 deletions(-) diff --git a/buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py b/buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py index 551f4c6316..a69520f46d 100644 --- a/buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py +++ b/buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py @@ -4,7 +4,6 @@ import pioutil if pioutil.is_pio_build(): - import os Import("env", "projenv") flash_size = 0 diff --git a/buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py b/buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py index c9794702c3..2cab2ce5c1 100644 --- a/buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py +++ b/buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py @@ -3,7 +3,6 @@ # import pioutil if pioutil.is_pio_build(): - import os from os.path import join from os.path import expandvars Import("env") diff --git a/buildroot/share/PlatformIO/scripts/mc-apply.py b/buildroot/share/PlatformIO/scripts/mc-apply.py index ed0ed795c6..b42ba12f7a 100755 --- a/buildroot/share/PlatformIO/scripts/mc-apply.py +++ b/buildroot/share/PlatformIO/scripts/mc-apply.py @@ -5,7 +5,6 @@ import json import sys import shutil -import re opt_output = '--opt' in sys.argv output_suffix = '.sh' if opt_output else '' if '--bare-output' in sys.argv else '.gen' diff --git a/buildroot/share/PlatformIO/scripts/offset_and_rename.py b/buildroot/share/PlatformIO/scripts/offset_and_rename.py index 6a095210ec..de14ccbbbf 100644 --- a/buildroot/share/PlatformIO/scripts/offset_and_rename.py +++ b/buildroot/share/PlatformIO/scripts/offset_and_rename.py @@ -10,7 +10,7 @@ # import pioutil if pioutil.is_pio_build(): - import sys,marlin + import marlin env = marlin.env board = env.BoardConfig() diff --git a/buildroot/share/PlatformIO/scripts/openblt.py b/buildroot/share/PlatformIO/scripts/openblt.py index 104bd142ca..6db8727ce4 100644 --- a/buildroot/share/PlatformIO/scripts/openblt.py +++ b/buildroot/share/PlatformIO/scripts/openblt.py @@ -3,7 +3,6 @@ # import pioutil if pioutil.is_pio_build(): - import os,sys from os.path import join Import("env") diff --git a/buildroot/share/PlatformIO/scripts/preflight-checks.py b/buildroot/share/PlatformIO/scripts/preflight-checks.py index 56394e17aa..16f39368b6 100644 --- a/buildroot/share/PlatformIO/scripts/preflight-checks.py +++ b/buildroot/share/PlatformIO/scripts/preflight-checks.py @@ -5,7 +5,7 @@ import pioutil if pioutil.is_pio_build(): - import os,re,sys + import re,sys from pathlib import Path Import("env") diff --git a/buildroot/share/PlatformIO/scripts/preprocessor.py b/buildroot/share/PlatformIO/scripts/preprocessor.py index ad24ed7be4..b0fec52bfa 100644 --- a/buildroot/share/PlatformIO/scripts/preprocessor.py +++ b/buildroot/share/PlatformIO/scripts/preprocessor.py @@ -1,7 +1,7 @@ # # preprocessor.py # -import subprocess,re +import subprocess nocache = 1 verbose = 0 diff --git a/buildroot/share/dwin/bin/makeIco.py b/buildroot/share/dwin/bin/makeIco.py index 274082acee..65e7eb53a5 100755 --- a/buildroot/share/dwin/bin/makeIco.py +++ b/buildroot/share/dwin/bin/makeIco.py @@ -18,7 +18,6 @@ # along with this program. If not, see . #---------------------------------------------------------------- -import os import os.path import argparse import DWIN_ICO diff --git a/buildroot/share/dwin/bin/splitIco.py b/buildroot/share/dwin/bin/splitIco.py index ce6ba89749..a96d1823d2 100755 --- a/buildroot/share/dwin/bin/splitIco.py +++ b/buildroot/share/dwin/bin/splitIco.py @@ -18,7 +18,6 @@ # along with this program. If not, see . #---------------------------------------------------------------- -import os import os.path import argparse import DWIN_ICO diff --git a/buildroot/share/scripts/gen-tft-image.py b/buildroot/share/scripts/gen-tft-image.py index d89245fea4..9b7d19493e 100644 --- a/buildroot/share/scripts/gen-tft-image.py +++ b/buildroot/share/scripts/gen-tft-image.py @@ -22,8 +22,8 @@ # Generate Marlin TFT Images from bitmaps/PNG/JPG -import sys,re,struct -from PIL import Image,ImageDraw +import sys,struct +from PIL import Image def image2bin(image, output_file): if output_file.endswith(('.c', '.cpp')): diff --git a/buildroot/share/vscode/create_custom_upload_command_CDC.py b/buildroot/share/vscode/create_custom_upload_command_CDC.py index 4662dd26cb..4926faf06a 100644 --- a/buildroot/share/vscode/create_custom_upload_command_CDC.py +++ b/buildroot/share/vscode/create_custom_upload_command_CDC.py @@ -13,7 +13,7 @@ from __future__ import print_function from __future__ import division -import subprocess,os,sys,platform +import subprocess,os,platform from SCons.Script import DefaultEnvironment current_OS = platform.system() diff --git a/buildroot/share/vscode/create_custom_upload_command_DFU.py b/buildroot/share/vscode/create_custom_upload_command_DFU.py index 562e284e63..27c5a34802 100644 --- a/buildroot/share/vscode/create_custom_upload_command_DFU.py +++ b/buildroot/share/vscode/create_custom_upload_command_DFU.py @@ -9,7 +9,7 @@ # Will continue on if a COM port isn't found so that the compilation can be done. # -import os,sys +import os from SCons.Script import DefaultEnvironment import platform current_OS = platform.system()