Skip to content

Commit

Permalink
Clean up formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
hcho3 committed Feb 16, 2024
1 parent f66edcb commit aef6413
Show file tree
Hide file tree
Showing 26 changed files with 34 additions and 9 deletions.
1 change: 0 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ extend-ignore =
F401
# redefinition of unused
F811
extend-ignore =
# E203 whitespace before ':'
# https://github.com/psf/black/issues/315
E203
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
args: ["--maxkb=4000"]
- repo: https://github.com/psf/black
rev: 23.1.0
rev: 24.2.0
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
args: ["--profile", "black", "--filter-files"]
- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
rev: 7.0.0
hooks:
- id: flake8
args: [--config=.flake8]
Expand Down Expand Up @@ -55,7 +55,7 @@ repos:
additional_dependencies: [cpplint]
types_or: [c++]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.2.0
rev: v1.8.0
hooks:
- id: mypy
additional_dependencies: [types-setuptools]
1 change: 1 addition & 0 deletions ops/scripts/rename_whl.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Rename Python wheel to contain commit ID"""

import argparse
import pathlib

Expand Down
1 change: 1 addition & 0 deletions python/hatch_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Custom hook to customize the behavior of Hatchling.
Here, we customize the tag of the generated wheels.
"""

import sysconfig
from typing import Any, Dict

Expand Down
1 change: 1 addition & 0 deletions python/packager/build_config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Build configuration"""

import dataclasses
from typing import Any, Dict, List, Optional

Expand Down
1 change: 1 addition & 0 deletions python/packager/nativelib.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Functions for building libtl2cgen
"""

import logging
import os
import pathlib
Expand Down
1 change: 1 addition & 0 deletions python/packager/pep517.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Reuses components of Hatchling (https://github.com/pypa/hatch/tree/master/backend) for the sake
of brevity.
"""

import dataclasses
import logging
import os
Expand Down
1 change: 1 addition & 0 deletions python/packager/sdist.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Functions for building sdist
"""

import logging
import pathlib

Expand Down
1 change: 1 addition & 0 deletions python/packager/util.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Utility functions for implementing PEP 517 backend
"""

import logging
import pathlib
import shutil
Expand Down
1 change: 1 addition & 0 deletions python/tl2cgen/contrib/create_shared.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Logic for launching C compiler to build shared libs"""

import pathlib
import subprocess
from typing import Any, Dict
Expand Down
2 changes: 2 additions & 0 deletions python/tl2cgen/contrib/gcc.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Tools to interact with toolchains GCC, Clang, and other UNIX compilers
"""

import pathlib
from typing import Any, Dict, List

Expand Down Expand Up @@ -49,6 +50,7 @@ def _create_shared_gcc(
options: List[str],
verbose: bool,
) -> pathlib.Path:
# pylint: disable=too-many-arguments
options += ["-lm"]
# Specify command to compile an object file
recipe["object_ext"] = _obj_ext()
Expand Down
1 change: 1 addition & 0 deletions python/tl2cgen/contrib/msvc.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Tools to interact with Microsoft Visual C++ (MSVC)
"""

import itertools
import os
import pathlib
Expand Down
1 change: 1 addition & 0 deletions python/tl2cgen/contrib/util.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utilities for contrib module"""

import os
import subprocess
from sys import platform as _platform
Expand Down
3 changes: 2 additions & 1 deletion python/tl2cgen/core.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Core module of TL2cgen"""

import ctypes
import json
import pathlib
Expand Down Expand Up @@ -112,7 +113,7 @@ def _dump_compiler_ast(
)
)
assert out_str.value is not None
return out_str.value.decode("utf-8")
return out_str.value.decode("utf-8") # pylint: disable=E1101


def annotate_branch(
Expand Down
3 changes: 2 additions & 1 deletion python/tl2cgen/create_shared.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Launcher for C compiler to build shared libs"""

import pathlib
import time
import warnings
Expand All @@ -20,7 +21,7 @@ def create_shared(
verbose: bool = False,
options: Optional[List[str]] = None,
long_build_time_warning: bool = True,
): # pylint: disable=R0914
): # pylint: disable=R0914,too-many-arguments
"""Create shared library.
Parameters
Expand Down
1 change: 1 addition & 0 deletions python/tl2cgen/data.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Data matrix"""

import ctypes
from typing import Optional, Tuple, Union

Expand Down
1 change: 1 addition & 0 deletions python/tl2cgen/generate_makefile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Generator for Makefile and CMakeLists.txt"""

import pathlib
from typing import List, Optional, Union

Expand Down
1 change: 1 addition & 0 deletions python/tl2cgen/util.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utility functions"""

import ctypes
import json
import pathlib
Expand Down
1 change: 1 addition & 0 deletions tests/python/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Pytest fixtures to initialize tests"""

import pathlib
import tempfile

Expand Down
4 changes: 3 additions & 1 deletion tests/python/hypothesis_util.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utility functions for hypothesis-based testing"""

# pylint: disable=differing-param-doc,missing-type-doc

from sys import platform as _platform
Expand Down Expand Up @@ -47,7 +48,7 @@ def standard_classification_datasets(
shuffle=just(True),
random_state=None,
):
# pylint: disable=too-many-locals
# pylint: disable=too-many-locals,too-many-arguments
"""
Returns a strategy to generate classification problem input datasets.
Note:
Expand Down Expand Up @@ -197,6 +198,7 @@ def standard_regression_datasets(
shuffle=just(True),
random_state=None,
):
# pylint: disable=too-many-arguments
"""
Returns a strategy to generate regression problem input datasets.
Note:
Expand Down
1 change: 1 addition & 0 deletions tests/python/test_basic.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Suite of basic tests"""

import itertools
import os
import pathlib
Expand Down
1 change: 1 addition & 0 deletions tests/python/test_invalid_categorical_input.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test whether TL2cgen handles invalid category values correctly"""

import pathlib

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions tests/python/test_lightgbm_integration.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for LightGBM integration"""

from __future__ import annotations

import pathlib
Expand Down
1 change: 1 addition & 0 deletions tests/python/test_model_builder.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for model builder interface"""

import os
import pathlib

Expand Down
1 change: 1 addition & 0 deletions tests/python/test_sklearn_integration.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for scikit-learn importer"""

import os
import pathlib

Expand Down
1 change: 1 addition & 0 deletions tests/python/test_xgboost_integration.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for XGBoost integration"""

# pylint: disable=R0201, R0915
import os

Expand Down

0 comments on commit aef6413

Please sign in to comment.