Skip to content

Commit

Permalink
revert code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
HydrogenSulfate committed Dec 22, 2023
1 parent 17223e7 commit 3eb254c
Show file tree
Hide file tree
Showing 250 changed files with 3,964 additions and 2,030 deletions.
104 changes: 61 additions & 43 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,49 +1,67 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/PyCQA/isort
rev: 5.11.5
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: isort
args: ["--multi-line=7", "--sl"]

- repo: https://github.com/psf/black
rev: 22.3.0
- id: trailing-whitespace
exclude: "^.+\\.pbtxt$"
- id: end-of-file-fixer
exclude: "^.+\\.pbtxt$"
- id: check-yaml
#- id: check-json
- id: check-added-large-files
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
# Python
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black

# - repo: https://github.com/charliermarsh/ruff-pre-commit
# rev: 'v0.0.272'
# hooks:
# - id: ruff

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: a11d9314b22d8f8c7556443875b731ef05965464
- id: black-jupyter
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
files: \.py$
- repo: https://github.com/charliermarsh/ruff-pre-commit
# Ruff version.
rev: v0.0.269
hooks:
- id: ruff
args: ["--fix"]
# numpydoc
- repo: https://github.com/Carreau/velin
rev: 0.0.12
hooks:
- id: velin
args: ["--write"]
# Python inside docs
- repo: https://github.com/asottile/blacken-docs
rev: 1.13.0
hooks:
- id: check-merge-conflict
- id: check-symlinks
- id: detect-private-key
files: (?!.*paddle)^.*$
- id: end-of-file-fixer
files: \.md$
- id: trailing-whitespace
files: \.md$

- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.0.1
- id: blacken-docs
# C++
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v16.0.4
hooks:
- id: forbid-crlf
files: \.md$
- id: remove-crlf
files: \.md$
- id: forbid-tabs
files: \.md$
- id: remove-tabs
files: \.md$

# - repo: local
- id: clang-format
exclude: ^source/3rdparty|source/lib/src/cuda/cudart/.+\.inc
# CSS
# - repo: https://github.com/pre-commit/mirrors-csslint
# rev: v1.0.5
# hooks:
# - id: clang-format
# name: clang-format
# description: Format files with ClangFormat
# entry: bash .clang_format.hook -i
# language: system
# files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|cuh|proto)$
# - id: csslint
# Shell
- repo: https://github.com/scop/pre-commit-shfmt
rev: v3.6.0-2
hooks:
- id: shfmt
# CMake
- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.13
hooks:
- id: cmake-format
#- id: cmake-lint
ci:
autoupdate_branch: devel
8 changes: 6 additions & 2 deletions backend/dp_backend.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
"""A PEP-517 backend to find TensorFlow."""
from typing import List
from typing import (
List,
)

from find_tensorflow import find_tensorflow
from find_tensorflow import (
find_tensorflow,
)

# TODO: switch to scikit_build_core after it is available
from setuptools import build_meta as _orig
Expand Down
32 changes: 22 additions & 10 deletions backend/find_tensorflow.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
import os
import site
from importlib.machinery import FileFinder
from importlib.util import find_spec
from pathlib import Path
from sysconfig import get_path
from typing import List
from typing import Optional
from typing import Tuple
from typing import Union

from packaging.specifiers import SpecifierSet
from importlib.machinery import (
FileFinder,
)
from importlib.util import (
find_spec,
)
from pathlib import (
Path,
)
from sysconfig import (
get_path,
)
from typing import (
List,
Optional,
Tuple,
Union,
)

from packaging.specifiers import (
SpecifierSet,
)


def find_tensorflow() -> Tuple[Optional[str], List[str]]:
Expand Down
8 changes: 6 additions & 2 deletions data/json/json2yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@

import argparse
import json
from pathlib import Path
from warnings import warn
from pathlib import (
Path,
)
from warnings import (
warn,
)

import yaml

Expand Down
36 changes: 24 additions & 12 deletions deepmd/__init__.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,41 @@
"""Root of the deepmd package, exposes all public classes and submodules."""

try:
from importlib import metadata
from importlib import (
metadata,
)
except ImportError: # for Python<3.8
import importlib_metadata as metadata

import deepmd.utils.network as network

from . import cluster
from . import descriptor
from . import fit
from . import loss
from . import nvnmd
from . import utils
from .env import set_mkl
from .infer import DeepEval
from .infer import DeepPotential
from .infer.data_modifier import DipoleChargeModifier
from . import (
cluster,
descriptor,
fit,
loss,
nvnmd,
utils,
)
from .env import (
set_mkl,
)
from .infer import (
DeepEval,
DeepPotential,
)
from .infer.data_modifier import (
DipoleChargeModifier,
)

set_mkl()

try:
from ._version import version as __version__
except ImportError:
from .__about__ import __version__
from .__about__ import (
__version__,
)

# load third-party plugins
try:
Expand Down
4 changes: 3 additions & 1 deletion deepmd/__main__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""Package dp entry point."""

from .entrypoints.main import main
from .entrypoints.main import (
main,
)

if __name__ == "__main__":
main()
36 changes: 23 additions & 13 deletions deepmd/calculator.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
"""ASE calculator interface module."""

from pathlib import Path
from typing import TYPE_CHECKING
from typing import Dict
from typing import List
from typing import Optional
from typing import Union

from ase.calculators.calculator import Calculator
from ase.calculators.calculator import PropertyNotImplementedError
from ase.calculators.calculator import all_changes

from deepmd import DeepPotential
from pathlib import (
Path,
)
from typing import (
TYPE_CHECKING,
Dict,
List,
Optional,
Union,
)

from ase.calculators.calculator import (
Calculator,
PropertyNotImplementedError,
all_changes,
)

from deepmd import (
DeepPotential,
)

if TYPE_CHECKING:
from ase import Atoms
from ase import (
Atoms,
)

__all__ = ["DP"]

Expand Down
8 changes: 5 additions & 3 deletions deepmd/cluster/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
"""Module that reads node resources, auto detects if running local or on SLURM."""

import os
from typing import List
from typing import Optional
from typing import Tuple
from typing import (
List,
Optional,
Tuple,
)

from .local import get_resource as get_local_res
from .slurm import get_resource as get_slurm_res
Expand Down
14 changes: 9 additions & 5 deletions deepmd/cluster/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
import socket
import subprocess as sp
import sys
from typing import List
from typing import Optional
from typing import Tuple

from deepmd.env import tf
from typing import (
List,
Optional,
Tuple,
)

from deepmd.env import (
tf,
)

__all__ = ["get_gpus", "get_resource"]

Expand Down
12 changes: 8 additions & 4 deletions deepmd/cluster/slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@
"""

import os
from typing import List
from typing import Optional
from typing import Tuple
from typing import (
List,
Optional,
Tuple,
)

import hostlist

from deepmd.cluster import local
from deepmd.cluster import (
local,
)

__all__ = ["get_resource"]

Expand Down
Loading

0 comments on commit 3eb254c

Please sign in to comment.