st_edits #6
|
|
@ -8,8 +8,7 @@ try:
|
||||||
from pyrf.devices.thinkrf import WSA
|
from pyrf.devices.thinkrf import WSA
|
||||||
except ImportError as exc: # pragma: no cover - optional dependency
|
except ImportError as exc: # pragma: no cover - optional dependency
|
||||||
raise ImportError(
|
raise ImportError(
|
||||||
"pyrf is required to use the ThinkRF integration. "
|
"pyrf is required to use the ThinkRF integration. " "Install with: pip install ria-toolkit-oss[thinkrf]"
|
||||||
"Install with: pip install ria-toolkit-oss[thinkrf]"
|
|
||||||
) from exc
|
) from exc
|
||||||
except SyntaxError as exc: # pragma: no cover - Python 2/3 compatibility issue
|
except SyntaxError as exc: # pragma: no cover - Python 2/3 compatibility issue
|
||||||
import sys
|
import sys
|
||||||
|
|
@ -19,12 +18,13 @@ except SyntaxError as exc: # pragma: no cover - Python 2/3 compatibility issue
|
||||||
print("\033[93mWARNING: pyrf has Python 2 syntax. Attempting automatic fix...\033[0m")
|
print("\033[93mWARNING: pyrf has Python 2 syntax. Attempting automatic fix...\033[0m")
|
||||||
try:
|
try:
|
||||||
from lib2to3.refactor import RefactoringTool, get_fixers_from_package
|
from lib2to3.refactor import RefactoringTool, get_fixers_from_package
|
||||||
|
|
||||||
import pyrf
|
import pyrf
|
||||||
|
|
||||||
thinkrf_path = Path(pyrf.__file__).resolve().parent / "devices" / "thinkrf.py"
|
thinkrf_path = Path(pyrf.__file__).resolve().parent / "devices" / "thinkrf.py"
|
||||||
print(f"Fixing: {thinkrf_path}")
|
print(f"Fixing: {thinkrf_path}")
|
||||||
|
|
||||||
fixers = get_fixers_from_package('lib2to3.fixes')
|
fixers = get_fixers_from_package("lib2to3.fixes")
|
||||||
tool = RefactoringTool(fixers)
|
tool = RefactoringTool(fixers)
|
||||||
tool.refactor_file(str(thinkrf_path), write=True)
|
tool.refactor_file(str(thinkrf_path), write=True)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user