Skip to content

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
@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

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 60.78947% with 149 lines in your changes missing coverage. Please review.

Project coverage is 73.29%. Comparing base (5cb0311) to head (83dc114).
Report is 249 commits behind head on master.

Files with missing lines Patch % Lines
python/adjoint/connectivity.py 5.26% 54 Missing ⚠️
python/adjoint/optimization_problem.py 40.81% 29 Missing ⚠️
python/adjoint/basis.py 12.00% 22 Missing ⚠️
python/adjoint/filters.py 60.86% 18 Missing ⚠️
python/geom.py 84.90% 16 Missing ⚠️
python/adjoint/filter_source.py 78.57% 3 Missing ⚠️
python/binary_partition_utils.py 84.21% 3 Missing ⚠️
python/adjoint/objective.py 92.30% 2 Missing ⚠️
python/adjoint/utils.py 94.11% 1 Missing ⚠️
python/chunk_balancer.py 91.66% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            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     
Files with missing lines Coverage Δ
python/adjoint/__init__.py 83.33% <100.00%> (ø)
python/adjoint/wrapper.py 98.46% <100.00%> (-0.03%) ⬇️
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/utils.py 81.39% <94.11%> (-0.63%) ⬇️
python/chunk_balancer.py 89.02% <91.66%> (ø)
python/adjoint/objective.py 93.00% <92.30%> (ø)
... and 7 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@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