Skip to content

Fixed several issues in the examples#402

Merged
jwiggins merged 1 commit into
masterfrom
pbrod/examples-cleanup
Nov 30, 2020
Merged

Fixed several issues in the examples#402
jwiggins merged 1 commit into
masterfrom
pbrod/examples-cleanup

Conversation

@jwiggins

Copy link
Copy Markdown
Member

NOTE: This is just the changes to the code in examples/ from #401

  • Python style fixes.
  • Insulated the xxxtrait.configure_traits() calla inside if __name__ == '__main__' blocks
  • Added the demo = XXXtrait() to each demo-script so it can be discovered and run by the traitsui.extra.demo.demo.
  • examples/kiva/agg/benchmark.py (Float -> float, added missing import of zeros)
  • examples/kiva/agg/polygon_hit_test.py (point_in_polygon -> points_in_polygon)
  • examples/kiva/gradient.py (added missing import of tempfile)
  • Moved code in if __name___ == "__main__" block in benchmark.py to the run_all_benchmarks function.
  • Removed unused import of FILL_STROKE in examples/kiva/agg/compiled_path.py
  • Removed unused import of affine, constants in examples/kiva/agg/dummy.py
  • Replaced call to deprecated time.clock with time.perf_counter on Python 3 in:
    • examples/kiva/agg/benchmark.py
    • examples/kiva/agg/dash.py
    • examples/kiva/agg/lion.py
    • examples/kiva/agg/pylygon_hit_test.py
    • examples/kiva/agg/simple_clip.py
    • examples/kiva/agg/text_ex.py
    • examples/kiva/simple.py
    • examples/kiva/test_image3.py

@jwiggins

Copy link
Copy Markdown
Member Author

@pbrod In addition to your changes, I completed the Python style changes in a few places.

Regarding your addition of the two SVG icons in #401, I replaced them with icons of my own creation due to the LGPL license of the icons you added.

@rahulporuri

Copy link
Copy Markdown
Contributor

@jwiggins can you merge master into this branch?

* Python style fixes.
* Insulated the xxxtrait.configure_traits() call inside a
  "if __name__ == '__main__'" block
* Added the "demo = XXXtrait()" to each demo-script so it can be discovered
  and run by the traitsui.extra.demo.demo.
* examples/kiva/agg/benchmark.py (Float -> float, added missing import of
  zeros)
* examples/kiva/agg/polygon_hit_test.py (point_in_polygon -> points_in_polygon)
* examples/kiva/gradient.py (added missing import of tempfile)
* Moved code in 'if __name___ == "__main__"' block in benchmark.py to the
  run_all_benchmarks function.
* Removed unused import of "FILL_STROKE" in examples/kiva/agg/compiled_path.py
* Removed unused import of "affine", "constants" in examples/kiva/agg/dummy.py
* Replaced call to deprecated time.clock with time.perf_counter on Python 3 in:
  * examples/kiva/agg/benchmark.py
  * examples/kiva/agg/dash.py
  * examples/kiva/agg/lion.py
  * examples/kiva/agg/pylygon_hit_test.py
  * examples/kiva/agg/simple_clip.py
  * examples/kiva/agg/text_ex.py
  * examples/kiva/simple.py
  * examples/kiva/test_image3.py
@jwiggins jwiggins force-pushed the pbrod/examples-cleanup branch from f5793f7 to 4efcc5b Compare November 30, 2020 10:15
@codecov-io

Copy link
Copy Markdown

Codecov Report

Merging #402 (f5793f7) into master (fc1df25) will increase coverage by 3.78%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #402      +/-   ##
==========================================
+ Coverage   28.95%   32.73%   +3.78%     
==========================================
  Files         206      206              
  Lines       18252    18297      +45     
  Branches     2466     2470       +4     
==========================================
+ Hits         5284     5990     +706     
+ Misses      12641    11929     -712     
- Partials      327      378      +51     
Impacted Files Coverage Δ
enable/tools/hover_tool.py 37.31% <0.00%> (-35.83%) ⬇️
enable/__init__.py 71.42% <0.00%> (-3.58%) ⬇️
kiva/ps.py 57.07% <0.00%> (-1.39%) ⬇️
enable/container.py 54.22% <0.00%> (-0.95%) ⬇️
enable/testing.py 89.81% <0.00%> (-0.54%) ⬇️
kiva/fonttools/font_manager.py 50.59% <0.00%> (-0.15%) ⬇️
enable/api.py 93.93% <0.00%> (ø)
enable/example_support.py 0.00% <0.00%> (ø)
enable/trait_defs/rgba_color_trait.py 0.00% <0.00%> (ø)
enable/component.py 55.76% <0.00%> (+0.61%) ⬆️
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fc1df25...4efcc5b. Read the comment docs.

@rahulporuri rahulporuri left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This mostly feels like flake8/style changes but i think I also noticed a few genuine issues that were fixed in the examples. Either way, LGTM.

@jwiggins jwiggins merged commit 3be7708 into master Nov 30, 2020
@jwiggins

Copy link
Copy Markdown
Member Author

Thanks for the review

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.

4 participants