All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
1 " Author: jake <me@jake.computer>
2 " Description: Fixing Python imports with reorder-python-imports.
4 call ale#Set('python_reorder_python_imports_executable', 'reorder-python-imports')
5 call ale#Set('python_reorder_python_imports_options', '')
6 call ale#Set('python_reorder_python_imports_use_global', get(g:, 'ale_use_global_executables', 0))
7 call ale#Set('python_reorder_python_imports_auto_pipenv', 0)
8 call ale#Set('python_reorder_python_imports_auto_poetry', 0)
9 call ale#Set('python_reorder_python_imports_auto_uv', 0)
11 function! ale#fixers#reorder_python_imports#GetExecutable(buffer) abort
12 if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_reorder_python_imports_auto_pipenv'))
13 \ && ale#python#PipenvPresent(a:buffer)
17 if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_reorder_python_imports_auto_poetry'))
18 \ && ale#python#PoetryPresent(a:buffer)
22 if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_reorder_python_imports_auto_uv'))
23 \ && ale#python#UvPresent(a:buffer)
27 return ale#python#FindExecutable(a:buffer, 'python_reorder_python_imports', ['reorder-python-imports'])
30 function! ale#fixers#reorder_python_imports#Fix(buffer) abort
31 let l:executable = ale#fixers#reorder_python_imports#GetExecutable(a:buffer)
33 let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$'
34 \ ? ' run reorder-python-imports'
37 let l:options = ale#Var(a:buffer, 'python_reorder_python_imports_options')
40 \ 'command': ale#Escape(l:executable) . l:exec_args
41 \ . (!empty(l:options) ? ' ' . l:options : '') . ' -',