Skip to content

Commit

Permalink
reformatting code
Browse files Browse the repository at this point in the history
  • Loading branch information
HydrogenSulfate committed Dec 29, 2023
1 parent e216775 commit 9851bb3
Show file tree
Hide file tree
Showing 34 changed files with 923 additions and 1,431 deletions.
102 changes: 59 additions & 43 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,49 +1,65 @@
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
3. 安装 deepmd-kit

``` sh
git clone https://github.com/HydrogenSulfate/deepmd-kit.git -b add_ddle_backend
git clone https://github.com/deepmodeling/deepmd-kit.git -b paddle2
cd deepmd-kit
# 以 editable 的方式安装,方便调试
pip install -e . -i https://pypi.tuna.tsinghua.edu.cn/simple
Expand Down
46 changes: 27 additions & 19 deletions deepmd/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,37 @@

import json
import warnings
from functools import wraps
from pathlib import Path
from typing import TYPE_CHECKING
from typing import Any
from typing import Callable
from typing import Dict
from typing import List
from typing import Optional
from typing import TypeVar
from typing import Union
from functools import (
wraps,
)
from pathlib import (
Path,
)
from typing import (
TYPE_CHECKING,
Any,
Callable,
Dict,
List,
Optional,
TypeVar,
Union,
)

import numpy as np
import tensorflow
import yaml
from tensorflow.python.framework import tensor_util

from deepmd.env import GLOBAL_NP_FLOAT_PRECISION
from deepmd.env import GLOBAL_PD_FLOAT_PRECISION
from deepmd.env import GLOBAL_TF_FLOAT_PRECISION
from deepmd.env import op_module
from deepmd.env import paddle
from deepmd.env import tf
from deepmd.utils.path import DPPath

from deepmd.env import (
GLOBAL_NP_FLOAT_PRECISION,
GLOBAL_PD_FLOAT_PRECISION,
op_module,
paddle,
tf,
)
from deepmd.utils.path import (
DPPath,
)

if TYPE_CHECKING:
_DICT_VAL = TypeVar("_DICT_VAL")
Expand Down
Loading

0 comments on commit 9851bb3

Please sign in to comment.