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

Handle Test warnings #2823

Merged
merged 13 commits into from
Sep 30, 2024
Merged

Conversation

KasukabeDefenceForce
Copy link
Contributor

📝 Description

Type: 🪲 bugfix | 🚀 feature | ☣️ breaking change | 🚦 testing | 📝 documentation | 🎢 infrastructure
This PR aims to remove the warnings shown in the logs after tests are run.

Also, link issues affected by this pull request by using the keywords: close, closes, closed, fix, fixes, fixed, resolve, resolves or resolved.

📌 Resources

Examples, notebooks, and links to useful references.

🚦 Testing

How did you test these changes?

  • Testing pipeline
  • Other method (describe)
  • My changes can't be tested (explain why)

☑️ Checklist

  • I requested two reviewers for this pull request
  • I updated the documentation according to my changes
  • I built the documentation by applying the build_docs label

Note: If you are not allowed to perform any of these actions, ping (@) a contributor.

@tardis-bot
Copy link
Contributor

tardis-bot commented Sep 20, 2024

*beep* *bop*
Hi human,
I ran ruff on the latest commit (c78bf3f).
Here are the outputs produced.
Results can also be downloaded as artifacts here.
Summarised output:

9	UP008 	[*] Use `super()` instead of `super(__class__, self)`
8	G004  	[ ] Logging statement uses f-string
8	I001  	[*] Import block is un-sorted or un-formatted
5	RET505	[ ] Unnecessary `elif` after `return` statement
5	RET506	[ ] Unnecessary `elif` after `raise` statement
5	F401  	[*] `matplotlib.cm` imported but unused
3	D202  	[*] No blank lines allowed after function docstring (found 1)
3	UP004 	[*] Class `ConvergencePlots` inherits from `object`
2	F821  	[ ] Undefined name `basestring`
1	S605  	[ ] Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell`
1	ISC003	[ ] Explicitly concatenated string should be implicitly concatenated
1	PIE808	[*] Unnecessary `start` argument in `range`
1	N812  	[ ] Lowercase `__path__` imported as non-lowercase `TARDIS_PATH`
1	E722  	[ ] Do not use bare `except`
1	E999  	[ ] SyntaxError: Simple statements must be separated by newlines or semicolons
1	D412  	[*] No blank lines allowed between a section header and its content ("Parameters")
1	UP015 	[*] Unnecessary open mode parameters
1	UP034 	[*] Avoid extraneous parentheses

Complete output(might be large):

docs/io/visualization/how_to_generating_widgets.ipynb:cell 5:1:1: I001 [*] Import block is un-sorted or un-formatted
docs/io/visualization/how_to_generating_widgets.ipynb:cell 5:3:5: F401 [*] `tardis.visualization.shell_info_from_hdf` imported but unused
tardis/io/configuration/tests/data/tardis_configv1_verysimple.yml:1:26: E999 SyntaxError: Simple statements must be separated by newlines or semicolons
tardis/io/model/readers/cmfgen.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/io/model/readers/cmfgen.py:4:21: F401 [*] `pathlib.Path` imported but unused
tardis/io/model/readers/cmfgen.py:27:5: D412 [*] No blank lines allowed between a section header and its content ("Parameters")
tardis/io/util.py:18:20: N812 Lowercase `__path__` imported as non-lowercase `TARDIS_PATH`
tardis/io/util.py:62:24: UP004 [*] Class `MockRegexPattern` inherits from `object`
tardis/io/util.py:163:34: F821 Undefined name `basestring`
tardis/io/util.py:191:22: UP004 [*] Class `HDFWriterMixin` inherits from `object`
tardis/io/util.py:193:25: UP008 Use `super()` instead of `super(__class__, self)`
tardis/io/util.py:239:9: RET506 Unnecessary `else` after `raise` statement
tardis/io/util.py:332:21: G004 Logging statement uses f-string
tardis/io/util.py:389:14: UP008 Use `super()` instead of `super(__class__, self)`
tardis/io/util.py:396:5: D202 [*] No blank lines allowed after function docstring (found 1)
tardis/io/util.py:419:13: G004 Logging statement uses f-string
tardis/plasma/properties/helium_nlte.py:53:13: UP034 [*] Avoid extraneous parentheses
tardis/plasma/properties/helium_nlte.py:130:14: UP008 Use `super()` instead of `super(__class__, self)`
tardis/plasma/properties/helium_nlte.py:182:21: E722 Do not use bare `except`
tardis/plasma/properties/helium_nlte.py:185:29: G004 Logging statement uses f-string
tardis/plasma/properties/helium_nlte.py:218:23: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell`
tardis/plasma/properties/helium_nlte.py:235:18: UP015 [*] Unnecessary open mode parameters
tardis/plasma/properties/helium_nlte.py:238:36: PIE808 [*] Unnecessary `start` argument in `range`
tardis/plasma/properties/helium_nlte.py:261:69: F821 Undefined name `s1`
tardis/plasma/properties/ion_population.py:206:14: UP008 Use `super()` instead of `super(__class__, self)`
tardis/plasma/properties/ion_population.py:291:14: UP008 Use `super()` instead of `super(__class__, self)`
tardis/plasma/properties/ion_population.py:370:25: G004 Logging statement uses f-string
tardis/plasma/properties/ion_population.py:424:14: UP008 Use `super()` instead of `super(__class__, self)`
tardis/plasma/properties/ion_population.py:495:25: G004 Logging statement uses f-string
tardis/plasma/properties/level_population.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/plasma/properties/level_population.py:28:14: UP008 Use `super()` instead of `super(__class__, self)`
tardis/plasma/properties/partition_function.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/plasma/properties/partition_function.py:145:9: RET505 Unnecessary `elif` after `return` statement
tardis/plasma/properties/partition_function.py:161:14: UP008 Use `super()` instead of `super(__class__, self)`
tardis/plasma/properties/partition_function.py:181:25: G004 Logging statement uses f-string
tardis/plasma/properties/partition_function.py:192:21: G004 Logging statement uses f-string
tardis/plasma/properties/partition_function.py:199:21: G004 Logging statement uses f-string
tardis/plasma/properties/partition_function.py:252:21: RET506 Unnecessary `else` after `raise` statement
tardis/plasma/properties/partition_function.py:395:21: UP008 Use `super()` instead of `super(__class__, self)`
tardis/spectrum/tests/test_spectrum.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/visualization/tools/convergence_plot.py:3:1: I001 [*] Import block is un-sorted or un-formatted
tardis/visualization/tools/convergence_plot.py:4:25: F401 [*] `matplotlib.cm` imported but unused
tardis/visualization/tools/convergence_plot.py:5:29: F401 [*] `matplotlib.colors` imported but unused
tardis/visualization/tools/convergence_plot.py:39:24: UP004 [*] Class `ConvergencePlots` inherits from `object`
tardis/visualization/tools/convergence_plot.py:321:13: ISC003 Explicitly concatenated string should be implicitly concatenated
tardis/visualization/tools/liv_plot.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/visualization/tools/liv_plot.py:3:25: F401 [*] `matplotlib.cm` imported but unused
tardis/visualization/tools/liv_plot.py:25:9: D202 [*] No blank lines allowed after function docstring (found 1)
tardis/visualization/tools/liv_plot.py:48:9: D202 [*] No blank lines allowed after function docstring (found 1)
tardis/visualization/tools/liv_plot.py:341:13: RET506 Unnecessary `elif` after `raise` statement
tardis/visualization/tools/sdec_plot.py:202:9: RET505 Unnecessary `elif` after `return` statement
tardis/visualization/tools/sdec_plot.py:343:13: RET505 Unnecessary `elif` after `return` statement
tardis/visualization/tools/sdec_plot.py:460:9: RET505 Unnecessary `else` after `return` statement
tardis/visualization/tools/sdec_plot.py:496:9: RET505 Unnecessary `elif` after `return` statement
tardis/visualization/tools/sdec_plot.py:531:13: RET506 Unnecessary `else` after `raise` statement
tardis/visualization/tools/sdec_plot.py:699:13: RET506 Unnecessary `else` after `raise` statement
tardis/visualization/widgets/util.py:3:1: I001 [*] Import block is un-sorted or un-formatted
Found 57 errors.
[*] 23 fixable with the `--fix` option (9 hidden fixes can be enabled with the `--unsafe-fixes` option).

