mirror of
https://github.com/esphome/esphome.git
synced 2026-02-08 00:31:58 +00:00
[ci-custom] Fix after switch from string to path (#12314)
This commit is contained in:
@@ -554,10 +554,10 @@ def convert_path_to_relative(abspath, current):
|
|||||||
"esphome/components/web_server/__init__.py",
|
"esphome/components/web_server/__init__.py",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def lint_relative_py_import(fname, line, col, content):
|
def lint_relative_py_import(fname: Path, line, col, content):
|
||||||
import_line = content.splitlines()[line]
|
import_line = content.splitlines()[line]
|
||||||
abspath = import_line[col:].split(" ")[0]
|
abspath = import_line[col:].split(" ")[0]
|
||||||
current = fname.removesuffix(".py").replace(os.path.sep, ".")
|
current = str(fname).removesuffix(".py").replace(os.path.sep, ".")
|
||||||
replacement = convert_path_to_relative(abspath, current)
|
replacement = convert_path_to_relative(abspath, current)
|
||||||
newline = import_line.replace(abspath, replacement)
|
newline = import_line.replace(abspath, replacement)
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user