all: Enable ruff E401 and E402 import lints.

Mostly small cleanups to put each top-level import on its own line.  But
explicitly disable the lint for examples/tests which insert the current
directory into the path before importing.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
pull/858/head
Angus Gratton 2024-05-14 15:38:47 +10:00 zatwierdzone przez Damien George
rodzic 992eecfed4
commit 00fc3fd37b
27 zmienionych plików z 58 dodań i 20 usunięć

Wyświetl plik

@ -5,6 +5,7 @@
import sys import sys
# ruff: noqa: E402
sys.path.append("") sys.path.append("")
from micropython import const from micropython import const

Wyświetl plik

@ -16,6 +16,7 @@
import sys import sys
# ruff: noqa: E402
sys.path.append("") sys.path.append("")
from micropython import const from micropython import const

Wyświetl plik

@ -1,5 +1,6 @@
import sys import sys
# ruff: noqa: E402
sys.path.append("") sys.path.append("")
from micropython import const from micropython import const

Wyświetl plik

@ -1,5 +1,6 @@
import sys import sys
# ruff: noqa: E402
sys.path.append("") sys.path.append("")
from micropython import const from micropython import const

Wyświetl plik

@ -2,10 +2,12 @@
import sys import sys
# ruff: noqa: E402
sys.path.append("") sys.path.append("")
from micropython import const from micropython import const
import time, machine import machine
import time
import uasyncio as asyncio import uasyncio as asyncio
import aioble import aioble

Wyświetl plik

@ -2,10 +2,12 @@
import sys import sys
# ruff: noqa: E402
sys.path.append("") sys.path.append("")
from micropython import const from micropython import const
import time, machine import machine
import time
import uasyncio as asyncio import uasyncio as asyncio
import aioble import aioble

Wyświetl plik

@ -2,10 +2,12 @@
import sys import sys
# ruff: noqa: E402
sys.path.append("") sys.path.append("")
from micropython import const from micropython import const
import time, machine import machine
import time
import uasyncio as asyncio import uasyncio as asyncio
import aioble import aioble

Wyświetl plik

@ -2,10 +2,12 @@
import sys import sys
# ruff: noqa: E402
sys.path.append("") sys.path.append("")
from micropython import const from micropython import const
import time, machine import machine
import time
import uasyncio as asyncio import uasyncio as asyncio
import aioble import aioble

Wyświetl plik

@ -2,10 +2,12 @@
import sys import sys
# ruff: noqa: E402
sys.path.append("") sys.path.append("")
from micropython import const from micropython import const
import time, machine import machine
import time
import uasyncio as asyncio import uasyncio as asyncio
import aioble import aioble

Wyświetl plik

@ -2,10 +2,12 @@
import sys import sys
# ruff: noqa: E402
sys.path.append("") sys.path.append("")
from micropython import const from micropython import const
import time, machine import machine
import time
import uasyncio as asyncio import uasyncio as asyncio
import aioble import aioble

Wyświetl plik

@ -2,10 +2,12 @@
import sys import sys
# ruff: noqa: E402
sys.path.append("") sys.path.append("")
from micropython import const from micropython import const
import time, machine import machine
import time
import uasyncio as asyncio import uasyncio as asyncio
import aioble import aioble

Wyświetl plik

@ -2,10 +2,12 @@
import sys import sys
# ruff: noqa: E402
sys.path.append("") sys.path.append("")
from micropython import const from micropython import const
import time, machine import machine
import time
import uasyncio as asyncio import uasyncio as asyncio
import aioble import aioble

Wyświetl plik

@ -1,9 +1,11 @@
import sys import sys
# ruff: noqa: E402
sys.path.append("") sys.path.append("")
from micropython import const from micropython import const
import time, machine import machine
import time
import uasyncio as asyncio import uasyncio as asyncio
import aioble import aioble

Wyświetl plik

@ -2,9 +2,10 @@
# MIT license; Copyright (c) 2017 Damien P. George # MIT license; Copyright (c) 2017 Damien P. George
from micropython import const from micropython import const
import machine
from utime import sleep_ms from utime import sleep_ms
from ustruct import calcsize, pack_into from ustruct import calcsize, pack_into
import uerrno, machine import uerrno
# for set_orient # for set_orient
PORTRAIT = const(0) PORTRAIT = const(0)

Wyświetl plik