Copy link

codecov bot commented Sep 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.60%. Comparing base (62395d3) to head (c78bf3f).
Report is 8 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2823      +/-   ##
==========================================
- Coverage   70.99%   70.60%   -0.40%     
==========================================
  Files         209      209              
  Lines       15650    15654       +4     
==========================================
- Hits        11111    11052      -59     
- Misses       4539     4602      +63     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@KasukabeDefenceForce KasukabeDefenceForce marked this pull request as ready for review September 24, 2024 07:08
@tardis-bot
Copy link
Contributor

tardis-bot commented Sep 24, 2024

*beep* *bop*
Hi human,
I ran benchmarks as you asked comparing master (62395d3) and the latest commit (c78bf3f).
Here are the logs produced by ASV.
Results can also be downloaded as artifacts here.

Significantly changed benchmarks:

All benchmarks:

Benchmarks that have stayed the same:

| Change   | Before [71aad198] <master>   | After [c78bf3f1]    | Ratio   | Benchmark (Parameter)                                                                                                               |
|----------|------------------------------|---------------------|---------|-------------------------------------------------------------------------------------------------------------------------------------|
|          | 45.3±20μs                    | 63.1±20μs           | ~1.39   | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_scatter                                          |
|          | 491±200ns                    | 541±200ns           | ~1.10   | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_pair_creation_opacity_calculation                                |
|          | 27.6±2μs                     | 19.5±4μs            | ~0.71   | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_last_interaction_tracker_list |
|          | 2.84±0.02ms                  | 3.08±0.02ms         | 1.08    | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('scatter')                                     |
|          | 3.72±0.02ms                  | 3.97±0ms            | 1.07    | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('macroatom')                                   |
|          | 31.7±0.08μs                  | 33.8±0.04μs         | 1.07    | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_tracker_list                  |
|          | 530±100ns                    | 562±100ns           | 1.06    | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_compton_opacity_calculation                                      |
|          | 732±2ns                      | 760±3ns             | 1.04    | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_thomson_scatter                                       |
|          | 63.0±0.2ms                   | 65.1±0.1ms          | 1.03    | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_rpacket_trackers_to_dataframe                  |
|          | 602±200ns                    | 612±100ns           | 1.02    | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_photoabsorption_opacity_calculation                              |
|          | 37.4±0.02s                   | 37.7±0.1s           | 1.01    | run_tardis.BenchmarkRunTardis.time_run_tardis                                                                                       |
|          | 207±0.1ns                    | 209±0.1ns           | 1.01    | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_intensity_black_body                                       |
|          | 2.20±1μs                     | 2.22±2μs            | 1.01    | transport_montecarlo_estimators_radfield_estimator_calcs.BenchmarkMontecarloMontecarloNumbaPacket.time_update_line_estimators       |
|          | 3.35±0.5μs                   | 3.40±0.7μs          | 1.01    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_within_shell                              |
|          | 1.03±0m                      | 1.03±0m             | 1.00    | run_tardis.BenchmarkRunTardis.time_run_tardis_rpacket_tracking                                                                      |
|          | 2.08±0m                      | 2.09±0m             | 1.00    | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_FormalIntegrator_functions                                 |
|          | 64.1±20μs                    | 64.3±20μs           | 1.00    | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_emission                                         |
|          | 7.28±2μs                     | 7.19±2μs            | 0.99    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_volley                                    |
|          | 1.25±0μs                     | 1.20±0μs            | 0.96    | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_boundary                |
|          | 1.77±0.04ms                  | 1.70±0ms            | 0.96    | transport_montecarlo_main_loop.BenchmarkTransportMontecarloMontecarloMainLoop.time_montecarlo_main_loop                             |
|          | 1.64±0.4μs                   | 1.54±0.5μs          | 0.94    | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_line                    |
|          | 6.65±0.7μs                   | 6.22±0.9μs          | 0.94    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket                                           |
|          | 3.25±0.3μs                   | 3.00±0.5μs          | 0.92    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_bad_vpacket                                       |
|          | 2.76±0.5ms                   | 2.53±0.4ms          | 0.91    | transport_montecarlo_single_packet_loop.BenchmarkTransportMontecarloSinglePacketLoop.time_single_packet_loop                        |

If you want to see the graph of the results, you can check it here

@andrewfullard andrewfullard merged commit 4c6780c into tardis-sn:master Sep 30, 2024
31 of 32 checks passed
CePowers pushed a commit to CePowers/tardis that referenced this pull request Oct 1, 2024
* Fixed inplace warnings

* Replace add function with update

* Update  ion_number_density  without using a inplace function

* Fix chained assignment error in partition_function

* Fix chained assignment error in helium_nlte

* Fix chained assignment error in ion_population.py

* Refactor assignment of Helium population updated  values

* Change deprecated delim_whitespace param with sep param

* Fix warning  'path_or_buf' will be keyword-only.

* Replace deprecated  flex_nu with luminosity_to_flux

* Fix get_cmap is deprecated warning

* Fix virtual packet logging to true warning

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

Successfully merging this pull request may close these issues.

4 participants