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

clean code #2164

Merged
merged 12 commits into from
Jul 29, 2022
Merged

clean code #2164

merged 12 commits into from
Jul 29, 2022

Conversation

joamatab
Copy link
Contributor

@joamatab joamatab commented Jul 29, 2022

Simplify meep code

  • Replace if statement with if expression (assign-if-exp)
  • Convert for loop into list comprehension (list-comprehension)
  • use fstrings
  • add pre-commit hook
  • format code with black

@joamatab
Copy link
Contributor Author

#2163

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@joamatab joamatab mentioned this pull request Jul 29, 2022
10 tasks
.pre-commit-config.yaml Outdated Show resolved Hide resolved
@stevengj
Copy link
Collaborator

It would be good to figure out how to cleanly rebase existing PRs after this is merged, maybe similar to the instructions in #662.

For example, if you could try rebasing #1951 that would be helpful.

@codecov-commenter
Copy link

codecov-commenter commented Jul 29, 2022

Codecov Report

Merging #2164 (83dc114) into master (5cb0311) will increase coverage by 0.22%.
The diff coverage is 60.78%.

@@            Coverage Diff             @@
##           master    #2164      +/-   ##
==========================================
+ Coverage   73.07%   73.29%   +0.22%     
==========================================
  Files          17       17              
  Lines        4951     4891      -60     
==========================================
- Hits         3618     3585      -33     
+ Misses       1333     1306      -27     
Impacted Files Coverage Δ
python/simulation.py 76.95% <ø> (+0.01%) ⬆️
python/source.py 95.31% <ø> (-0.15%) ⬇️
python/timing_measurements.py 92.50% <ø> (-0.36%) ⬇️
python/verbosity_mgr.py 66.66% <ø> (-7.91%) ⬇️
python/visualization.py 43.40% <ø> (+0.44%) ⬆️
python/adjoint/connectivity.py 10.47% <5.26%> (+0.38%) ⬆️
python/adjoint/basis.py 16.10% <12.00%> (+0.39%) ⬆️
python/adjoint/optimization_problem.py 56.84% <40.81%> (+2.16%) ⬆️
python/adjoint/filters.py 60.86% <60.86%> (+0.30%) ⬆️
python/adjoint/filter_source.py 88.46% <78.57%> (ø)
... and 12 more

@stevengj
Copy link
Collaborator

stevengj commented Jul 29, 2022

CI failure for tests/test_material_grid.py & some other tests … seems to be a failure to import the adjoint module, probably due to import re-ordering.

@stevengj stevengj merged commit b00f2d4 into NanoComp:master Jul 29, 2022
@stevengj
Copy link
Collaborator

Instructions for rebasing other branches after this PR:

Replace MYBRANCH below with the name of your branch:

# update repo
git checkout master && git pull origin master # update master

# switch to your branch
git checkout MYBRANCH

# rebase onto PREVIOUS commit
git rebase c49efbeee91d1de26f86e207d921dfd9fc3680d4

# grab the pre-commit script and install pre-commit
curl https://raw.githubusercontent.com/NanoComp/meep/55f909d11ce671ca762999d5eae55e5c8e9304f2/.pre-commit-config.yaml > .pre-commit-config.yaml
pip3 install pre-commit
pre-commit install

# reformat and rebase to THIS PR's commit
git commit -a -m "reformat"
rm  .pre-commit-config.yaml
git rebase -Xtheirs b00f2d4ce20e683275a4895c8dc8318677a296d1

# finish rebase
git rebase master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants