diff --git a/.ci/get_workflow_status.py b/.ci/get_workflow_status.py index e2e8926bd692..875345c2efde 100644 --- a/.ci/get_workflow_status.py +++ b/.ci/get_workflow_status.py @@ -6,6 +6,7 @@ TRIGGER_PHRASE: Code phrase that triggers workflow. """ + import json from os import environ from sys import argv, exit diff --git a/.nuget/create_nuget.py b/.nuget/create_nuget.py index ec954dae7ca3..1e6258dbcdb3 100644 --- a/.nuget/create_nuget.py +++ b/.nuget/create_nuget.py @@ -1,5 +1,6 @@ # coding: utf-8 """Script for generating files with NuGet package metadata.""" + import datetime import sys from pathlib import Path diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8ffb6a8f8f2f..6c8732a01416 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,7 +13,7 @@ exclude: | repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v4.6.0 hooks: - id: end-of-file-fixer - id: trailing-whitespace @@ -25,7 +25,7 @@ repos: args: ["--settings-path", "python-package/pyproject.toml"] - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.2.1 + rev: v0.4.7 hooks: # Run the linter. - id: ruff diff --git a/docs/conf.py b/docs/conf.py index 2780f47d913f..f8bd29a69922 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -17,6 +17,7 @@ # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute. """Sphinx configuration file.""" + import datetime import os import sys diff --git a/helpers/check_dynamic_dependencies.py b/helpers/check_dynamic_dependencies.py index fcf41ea52701..087061d9575c 100644 --- a/helpers/check_dynamic_dependencies.py +++ b/helpers/check_dynamic_dependencies.py @@ -12,6 +12,7 @@ * GLIBCXX: https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html * OMP/GOMP: https://github.com/gcc-mirror/gcc/blob/master/libgomp/libgomp.map """ + import re import sys from pathlib import Path diff --git a/helpers/parameter_generator.py b/helpers/parameter_generator.py index fb1749638bca..15db36da2bb2 100644 --- a/helpers/parameter_generator.py +++ b/helpers/parameter_generator.py @@ -6,6 +6,7 @@ along with parameters description in LightGBM/docs/Parameters.rst file from the information in LightGBM/include/LightGBM/config.h file. """ + import re from collections import defaultdict from pathlib import Path diff --git a/python-package/lightgbm/__init__.py b/python-package/lightgbm/__init__.py index ae38a6169a22..600f71284159 100644 --- a/python-package/lightgbm/__init__.py +++ b/python-package/lightgbm/__init__.py @@ -3,6 +3,7 @@ Contributors: https://github.com/microsoft/LightGBM/graphs/contributors. """ + from pathlib import Path from .basic import Booster, Dataset, Sequence, register_logger diff --git a/python-package/lightgbm/basic.py b/python-package/lightgbm/basic.py index 8e33d0ab56f2..5bfb8dcbbb58 100644 --- a/python-package/lightgbm/basic.py +++ b/python-package/lightgbm/basic.py @@ -1,5 +1,6 @@ # coding: utf-8 """Wrapper for C API of LightGBM.""" + import abc import ctypes import inspect diff --git a/python-package/lightgbm/callback.py b/python-package/lightgbm/callback.py index e776ea953bd1..ae1e72c549d4 100644 --- a/python-package/lightgbm/callback.py +++ b/python-package/lightgbm/callback.py @@ -1,5 +1,6 @@ # coding: utf-8 """Callbacks library.""" + from collections import OrderedDict from dataclasses import dataclass from functools import partial diff --git a/python-package/lightgbm/dask.py b/python-package/lightgbm/dask.py index 928fe51bddce..e15979bc40db 100644 --- a/python-package/lightgbm/dask.py +++ b/python-package/lightgbm/dask.py @@ -6,6 +6,7 @@ It is based on dask-lightgbm, which was based on dask-xgboost. """ + import operator import socket from collections import defaultdict diff --git a/python-package/lightgbm/engine.py b/python-package/lightgbm/engine.py index 74b211f4a426..5f93824458d4 100644 --- a/python-package/lightgbm/engine.py +++ b/python-package/lightgbm/engine.py @@ -1,5 +1,6 @@ # coding: utf-8 """Library with training routines of LightGBM.""" + import copy import json import warnings diff --git a/python-package/lightgbm/libpath.py b/python-package/lightgbm/libpath.py index 09eb946e3c45..a55e7362ab44 100644 --- a/python-package/lightgbm/libpath.py +++ b/python-package/lightgbm/libpath.py @@ -1,5 +1,6 @@ # coding: utf-8 """Find the path to LightGBM dynamic library files.""" + from pathlib import Path from platform import system from typing import List diff --git a/python-package/lightgbm/plotting.py b/python-package/lightgbm/plotting.py index 9bcc1b928ffd..1c7bda5c68b6 100644 --- a/python-package/lightgbm/plotting.py +++ b/python-package/lightgbm/plotting.py @@ -1,5 +1,6 @@ # coding: utf-8 """Plotting library.""" + import math from copy import deepcopy from io import BytesIO diff --git a/python-package/lightgbm/sklearn.py b/python-package/lightgbm/sklearn.py index 1ea7b47c5462..9f1a62f542ca 100644 --- a/python-package/lightgbm/sklearn.py +++ b/python-package/lightgbm/sklearn.py @@ -1,5 +1,6 @@ # coding: utf-8 """Scikit-learn wrapper interface for LightGBM.""" + import copy from inspect import signature from pathlib import Path