[Python] Require black and isort for new Python files. (#8096)
* [Python] Require black and isort for new Python files. - Require black and isort for spark and dask module. These files are relatively new and are more conform to the black formatter. We will convert the rest of the library as we move forward. Other libraries including dask/distributed and optuna use the same formatting style and have a more strict standard. The black formatter is indeed quite nice, automating it can help us unify the code style. - Gather Python checks into a single script.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import argparse
|
||||
import os
|
||||
import subprocess
|
||||
from test_utils import DirectoryExcursion
|
||||
|
||||
ROOT = os.path.normpath(
|
||||
os.path.join(os.path.dirname(os.path.abspath(__file__)), os.path.pardir,
|
||||
@@ -8,18 +9,6 @@ ROOT = os.path.normpath(
|
||||
r_package = os.path.join(ROOT, 'R-package')
|
||||
|
||||
|
||||
class DirectoryExcursion:
|
||||
def __init__(self, path: os.PathLike):
|
||||
self.path = path
|
||||
self.curdir = os.path.normpath(os.path.abspath(os.path.curdir))
|
||||
|
||||
def __enter__(self):
|
||||
os.chdir(self.path)
|
||||
|
||||
def __exit__(self, *args):
|
||||
os.chdir(self.curdir)
|
||||
|
||||
|
||||
def get_mingw_bin():
|
||||
return os.path.join('c:/rtools40/mingw64/', 'bin')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user