@ -1,7 +1,10 @@
# Driver test for official MicroPython LCD160CR display # Driver test for official MicroPython LCD160CR display
# MIT license; Copyright (c) 2017 Damien P. George # MIT license; Copyright (c) 2017 Damien P. George
import time, math, framebuf, lcd160cr import framebuf
import lcd160cr
import math
import time
def get_lcd(lcd): def get_lcd(lcd):

Wyświetl plik

@ -1,6 +1,8 @@
# Test for sdcard block protocol # Test for sdcard block protocol
# Peter hinch 30th Jan 2016 # Peter hinch 30th Jan 2016
import os, sdcard, machine import machine
import os
import sdcard
def sdtest(): def sdtest():

Wyświetl plik

@ -54,14 +54,12 @@ select = [
# "UP", # pyupgrade # "UP", # pyupgrade
] ]
ignore = [ ignore = [
"E401",
"E402",
"E722", "E722",
"E741", "E741", # 'l' is currently widely used
"F401", "F401",
"F403", "F403",
"F405", "F405",
"E501", "E501", # line length, recommended to disable
"ISC001", "ISC001",
"ISC003", # micropython does not support implicit concatenation of f-strings "ISC003", # micropython does not support implicit concatenation of f-strings
"PIE810", # micropython does not support passing tuples to .startswith or .endswith "PIE810", # micropython does not support passing tuples to .startswith or .endswith
@ -74,7 +72,7 @@ ignore = [
"PLW2901", "PLW2901",
"RUF012", "RUF012",
"RUF100", "RUF100",
"W191", "W191", # tab-indent, redundant when using formatter
] ]
line-length = 99 line-length = 99
target-version = "py37" target-version = "py37"

Wyświetl plik

@ -22,7 +22,8 @@ class ClientResponse:
c_encoding = self.headers.get("Content-Encoding") c_encoding = self.headers.get("Content-Encoding")
if c_encoding in ("gzip", "deflate", "gzip,deflate"): if c_encoding in ("gzip", "deflate", "gzip,deflate"):
try: try:
import deflate, io import deflate
import io
if c_encoding == "deflate": if c_encoding == "deflate":
with deflate.DeflateIO(io.BytesIO(data), deflate.ZLIB) as d: with deflate.DeflateIO(io.BytesIO(data), deflate.ZLIB) as d:

Wyświetl plik

@ -1,5 +1,6 @@
import sys import sys
# ruff: noqa: E402
sys.path.insert(0, ".") sys.path.insert(0, ".")
import aiohttp import aiohttp
import asyncio import asyncio

Wyświetl plik

@ -1,5 +1,6 @@
import sys import sys
# ruff: noqa: E402
sys.path.insert(0, ".") sys.path.insert(0, ".")
import aiohttp import aiohttp
import asyncio import asyncio

Wyświetl plik

@ -1,5 +1,6 @@
import sys import sys
# ruff: noqa: E402
sys.path.insert(0, ".") sys.path.insert(0, ".")
import aiohttp import aiohttp
import asyncio import asyncio

Wyświetl plik

@ -1,5 +1,6 @@
import sys import sys
# ruff: noqa: E402
sys.path.insert(0, ".") sys.path.insert(0, ".")
import aiohttp import aiohttp
import asyncio import asyncio

Wyświetl plik

@ -1,5 +1,6 @@
import sys import sys
# ruff: noqa: E402
sys.path.insert(0, ".") sys.path.insert(0, ".")
import aiohttp import aiohttp
import asyncio import asyncio

Wyświetl plik

@ -1,5 +1,6 @@
import sys import sys
# ruff: noqa: E402
sys.path.insert(0, ".") sys.path.insert(0, ".")
import aiohttp import aiohttp
import asyncio import asyncio

Wyświetl plik

@ -1,5 +1,6 @@
import sys import sys
# ruff: noqa: E402
sys.path.insert(0, ".") sys.path.insert(0, ".")
import aiohttp import aiohttp
import asyncio import asyncio

Wyświetl plik

@ -1,5 +1,6 @@
import sys import sys
# ruff: noqa: E402
sys.path.insert(0, ".") sys.path.insert(0, ".")
import aiohttp import aiohttp
import asyncio import asyncio

Wyświetl plik

@ -12,9 +12,12 @@ Usage:
iperf3.client('192.168.1.5', udp=True, reverse=True) iperf3.client('192.168.1.5', udp=True, reverse=True)
""" """
import sys, struct
import time, select, socket
import json import json
import select
import socket
import struct
import sys
import time
# Provide a urandom() function, supporting devices without os.urandom(). # Provide a urandom() function, supporting devices without os.urandom().
try: try: