Skip to content

Commit b00f2d4

Browse files
authored
clean code (#2164)
* clean code * format code with black * run black and add pre-commit * delete some workflows * remove shellcheck * remove nbstrip * make sure sourcery min python version is 3.7 * include clang formatter in pre-commit * fix import * run ci/cd every day * revert reorder imports from the adjoint module * remove isort from pre-commit
1 parent c49efbe commit b00f2d4

279 files changed

Lines changed: 19760 additions & 20009 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ tests/* linguist-documentation
55
scheme/examples/* linguist-documentation
66
python/numpy.i linguist-vendored
77
src/support/mt19937ar.c linguist-vendored
8-
src/support/meep_mt.h linguist-language=C++
8+
src/support/meep_mt.h linguist-language=C++

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "pip"
4+
directory: "/" # Location of package manifests
5+
schedule:
6+
interval: "daily"
7+
8+
- package-ecosystem: github-actions
9+
directory: /
10+
schedule:
11+
interval: monthly

.github/workflows/build-ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
name: CI
1+
name: run tests
22

33
on:
4-
push:
5-
branches: [ master ]
64
pull_request:
7-
branches: [ master ]
5+
push:
6+
schedule:
7+
- cron: 0 2 * * * # run at 2 AM UTC
88
workflow_dispatch:
99

1010
jobs:

.github/workflows/pre-commit.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
name: pre-commit
3+
4+
on:
5+
pull_request:
6+
push:
7+
8+
jobs:
9+
pre-commit:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
- uses: actions/setup-python@v4
14+
with:
15+
python-version: 3.9
16+
- uses: pre-commit/action@v3.0.0

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
_build
1616
.vscode
1717
.idea
18+
python/examples/.ipynb_checkpoints/
19+
h5utils/
20+
hdf5/
21+
extra/
22+
configure~
1823

1924
# autotools stuff
2025
Makefile

.pre-commit-config.yaml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: "08b4be84be2d74173246b7c9b6c22212a6c15a2d"
4+
hooks:
5+
- id: check-yaml
6+
- id: end-of-file-fixer
7+
- id: trailing-whitespace
8+
9+
# - repo: https://github.com/hakancelik96/unimport
10+
# rev: df8eb1a4c91acb84da197828af8157708968b596
11+
# hooks:
12+
# - id: unimport
13+
# args: [--remove, --include-star-import]
14+
# - repo: https://github.com/pycqa/isort
15+
# rev: "12cc5fbd67eebf92eb2213b03c07b138ae1fb448"
16+
# hooks:
17+
# - id: isort
18+
# files: "python/.*"
19+
# args: ["--profile", "black", "--filter-files"]
20+
21+
- repo: https://github.com/psf/black
22+
rev: "4f1772e2aed8356e57b923eacf45f813ec3324a0"
23+
hooks:
24+
- id: black
25+
26+
# - repo: https://gitlab.com/pycqa/flake8
27+
# rev: "21d3c70d676007470908d39b73f0521d39b3b997"
28+
# hooks:
29+
# - id: flake8
30+
31+
# - repo: https://github.com/kynan/nbstripout
32+
# rev: 8cafdcc393232045208137698dbeb42d6e0dd9e8
33+
# hooks:
34+
# - id: nbstripout
35+
# files: ".ipynb"
36+
37+
- repo: https://github.com/asottile/pyupgrade
38+
rev: v2.37.3
39+
hooks:
40+
- id: pyupgrade
41+
args: [--py37-plus, --keep-runtime-typing]
42+
43+
# - repo: https://github.com/codespell-project/codespell
44+
# rev: 4d782511b3999c243feb3858cd7062270eb13291
45+
# hooks:
46+
# - id: codespell
47+
# args: ["-L TE,TE/TM,te,ba,FPR,fpr_spacing,ro"]
48+
49+
# - repo: https://github.com/shellcheck-py/shellcheck-py
50+
# rev: f87a493c6596a5338d69395905a4e13ed65584f6
51+
# hooks:
52+
# - id: shellcheck
53+
54+
- repo: https://github.com/pre-commit/pygrep-hooks
55+
rev: dc89c436469616a7c48293ec60c8e21e9d95be08 # Use the ref you want to point at
56+
hooks:
57+
- id: python-use-type-annotations
58+
59+
- repo: https://github.com/PyCQA/bandit
60+
rev: 97501817e621db9975dfa6a2a1d36370942d1812
61+
hooks:
62+
- id: bandit
63+
args: [--exit-zero]
64+
# ignore all tests, not just tests data
65+
exclude: ^tests/
66+
- repo: https://github.com/pre-commit/mirrors-clang-format
67+
rev: 'v14.0.6' # Use the sha / tag you want to point at
68+
hooks:
69+
- id: clang-format
70+
# - repo: https://github.com/pre-commit/mirrors-mypy
71+
# rev: "214c33306afe17f1cc7d2d55e4da705b6ebe0627"
72+
# hooks:
73+
# - id: mypy
74+
# exclude: ^(docs/|example-plugin/|tests/fixtures)
75+
# additional_dependencies:
76+
# - "pydantic"
77+
# - repo: https://github.com/terrencepreilly/darglint
78+
# rev: master
79+
# hooks:
80+
# - id: darglint
81+
82+
# - repo: https://github.com/pycqa/pydocstyle
83+
# rev: ""
84+
# hooks:
85+
# - id: pydocstyle
86+
# - repo: https://github.com/asottile/reorder_python_imports
87+
# rev: 2b2f0c74acdb3de316e23ceb7dd0d7945c354050
88+
# hooks:
89+
# - id: reorder-python-imports
90+
# - repo: https://github.com/PyCQA/pylint
91+
# rev: v2.14.1
92+
# hooks:
93+
# - id: pylint
94+
# args: [--exit-zero]
95+
# - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
96+
# rev: 6565d773ca281682d7062d4c0be74538cc474cc9
97+
# hooks:
98+
# - id: pretty-format-java
99+
# args: [--autofix]
100+
# - id: pretty-format-kotlin
101+
# args: [--autofix]
102+
# - id: pretty-format-yaml
103+
# args: [--autofix, --indent, "2"]
104+
# - repo: https://github.com/adrienverge/yamllint.git
105+
# rev: v1.21.0 # or higher tag
106+
# hooks:
107+
# - id: yamllint
108+
# args: [--format, parsable, --strict]
109+
# - repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
110+
# rev: 0.1.0 # or specific tag
111+
# hooks:
112+
# - id: yamlfmt

.sourcery.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
refactor:
2+
python_version: '3.7'

AUTHORS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ Ian Williamson <iwill@google.com>
1717
Andreas Hoenselaar <ahoens@google.com>
1818
Ben Bartlett <benbartlett@stanford.edu>
1919
Krishna Gadepalli <kkg4theweb@gmail.com>
20-
Mo Chen <mochen@mit.edu>
20+
Mo Chen <mochen@mit.edu>

codemeta.json

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"@context": "https://doi.org/10.5063/schema/codemeta-2.0",
33
"@type": "SoftwareSourceCode",
44
"name": "Meep",
5-
"description": "Meep is a free and open-source software package for electromagnetics simulation via the finite-difference time-domain (FDTD) method spanning a broad range of applications.",
5+
"description":
6+
"Meep is a free and open-source software package for electromagnetics simulation via the finite-difference time-domain (FDTD) method spanning a broad range of applications.",
67
"url": "https://github.com/NanoComp/meep",
78
"codeRepository": "https://github.com/NanoComp/meep",
89
"issueTracker": "https://github.com/NanoComp/issues",
@@ -87,8 +88,12 @@
8788
],
8889
"developmentStatus": "active",
8990
"downloadUrl": "https://github.com/NanoComp/releases",
90-
"version":"1.11",
91-
"dateCreated":"2003-02-12",
92-
"datePublished":"2006-04-01",
93-
"programmingLanguage": ["C++", "Python", "Scheme"]
91+
"version": "1.11",
92+
"dateCreated": "2003-02-12",
93+
"datePublished": "2006-04-01",
94+
"programmingLanguage": [
95+
"C++",
96+
"Python",
97+
"Scheme"
98+
]
9499
}

doc/_api_snippets/class_template.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,3 @@ class {class_name}({base_classes}):
1212
{docstring}
1313

1414
</div>
15-

0 commit comments

Comments
 (0)