diff --git a/.clang-format b/.clang-format
index 6cb26099ac515..c2b5257610c10 100644
--- a/.clang-format
+++ b/.clang-format
@@ -20,7 +20,7 @@ AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: false
-BraceWrapping:
+BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
@@ -48,7 +48,7 @@ DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
-IncludeCategories:
+IncludeCategories:
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<.*'
@@ -93,4 +93,3 @@ Standard: Auto
TabWidth: 8
UseTab: Never
...
-
diff --git a/.clang-tidy b/.clang-tidy
index a7e2c53814a47..029282cbb21ba 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -8,4 +8,3 @@ CheckOptions:
- { key: readability-identifier-naming.PublicMethodCase, value: lower_case }
- { key: readability-identifier-naming.PublicMemberSuffix, value: "" }
...
-
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
index 14d19d7bcfe7b..d4675bdea7b29 100644
--- a/.github/ISSUE_TEMPLATE/config.yml
+++ b/.github/ISSUE_TEMPLATE/config.yml
@@ -2,7 +2,7 @@
blank_issues_enabled: true
contact_links:
- name: Contributor Guideline
- url: https://docs.taichi.graphics/lang/articles/contributor_guide
+ url: https://docs.taichi.graphics/lang/articles/contributor_guide
about: Please check this out if you'd like to contribute by opening a PR :)
- name: Taichi Forum
url: https://forum.taichi.graphics
diff --git a/.github/workflows/issue_comment.yml b/.github/workflows/issue_comment.yml
index 5f8f46081f383..5158edc97fa6b 100644
--- a/.github/workflows/issue_comment.yml
+++ b/.github/workflows/issue_comment.yml
@@ -16,7 +16,6 @@ jobs:
issue-type: pull-request
permission: triage
commands: |
- format
benchmark
rebase
rerun
diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml
index 0d26979a24df1..dcc04859d47d9 100644
--- a/.github/workflows/testing.yml
+++ b/.github/workflows/testing.yml
@@ -57,45 +57,6 @@ jobs:
echo "::set-output name=run_job::false"
fi
- check_code_format:
- name: Check Code Format
- runs-on: ubuntu-latest
- needs: check_files
- # This job will be required to pass before merging to master branch.
- steps:
- - uses: actions/checkout@v2
- - name: Set up Python ${{ matrix.python-version }}
- uses: actions/setup-python@v2
- with:
- python-version: 3.9
-
- - name: Setup git & clang-format
- run: |
- git config user.email "taichigardener@gmail.com"
- git config user.name "Taichi Gardener"
- git checkout -b _fake_squash
- git remote add upstream https://github.com/taichi-dev/taichi.git
- git fetch upstream master
- sudo apt install clang-format-10
-
- - name: Cache PIP
- uses: actions/cache@v2
- with:
- path: ~/.cache/pip
- key: ${{ hashFiles('setup.py') }}-${{ hashFiles('requirements_dev.txt') }}
-
- - name: Install requirements
- run: |
- python3 -m pip install --user -r requirements_dev.txt
-
- - name: Check code format
- run: |
- python3 misc/code_format.py
- git checkout -b _enforced_format
- git commit -am "enforce code format" || true
- # exit with 1 if there were differences:
- git diff _fake_squash _enforced_format --exit-code
-
check_static_analyzer:
name: Check Static Analyzer
runs-on: ubuntu-latest
@@ -103,29 +64,7 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
- submodules: "recursive"
-
- - name: Set up Python ${{ matrix.python-version }}
- uses: actions/setup-python@v2
- with:
- python-version: 3.9
-
- - name: Pylint
- run: |
- if [[ ${{needs.check_files.outputs.run_job}} == false ]]; then
- exit 0
- fi
- python3 -m pip install --user pylint
- # Make sure pylint doesn't regress
- pylint python/taichi/ --disable=all --enable=$(python scripts/generate_pylint_tags.py)
- if [ $? -eq 0 ]
- then
- echo "PASSED: pylint is happy"
- exit 0
- else
- echo "FAILED: please run the pylint command above and make sure it passes"
- exit 1
- fi
+ submodules: 'recursive'
- name: clang-tidy
run: |
@@ -145,7 +84,7 @@ jobs:
build_and_test_cpu_linux:
name: Build and Test linux (CPU)
- needs: [check_code_format, check_files]
+ needs: check_files
timeout-minutes: 60
strategy:
matrix:
@@ -153,11 +92,11 @@ jobs:
- os: ubuntu-latest
python: py39
with_cc: ON
- wanted_archs: "cpu,cc"
+ wanted_archs: 'cpu,cc'
- os: ubuntu-latest
python: py310
with_cc: ON
- wanted_archs: "cpu,cc"
+ wanted_archs: 'cpu,cc'
runs-on: ${{ matrix.os }}
permissions:
packages: read
@@ -165,7 +104,7 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
- submodules: "recursive"
+ submodules: 'recursive'
- name: Get sccache cache
uses: actions/cache@v2
@@ -234,7 +173,7 @@ jobs:
build_and_test_cpu_mac:
name: Build and Test macos (CPU)
- needs: [check_code_format, check_files]
+ needs: check_files
timeout-minutes: 60
strategy:
matrix:
@@ -243,12 +182,12 @@ jobs:
python: 3.7
with_cc: OFF
with_cpp_tests: ON
- wanted_archs: "cpu"
+ wanted_archs: 'cpu'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
- submodules: "recursive"
+ submodules: 'recursive'
- uses: actions/setup-python@v2
with:
@@ -302,13 +241,13 @@ jobs:
build_and_test_gpu_linux:
name: Build and Test (GPU)
- needs: [check_code_format, check_files]
+ needs: check_files
runs-on: [self-hosted, cuda, vulkan, cn]
timeout-minutes: 60
steps:
- uses: actions/checkout@v2
with:
- submodules: "recursive"
+ submodules: 'recursive'
- name: Get sccache cache
uses: actions/cache@v2
@@ -364,7 +303,7 @@ jobs:
PY: py38
GPU_TEST: ON
DISPLAY: :1
- TI_WANTED_ARCHS: "cpu,cuda,vulkan,opengl"
+ TI_WANTED_ARCHS: 'cpu,cuda,vulkan,opengl'
TI_DEVICE_MEMORY_GB: '0.7'
- name: clean docker container
@@ -374,7 +313,7 @@ jobs:
build_and_test_windows:
name: Build and Test Windows
- needs: [check_code_format, check_files]
+ needs: check_files
runs-on: [self-hosted, windows, gpu]
timeout-minutes: 90
steps:
@@ -386,7 +325,7 @@ jobs:
- uses: actions/checkout@v2
with:
- submodules: "recursive"
+ submodules: 'recursive'
- uses: actions/setup-python@v2
with:
@@ -421,12 +360,12 @@ jobs:
TAICHI_CMAKE_ARGS: -DTI_WITH_OPENGL:BOOL=ON -DTI_WITH_CC:BOOL=OFF
TI_SKIP_VERSION_CHECK: ON
TI_CI: 1
- PYTHON: "3.7"
+ PYTHON: '3.7'
TI_DEVICE_MEMORY_GB: '0.7'
build_and_test_m1:
name: Build and Test (Apple M1)
- needs: [check_code_format, check_files]
+ needs: check_files
timeout-minutes: 60
strategy:
matrix:
@@ -436,12 +375,12 @@ jobs:
defaults:
run:
# https://github.com/actions/runner/issues/805#issuecomment-844426478
- shell: "/usr/bin/arch -arch arm64e /bin/bash --noprofile --norc -eo pipefail {0}"
+ shell: '/usr/bin/arch -arch arm64e /bin/bash --noprofile --norc -eo pipefail {0}'
runs-on: [self-hosted, m1]
steps:
- uses: actions/checkout@v2
with:
- submodules: "recursive"
+ submodules: 'recursive'
- name: Get sccache cache
uses: actions/cache@v2
@@ -472,7 +411,7 @@ jobs:
export PATH=/Users/github/miniforge3/envs/$PY/bin:$PATH
.github/workflows/scripts/unix_test.sh
env:
- TI_WANTED_ARCHS: "metal,vulkan,cpu"
+ TI_WANTED_ARCHS: 'metal,vulkan,cpu'
PY: ${{ matrix.python }}
- PLATFORM: "m1"
+ PLATFORM: 'm1'
TI_CI: 1
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000000000..358e2afc8057c
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,33 @@
+ci:
+ autoupdate_schedule: quarterly
+
+exclude: ^((tests/python/test_exception|.*/examples/.*)\.py$|external/)
+repos:
+ - repo: https://github.com/google/yapf
+ rev: v0.31.0
+ hooks:
+ - id: yapf
+ additional_dependencies: [toml]
+
+ - repo: https://github.com/timothycrosley/isort
+ rev: 5.10.1
+ hooks:
+ - id: isort
+
+ - repo: https://github.com/pre-commit/mirrors-clang-format
+ rev: v10.0.1
+ hooks:
+ - id: clang-format
+
+ - repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v4.0.1
+ hooks:
+ - id: trailing-whitespace
+ - id: end-of-file-fixer
+
+ - repo: https://github.com/PyCQA/pylint
+ rev: v2.13.1
+ hooks:
+ - id: pylint
+ args: ['-rn', '-sn']
+ files: ^python/taichi/
diff --git a/.pylintrc b/.pylintrc
index 8428f0f15e5b5..c1dafe27842a8 100644
--- a/.pylintrc
+++ b/.pylintrc
@@ -1,2 +1,7 @@
[MESSAGES CONTROL]
-disable=invalid-name, missing-function-docstring, missing-class-docstring, missing-module-docstring, unused-wildcard-import, cyclic-import, blacklisted-name, import-outside-toplevel
+disable=all
+enable=
+ C0121,C0200,C0209,C0321,C0325,C0415,
+ W0101,W0108,W0202,W0235,W0401,W0404,W0611,W0621,W0622,W612,W1309,
+ E1101,
+ R0201,R0205,R0402,R1703,R1705,R1710,R1732
diff --git a/ci/scripts/release_test.sh b/ci/scripts/release_test.sh
index 5a2e294e79e00..8122383e3dfae 100644
--- a/ci/scripts/release_test.sh
+++ b/ci/scripts/release_test.sh
@@ -89,7 +89,7 @@ function taichi::test::ggui {
# divider
taichi::utils::line
taichi::utils::logger::info "Running GGUI examples"
-
+
# clone the repo
taichi::utils::git_clone "${ORG}" "${REPO}"
cd "${REPO}/python/taichi/examples/ggui_examples"
@@ -114,7 +114,7 @@ function taichi::test::difftaichi {
# divider
taichi::utils::line
taichi::utils::logger::info "Running DiffTaichi examples"
-
+
# clone the repo
taichi::utils::git_clone "${ORG}" "${REPO}"
cd "${REPO}/examples"
@@ -139,7 +139,7 @@ function taichi::test::taichi_elements {
# divider
taichi::utils::line
taichi::utils::logger::info "Running Taichi Elements examples"
-
+
# clone the repo
taichi::utils::git_clone "${ORG}" "${REPO}"
cd "${REPO}"
@@ -148,7 +148,7 @@ function taichi::test::taichi_elements {
python "download_ply.py"
# run tests
- cd "${REPO}/demo"
+ cd "${REPO}/demo"
for match in $(find ./ -name "${PATTERN}"); do
python "${match}"
taichi::utils::line
@@ -179,7 +179,7 @@ function taichi::test::stannum {
# divider
taichi::utils::line
taichi::utils::logger::info "Running Stannum examples"
-
+
# clone the repo
taichi::utils::git_clone "${ORG}" "${REPO}"
cd "${REPO}"
@@ -199,7 +199,7 @@ function taichi::test::sandyfluid {
# divider
taichi::utils::line
taichi::utils::logger::info "Running SandyFluid examples"
-
+
# clone the repo
taichi::utils::git_clone "${ORG}" "${REPO}"
cd "${REPO}"
@@ -224,7 +224,7 @@ function taichi::test::voxel_editor {
# divider
taichi::utils::line
taichi::utils::logger::info "Running Voxel Editor examples"
-
+
# clone the repo
taichi::utils::git_clone "${ORG}" "${REPO}"
cd "${REPO}"
@@ -245,7 +245,7 @@ function taichi::test::generate_videos {
# divider
taichi::utils::line
taichi::utils::logger::info "Generating examples videos"
-
+
# clone the repo
taichi::utils::git_clone "${ORG}" "${REPO}"
# mkdir "${REPO}/misc/output_videos"
@@ -282,7 +282,7 @@ function taichi::test::main {
# ggui examples
taichi::test::ggui "${WORKDIR}"
-
+
# difftaichi examples
taichi::test::difftaichi "${WORKDIR}"
@@ -292,10 +292,10 @@ function taichi::test::main {
# stannum tests
taichi::test::stannum "${WORKDIR}"
- # sandyfluid tests
+ # sandyfluid tests
taichi::test::sandyfluid "${WORKDIR}"
- # voxel editor tests
+ # voxel editor tests
taichi::test::voxel_editor "${WORKDIR}"
# generating example videos
diff --git a/docs/lang/articles/contribution/contributor_guide.md b/docs/lang/articles/contribution/contributor_guide.md
index 8f2599cf1f5f4..933f826ced42c 100644
--- a/docs/lang/articles/contribution/contributor_guide.md
+++ b/docs/lang/articles/contribution/contributor_guide.md
@@ -102,41 +102,38 @@ We highly recommend that you complete code style checks and integration tests on
### Enforce code style
-1. Ensure that you have installed `clang-format-10`.
-2. Ensure that you have installed `yapf v0.31.0`.
-3. Re-format your code style:
+Taichi enfoces code style via [pre-commit](https://pre-commit.com/) hooks, which includes the following checks:
+
+1. C++ codes are formatted by `clang-format-10`.
+2. Python codes are formatted by `yapf v0.31.0` based on PEP 8 rules.
+3. Python codes are statically checked by [`pylint`](https://pylint.org/).
+
+You will need to install `pre-commit` first:
```
-python misc/code_format.py
+pip install pre-commit
```
-
- How to install clang-format-10 on M1 Mac
-1. Download and extract [Clang + LLVM 10.0.0 pre-built binary for macOS](https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/clang+llvm-10.0.0-x86_64-apple-darwin.tar.xz)
+and run the code checkers:
-2. Copy the `clang-format` binary to `~/.local/bin` and add `~/.local/bin` to `PATH`
-
-```shell
-mkdir -p ~/.local/bin
-cp clang+llvm-10.0.0-x86_64-apple-darwin/bin/clang-format ~/.local/bin/clang-format-10
-echo "export PATH=$HOME/.local/bin:\$PATH" >> ~/.zshrc
-source ~/.zshrc
+```
+pre-commit run -a
```
-Please refer to [this](./dev_install#llvm-as-cannot-be-opened-on-macos) if you get an error message like `clang-format-10 can’t be opened because Apple cannot check it for malicious software on macOS`.
-
-
+With this command, `yapf` will format your Python codes automatically.
+You can install it as a pre-commit hook so that it is run before you commit the changes to git:
+```
+pre-commit install
+```
What if I didn't format my code style locally?
-1. Have your reviewer leave a comment `/format` in your PR to enable GitHub Actions. See [#2481](https://github.com/taichi-dev/taichi/pull/2481).
- *[Taichi Gardener](https://github.com/taichi-gardener)* *automatically pushes a commit to your branch to format your code.*
-
-2. If you wish to submit more changes after someone leaves the `/format` comment, ensure that your branch is up to date with your remote counterpart.
+No problem, the CI bot will run the code checkers and format your codes automatically when you submit a PR.
+
> For more style information for your C++ code, see [our C++ style](./cpp_style).
diff --git a/misc/.style.yapf b/misc/.style.yapf
deleted file mode 100644
index 557fa7bf84c08..0000000000000
--- a/misc/.style.yapf
+++ /dev/null
@@ -1,2 +0,0 @@
-[style]
-based_on_style = pep8
diff --git a/misc/code_format.py b/misc/code_format.py
deleted file mode 100644
index a7259bd9c297f..0000000000000
--- a/misc/code_format.py
+++ /dev/null
@@ -1,165 +0,0 @@
-#!/usr/bin/python3
-
-import os
-import re
-import subprocess as sp
-import sys
-from pathlib import Path
-
-from colorama import Back, Fore, Style
-from git import Repo
-from yapf.yapflib.yapf_api import FormatFile
-
-_has_isort = False
-try:
- import isort
- _has_isort = True
-except ImportError:
- # TODO(#2223): Make `isort` a required package in a future release
- print('Please install `isort` or the formatter may not work')
-
-repo_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
-_yapf_config_path = os.path.join(repo_dir, 'misc', '.style.yapf')
-
-
-def has_suffix(f, suffixes):
- for suf in suffixes:
- if f.endswith('.' + suf):
- return True
- return False
-
-
-def format_plain_text(fn):
- formatted = ''
- with open(fn, 'r') as f:
- for l in f:
- l = l.rstrip()
- formatted += l + '\n'
- while len(formatted) and formatted[-1] == '\n':
- formatted = formatted[:-1]
- formatted += '\n'
- with open(fn, 'w') as f:
- f.write(formatted)
-
-
-def find_clang_format_bin():
- try:
- return find_clang_format_bin.clang_format_bin
- except AttributeError:
- pass
-
- candidates = ['clang-format-10', 'clang-format']
- result = None
-
- for c in candidates:
- try:
- if sp.run([c, '--version'], stdout=sp.DEVNULL,
- stderr=sp.DEVNULL).returncode == 0:
- result = c
- break
- except:
- pass
- if result is None:
- print(Fore.YELLOW +
- 'Did not find any clang-format executable, skipping C++ files',
- file=sys.stderr)
- else:
- print('C++ formatter: {}{}'.format(Fore.GREEN, result))
- print(Style.RESET_ALL)
- find_clang_format_bin.clang_format_bin = result
- return result
-
-
-def format_py_file(filename):
- FormatFile(filename, in_place=True, style_config=_yapf_config_path)
- if _has_isort:
- isort.file(filename)
- format_plain_text(filename)
-
-
-def main(all=False, diff=None):
- repo = Repo(repo_dir)
-
- if all:
- directories = [
- 'taichi',
- 'tests',
- 'examples',
- 'misc',
- 'python',
- 'benchmarks',
- 'docs',
- 'cmake',
- ]
- files = list(Path(repo_dir).glob(
- '*')) # Include all files under the root folder
- for d in directories:
- files += list(Path(os.path.join(repo_dir, d)).rglob('*'))
- else:
- if diff is None:
-
- def find_diff_or_empty(s):
- try:
- return repo.index.diff(s)
- except:
- return []
-
- # TODO(#628): Have a way to customize the repo names, in order to
- # support noncanonical namings.
- #
- # Finds all modified files from upstream/master to working tree
- # 1. diffs between the index and upstream/master. Also inclulde
- # origin/master for repo owners.
- files = find_diff_or_empty('upstream/master')
- files += find_diff_or_empty('origin/master')
- # 2. diffs between the index and the working tree
- # https://gitpython.readthedocs.io/en/stable/tutorial.html#obtaining-diff-information
- files += repo.index.diff(None)
- else:
- files = repo.index.diff(diff)
- files = list(map(lambda x: os.path.join(repo_dir, x.a_path), files))
-
- files = sorted(set(map(str, files)))
- print('Code formatting ...')
- for fn in files:
- if not os.path.exists(fn):
- continue
- if os.path.isdir(fn):
- continue
- if fn.find('.pytest_cache') != -1:
- continue
- if fn.find('docs/build/') != -1:
- continue
- if fn.find(os.path.join('tests', 'python', 'test_exception.py')) != -1:
- continue
- if re.match(r'.*examples\/[a-z_]+\d\d+\.py$', fn):
- print(f'Skipping example file "{fn}"...')
- continue
- if not format_file(fn):
- print(f'Skipping "{fn}"...')
-
- print('Formatting done!')
-
-
-def format_file(fn):
- clang_format_bin = find_clang_format_bin()
- print('Formatting "{}"'.format(fn))
- if fn.endswith('.py'):
- format_py_file(fn)
- return True
- elif clang_format_bin and has_suffix(fn, ['cpp', 'h', 'c', 'cu', 'cuh']):
- os.system('{} -i -style=file {}'.format(clang_format_bin, fn))
- format_plain_text(fn)
- return True
- elif has_suffix(fn, [
- 'txt', 'md', 'rst', 'cfg', 'ini', 'map', 'cmake'
- ]) or (os.path.basename(fn)[0].isupper()
- and fn.endswith('file')): # E.g., Dockerfile and Jenkinsfile
- format_plain_text(fn)
- return True
- else:
- return False
-
-
-if __name__ == '__main__':
- main()
diff --git a/netlify.toml b/netlify.toml
index d5c51c2b39cee..02de37e049ec1 100644
--- a/netlify.toml
+++ b/netlify.toml
@@ -4,4 +4,3 @@
publish = "docs.taichi.graphics/website/build"
# Cancel the build if there're no changes detected in docs/ folder.
ignore = "git remote add upstream https://github.com/taichi-dev/taichi.git; git fetch upstream master; git diff --quiet $COMMIT_REF upstream/master -- docs/ python/"
-
diff --git a/pyproject.toml b/pyproject.toml
index 6e8fe53a5dbf6..5d988dda35637 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -9,3 +9,6 @@ filterwarnings = [
"ignore:Operator \"is\" in Taichi scope is deprecated",
"ignore:Operator \"is not\" in Taichi scope is deprecated"
]
+
+[tool.yapf]
+based_on_style = "pep8"
diff --git a/python/taichi/_lib/core/__init__.py b/python/taichi/_lib/core/__init__.py
index 8b137891791fe..e69de29bb2d1d 100644
--- a/python/taichi/_lib/core/__init__.py
+++ b/python/taichi/_lib/core/__init__.py
@@ -1 +0,0 @@
-
diff --git a/python/taichi/_main.py b/python/taichi/_main.py
index d64ccc3b57801..51ee384da02e9 100644
--- a/python/taichi/_main.py
+++ b/python/taichi/_main.py
@@ -536,13 +536,13 @@ def doc(arguments: list = sys.argv[2:]):
@register
def format(arguments: list = sys.argv[2:]):
"""Reformat modified source files"""
- raise RuntimeError('Please run python misc/code_format.py instead')
+ raise RuntimeError('Please run `pre-commit run -a` instead')
@staticmethod
@register
def format_all(arguments: list = sys.argv[2:]):
"""Reformat all source files"""
- raise RuntimeError('Please run python misc/code_format.py instead')
+ raise RuntimeError('Please run `pre-commit run -a` instead')
@staticmethod
def _display_benchmark_regression(xd, yd, args):
diff --git a/requirements_dev.txt b/requirements_dev.txt
index 186cc4ae62149..89737bf90b830 100644
--- a/requirements_dev.txt
+++ b/requirements_dev.txt
@@ -13,3 +13,4 @@ requests==2.26
twine
wheel
astunparse
+pre-commit
diff --git a/scripts/generate_pylint_tags.py b/scripts/generate_pylint_tags.py
deleted file mode 100644
index 5413cc7ff3797..0000000000000
--- a/scripts/generate_pylint_tags.py
+++ /dev/null
@@ -1,31 +0,0 @@
-TAGS = {
- 'C0121': True,
- 'C0415': True,
- 'W0611': True,
- 'W0202': True,
- 'W0621': True,
- 'W0622': True,
- 'W0401': True,
- 'C0209': True,
- 'W0404': True,
- 'W0612': True,
- 'E1101': True,
- 'R0402': True,
- 'R0201': True,
- 'W0235': True,
- 'R1705': True,
- 'C0200': True,
- 'R0205': True,
- 'R1732': True,
- 'W0101': True,
- 'R1710': True,
- 'R1703': True,
- 'W0108': True,
- 'W1309': True,
- 'C0321': True,
- 'C0325': True,
-}
-
-if __name__ == '__main__':
- enabled = [kv[0] for kv in TAGS.items() if kv[1]]
- print(','.join(enabled))
diff --git a/tests/__init__.py b/tests/__init__.py
index 8b137891791fe..e69de29bb2d1d 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -1 +0,0 @@
-
diff --git a/tests/python/__init__.py b/tests/python/__init__.py
index 8b137891791fe..e69de29bb2d1d 100644
--- a/tests/python/__init__.py
+++ b/tests/python/__init__.py
@@ -1 +0,0 @@
-
diff --git a/tests/python/ell.json b/tests/python/ell.json
index e1e56018920f0..b012b9c41b5ed 100644
--- a/tests/python/ell.json
+++ b/tests/python/ell.json
@@ -1,6 +1,6 @@
{
"num_patches" : 8,
- "elements" : [
+ "elements" : [
{"order" : 0,
"num" : 20,
"max_num_per_patch" : 32,
@@ -37,8 +37,8 @@
"g2r_mapping" : [0,16,1,7,2,3,8,9,10,12,4,5,6,21,18,11,17,13,19,22,14,15,20,23],
"l2r_mapping" : [0,1,2,3,18,10,8,7,4,17,19,11,5,16,6,20,22,9,14,23,21,15,13,12,4,5,6,2,8,1,7,3,16,0,17,18,10,19,11,20,22,9,14,23,21,15,13,12,7,8,16,1,3,5,17,2,0,6,18,4,10,19,11,20,22,9,14,23,21,15,13,12,9,10,11,0,21,19,3,18,22,20,1,7,17,23,14,2,8,16,13,15,4,5,12,6,12,13,14,15,23,20,22,19,21,10,18,9,0,11,17,3,16,1,7,2,8,4,5,6,16,17,7,18,8,3,0,19,1,5,10,20,22,2,6,11,14,23,21,4,9,15,13,12,18,19,20,0,10,17,22,14,23,3,11,16,21,15,13,1,7,9,12,2,8,4,5,6,21,22,23,9,13,19,20,11,12,10,18,14,15,0,17,3,16,1,7,2,8,4,5,6]
}
- ],
- "relations" : [
+ ],
+ "relations" : [
{"from_order" : 0,
"to_order" : 0,
"offset" : [0,0,4,8,12,12,20,27,27,35,39,39,43,47,51,51,55,61,61,68,79,79,87,91,101,107,115,122],
@@ -113,8 +113,8 @@
"offset" : [0,0,2,4,6,6,14,20,20,26,28,28,30,32,34,34,36,40,40,46,58,58,66,68,78,82,90,96],
"value" : [0,2,3,0,1,2,3,0,7,4,1,11,5,9,3,7,1,11,5,9,3,10,15,6,1,2,0,2,0,3,2,3,0,1,0,1,0,2,4,9,3,11,16,9,0,5,3,11,15,16,9,20,4,0,5,1,7,2,13,3,9,0,10,7,5,1,3,0,8,10,14,4,5,1,11,12,6,2,0,4,1,2,3,9,0,7,5,1,6,2,8,4,11,12,6,2]
}
- ],
+ ],
"attrs" : {
- "x" : [
+ "x" : [
0,0,0,1,0,0,2,0,0,0,1,0,1,1,0,2,1,0,0,2,0,1,2,0,0,0,1,1,0,1,2,0,1,0,1,1,1,1,1,2,1,1,0,2,1,1,2,1,0,1,3,1,1,3,0,2,3,1,2,3 ]}
-}
\ No newline at end of file
+}
diff --git a/tests/python/test_sparse_linear_solver.py b/tests/python/test_sparse_linear_solver.py
index a3a2a30573b8a..441e12cd7c697 100644
--- a/tests/python/test_sparse_linear_solver.py
+++ b/tests/python/test_sparse_linear_solver.py
@@ -12,7 +12,8 @@
Aarray = U * A * U';
b = [1,2,3,4]';
res = inv(A) * b;
-"""
+""" # yapf: disable
+
Aarray = np.array([[
2.73999501130921, 0.518002544441220, 0.745119303009342, 0.0508907745638859
], [0.518002544441220, 1.45111665837647, 0.757997555750432, 0.290885785873098],