Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix code style #177

Merged
merged 12 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ jobs:
pip install -e .
pip install -r tests/requirements.txt
- name: Test
run: DEVICE=cpu PREPROCESS_DEVICE=cpu DISABLE_TQDM=True coverage run --source=./deepmd_pt -m unittest -v -f && coverage report
run: DEVICE=cpu PREPROCESS_DEVICE=cpu DISABLE_TQDM=True coverage run --source=./deepmd_pt -m unittest -v && coverage report
- uses: codecov/codecov-action@v3
1 change: 1 addition & 0 deletions .license-header.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SPDX-License-Identifier: LGPL-3.0-or-later
113 changes: 113 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
exclude: "^.+\\.pth$"
- id: end-of-file-fixer
exclude: "^.+\\.pth$"
- id: check-yaml
- id: check-json
- id: check-added-large-files
args: ['--maxkb=1024', '--enforce-all']
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
# Python
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
files: \.py$
exclude: ^source/3rdparty
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.13
hooks:
- id: ruff
args: ["--fix"]
exclude: ^source/3rdparty
types_or: [python, pyi, jupyter]
- id: ruff-format
exclude: ^source/3rdparty
types_or: [python, pyi, jupyter]
# numpydoc
- repo: https://github.com/Carreau/velin
rev: 0.0.12
hooks:
- id: velin
args: ["--write"]
exclude: ^source/3rdparty
# Python inside docs
- repo: https://github.com/asottile/blacken-docs
rev: 1.16.0
hooks:
- id: blacken-docs
# C++
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v17.0.6
hooks:
- id: clang-format
exclude: ^source/3rdparty|source/lib/src/gpu/cudart/.+\.inc
# CSS
- repo: https://github.com/pre-commit/mirrors-csslint
rev: v1.0.5
hooks:
- id: csslint
# Shell
- repo: https://github.com/scop/pre-commit-shfmt
rev: v3.7.0-4
hooks:
- id: shfmt
# CMake
- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.13
hooks:
- id: cmake-format
#- id: cmake-lint
# license header
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.4
hooks:
# C++, js
- id: insert-license
files: \.(c|cc|cpp|js|ts|h|hpp)$
args:
- --license-filepath
- .license-header.txt
- --comment-style
- //
- --no-extra-eol
exclude: ^source/3rdparty|source/lib/src/gpu/cudart/.+\.inc
# CSS
- id: insert-license
files: \.(css|scss)$
args:
- --license-filepath
- .license-header.txt
- --comment-style
- /*| *| */
- --no-extra-eol
# Python
- id: insert-license
files: \.(py|pyx)$
args:
- --license-filepath
- .license-header.txt
- --comment-style
- "#"
- --no-extra-eol
exclude: ^source/3rdparty
# HTML
- id: insert-license
files: \.(html|vue|xml)$
args:
- --license-filepath
- .license-header.txt
- --comment-style
- <!--| ~| -->
- --no-extra-eol
ci:
autoupdate_branch: devel
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,4 @@ General Public License ever published by the Free Software Foundation.
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
Library.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ self.dataloaders: List[DataLoader] = []
for system in systems:
dl = create_dataloader(system)
self.dataloaders.append(dl)
for _ in range(len(dl)): # len(dl) == how many mini-batches in this system
for _ in range(len(dl)): # len(dl) == how many mini-batches in this system
index.append(len(self.dataloaders) - 1)
```

Expand Down
5 changes: 2 additions & 3 deletions deepmd_pt/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
try:
from ._version import version as __version__
except ImportError:
from .__about__ import (
__version__,
)
from .__about__ import __version__ as __version__
1 change: 1 addition & 0 deletions deepmd_pt/entrypoints/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
Loading
Loading