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

Ruff tardis/transport #2829

Merged
merged 4 commits into from
Sep 25, 2024
Merged

Conversation

atharva-2001
Copy link
Member

📝 Description

Type: 🪲 bugfix | 🚀 feature | ☣️ breaking change | 🚦 testing | 📝 documentation | 🎢 infrastructure

Write a complete description of your changes, including the necessary context or any piece of information required to understand your work.

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 24, 2024

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

32	I001   	[*] Import block is un-sorted or un-formatted
30	F401   	[*] `astropy.units` imported but unused
24	D202   	[*] No blank lines allowed after function docstring (found 1)
15	G004   	[ ] Logging statement uses f-string
15	F821   	[ ] Undefined name `basestring`
12	INP001 	[ ] File `tardis/analysis/opacities.py` is part of an implicit namespace package. Add an `__init__.py`.
8	UP015  	[*] Unnecessary open mode parameters
7	RET505 	[ ] Unnecessary `elif` after `return` statement
7	E402   	[ ] Module level import not at top of file
7	W291   	[*] Trailing whitespace
6	UP008  	[*] Use `super()` instead of `super(__class__, self)`
6	UP031  	[*] Use format specifiers instead of percent format
5	UP004  	[*] Class `FilterLog` inherits from `object`
4	PLR1711	[*] Useless `return` statement at end of function
3	C408   	[*] Unnecessary `dict` call (rewrite as a literal)
3	E712   	[*] Avoid equality comparisons to `True`; use `if specific_log_level:` for truth checks
3	D209   	[*] Multi-line docstring closing quotes should be on a separate line
3	D412   	[*] No blank lines allowed between a section header and its content ("Parameters")
3	F811   	[*] Redefinition of unused `Path` from line 1
3	UP024  	[*] Replace aliased errors with `OSError`
3	UP032  	[*] Use f-string instead of `format` call
2	C403   	[*] Unnecessary `list` comprehension (rewrite as a `set` comprehension)
2	PT013  	[ ] Incorrect import of `pytest`; use `import pytest` instead
2	N812   	[ ] Lowercase `__path__` imported as non-lowercase `TARDIS_PATH`
1	ANN204 	[ ] Missing return type annotation for special method `__getitem__`
1	B017   	[ ] `pytest.raises(Exception)` should be considered evil
1	B018   	[ ] Found useless expression. Either assign it to a variable or remove it.
1	C405   	[*] Unnecessary `list` literal (rewrite as a `set` literal)
1	C414   	[*] Unnecessary `list` call within `set()`
1	FA100  	[ ] Add `from __future__ import annotations` to simplify `typing.Tuple`
1	G001   	[ ] Logging statement uses `str.format`
1	PIE790 	[*] Unnecessary `pass` statement
1	PT021  	[ ] Use `yield` instead of `request.addfinalizer`
1	RET506 	[ ] Unnecessary `else` after `raise` statement
1	RET508 	[ ] Unnecessary `else` after `break` statement
1	SIM210 	[*] Remove unnecessary `True if ... else False`
1	PTH117 	[ ] `os.path.isabs()` should be replaced by `Path.is_absolute()`
1	FLY002 	[*] Consider `"\n---\n"` instead of string join
1	NPY201 	[ ] `np.recfromtxt` will be removed in NumPy 2.0. Use `np.genfromtxt` instead.
1	N999   	[ ] Invalid module name: 'test_HDFWriter'
1	E401   	[*] Multiple imports on one line
1	E713   	[*] Test for membership should be `not in`
1	E722   	[ ] Do not use bare `except`
1	F403   	[ ] `from tardis.grid.base import *` used; unable to detect undefined names
1	UP028  	[*] Replace `yield` over `for` loop with `yield from`
1	UP030  	[*] Use implicit references for positional format fields

Complete output(might be large):

tardis/analysis/opacities.py:1:1: INP001 File `tardis/analysis/opacities.py` is part of an implicit namespace package. Add an `__init__.py`.
tardis/analysis/opacities.py:1:1: D209 [*] Multi-line docstring closing quotes should be on a separate line
tardis/analysis/opacities.py:3:1: I001 [*] Import block is un-sorted or un-formatted
tardis/analysis/opacities.py:12:26: UP004 [*] Class `opacity_calculator` inherits from `object`
tardis/analysis/opacities.py:225:9: D209 [*] Multi-line docstring closing quotes should be on a separate line
tardis/analysis/opacities.py:274:9: D209 [*] Multi-line docstring closing quotes should be on a separate line
tardis/analysis/opacities.py:282:9: D202 [*] No blank lines allowed after function docstring (found 1)
tardis/analysis/opacities.py:329:9: D202 [*] No blank lines allowed after function docstring (found 1)
tardis/analysis/opacities.py:360:9: D202 [*] No blank lines allowed after function docstring (found 1)
tardis/analysis/opacities.py:388:9: D202 [*] No blank lines allowed after function docstring (found 1)
tardis/grid/__init__.py:2:41: W291 Trailing whitespace
tardis/grid/__init__.py:3:37: W291 Trailing whitespace
tardis/grid/__init__.py:7:1: F403 `from tardis.grid.base import *` used; unable to detect undefined names
tardis/grid/base.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/grid/base.py:7:33: F401 [*] `tardis.io.atom_data.AtomData` imported but unused
tardis/grid/base.py:33:5: PLR1711 [*] Useless `return` statement at end of function
tardis/grid/base.py:70:9: PLR1711 [*] Useless `return` statement at end of function
tardis/grid/base.py:147:9: PLR1711 [*] Useless `return` statement at end of function
tardis/grid/tests/test_grid.py:1:1: INP001 File `tardis/grid/tests/test_grid.py` is part of an implicit namespace package. Add an `__init__.py`.
tardis/grid/tests/test_grid.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/grid/tests/test_grid.py:8:21: F811 [*] Redefinition of unused `Path` from line 1
tardis/io/atom_data/__init__.py:2:38: W291 Trailing whitespace
tardis/io/atom_data/__init__.py:5:1: I001 [*] Import block is un-sorted or un-formatted
tardis/io/atom_data/__init__.py:5:38: F401 `tardis.io.atom_data.base.AtomData` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
tardis/io/atom_data/__init__.py:6:51: F401 `tardis.io.atom_data.atom_web_download.download_atom_data` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
tardis/io/atom_data/base.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/io/atom_data/base.py:198:34: G004 Logging statement uses f-string
tardis/io/atom_data/base.py:263:17: G004 Logging statement uses f-string
tardis/io/atom_data/base.py:267:21: UP030 Use implicit references for positional format fields
tardis/io/atom_data/base.py:267:21: G001 Logging statement uses `str.format`
tardis/io/atom_data/base.py:704:17: G004 Logging statement uses f-string
tardis/io/atom_data/util.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/io/atom_data/util.py:8:5: F401 [*] `tardis.io.atom_data.atom_web_download.download_atom_data` imported but unused
tardis/io/atom_data/util.py:15:5: D202 [*] No blank lines allowed after function docstring (found 1)
tardis/io/atom_data/util.py:37:13: G004 Logging statement uses f-string
tardis/io/atom_data/util.py:44:15: UP024 [*] Replace aliased errors with `OSError`
tardis/io/atom_data/util.py:50:11: UP024 [*] Replace aliased errors with `OSError`
tardis/io/configuration/config_internal.py:1:1: E401 [*] Multiple imports on one line
tardis/io/configuration/config_internal.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/io/configuration/config_internal.py:6:20: N812 Lowercase `__path__` imported as non-lowercase `TARDIS_PATH`
tardis/io/configuration/config_internal.py:23:13: G004 Logging statement uses f-string
tardis/io/configuration/config_internal.py:36:13: G004 Logging statement uses f-string
tardis/io/configuration/config_internal.py:49:15: UP024 [*] Replace aliased errors with `OSError`
tardis/io/configuration/config_reader.py:53:29: G004 Logging statement uses f-string
tardis/io/configuration/config_reader.py:88:21: C408 Unnecessary `dict` call (rewrite as a literal)
tardis/io/configuration/config_reader.py:112:21: UP008 Use `super()` instead of `super(__class__, self)`
tardis/io/configuration/config_reader.py:117:9: RET505 Unnecessary `else` after `return` statement
tardis/io/configuration/config_reader.py:118:18: UP008 Use `super()` instead of `super(__class__, self)`
tardis/io/configuration/config_reader.py:141:13: RET505 Unnecessary `else` after `return` statement
tardis/io/configuration/config_reader.py:218:29: G004 Logging statement uses f-string
tardis/io/configuration/config_reader.py:450:14: UP008 Use `super()` instead of `super(__class__, self)`
tardis/io/configuration/config_validator.py:43:9: UP028 Replace `yield` over `for` loop with `yield from`
tardis/io/configuration/tests/test_config_reader.py:1:1: INP001 File `tardis/io/configuration/tests/test_config_reader.py` is part of an implicit namespace package. Add an `__init__.py`.
tardis/io/configuration/tests/test_config_reader.py:2:1: I001 [*] Import block is un-sorted or un-formatted
tardis/io/configuration/tests/test_config_reader.py:2:8: F401 [*] `os` imported but unused
tardis/io/configuration/tests/test_config_reader.py:3:18: F401 [*] `attr.validate` imported but unused
tardis/io/configuration/tests/test_configuration_namespace.py:1:1: INP001 File `tardis/io/configuration/tests/test_configuration_namespace.py` is part of an implicit namespace package. Add an `__init__.py`.
tardis/io/configuration/tests/test_configuration_namespace.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/io/logger/__init__.py:2:29: W291 Trailing whitespace
tardis/io/logger/colored_logger.py:83:9: PLR1711 [*] Useless `return` statement at end of function
tardis/io/logger/logger.py:4:63: F401 [*] `tardis.io.logger.colored_logger.formatter_message` imported but unused
tardis/io/logger/logger.py:28:17: UP004 [*] Class `FilterLog` inherits from `object`
tardis/io/logger/logger.py:66:5: D202 [*] No blank lines allowed after function docstring (found 1)
tardis/io/logger/logger.py:118:12: E713 [*] Test for membership should be `not in`
tardis/io/logger/montecarlo_tracking.py:2:23: F401 [*] `functools.wraps` imported but unused
tardis/io/logger/montecarlo_tracking.py:63:30: G004 Logging statement uses f-string
tardis/io/logger/montecarlo_tracking.py:64:30: G004 Logging statement uses f-string
tardis/io/logger/tests/test_logging.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/io/logger/tests/test_logging.py:8:8: F811 [*] Redefinition of unused `pytest` from line 1
tardis/io/logger/tests/test_logging.py:70:16: E712 Avoid equality comparisons to `True`; use `if specific_log_level:` for truth checks
tardis/io/logger/tests/test_logging.py:88:16: E712 Avoid equality comparisons to `True`; use `if specific_log_level:` for truth checks
tardis/io/logger/tests/test_logging.py:110:16: E712 Avoid equality comparisons to `True`; use `if specific_log_level:` for truth checks
tardis/io/model/__init__.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/io/model/__init__.py:1:44: F401 `tardis.io.model.readers.stella.read_stella_model` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
tardis/io/model/__init__.py:4:44: F401 `tardis.io.model.readers.cmfgen.read_cmfgen_model` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
tardis/io/model/readers/arepo.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/io/model/readers/arepo.py:19:9: D202 [*] No blank lines allowed after function docstring (found 1)
tardis/io/model/readers/arepo.py:129:9: D202 [*] No blank lines allowed after function docstring (found 1)
tardis/io/model/readers/arepo.py:178:9: D202 [*] No blank lines allowed after function docstring (found 1)
tardis/io/model/readers/arepo.py:256:19: UP032 [*] Use f-string instead of `format` call
tardis/io/model/readers/arepo.py:268:9: D202 [*] No blank lines allowed after function docstring (found 1)
tardis/io/model/readers/arepo.py:384:9: D202 [*] No blank lines allowed after function docstring (found 1)
tardis/io/model/readers/arepo.py:429:25: UP032 [*] Use f-string instead of `format` call
tardis/io/model/readers/arepo.py:432:25: UP032 [*] Use f-string instead of `format` call
tardis/io/model/readers/arepo.py:453:29: UP031 Use format specifiers instead of percent format
tardis/io/model/readers/arepo.py:454:29: UP031 Use format specifiers instead of percent format
tardis/io/model/readers/arepo.py:461:17: FLY002 Consider `"\n---\n"` instead of string join
tardis/io/model/readers/arepo.py:472:35: UP031 Use format specifiers instead of percent format
tardis/io/model/readers/arepo.py:473:31: UP031 Use format specifiers instead of percent format
tardis/io/model/readers/arepo.py:501:29: UP031 Use format specifiers instead of percent format
tardis/io/model/readers/arepo.py:502:25: UP031 Use format specifiers instead of percent format
tardis/io/model/readers/arepo.py:537:9: D202 [*] No blank lines allowed after function docstring (found 1)
tardis/io/model/readers/arepo.py:707:9: D202 [*] No blank lines allowed after function docstring (found 1)
tardis/io/model/readers/artis.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/io/model/readers/artis.py:7:5: D202 [*] No blank lines allowed after function docstring (found 1)
tardis/io/model/readers/base.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/io/model/readers/base.py:25:5: D202 [*] No blank lines allowed after function docstring (found 1)
tardis/io/model/readers/blondin_toymodel.py:31:10: UP015 [*] Unnecessary open mode parameters
tardis/io/model/readers/blondin_toymodel.py:94:10: UP015 [*] Unnecessary open mode parameters
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/model/readers/cmfgen_deprecated.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/io/model/readers/cmfgen_deprecated.py:73:5: D202 [*] No blank lines allowed after function docstring (found 1)
tardis/io/model/readers/csvy.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/io/model/readers/csvy.py:100:5: D202 [*] No blank lines allowed after function docstring (found 1)
tardis/io/model/readers/generic_readers.py:1:21: F401 [*] `pathlib.Path` imported but unused
tardis/io/model/readers/generic_readers.py:21:6: FA100 Add `from __future__ import annotations` to simplify `typing.Tuple`
tardis/io/model/readers/generic_readers.py:48:12: NPY201 `np.recfromtxt` will be removed in NumPy 2.0. Use `np.genfromtxt` instead.
tardis/io/model/readers/stella.py:32:5: D412 [*] No blank lines allowed between a section header and its content ("Parameters")
tardis/io/model/readers/stella.py:53:17: RET508 Unnecessary `else` after `break` statement
tardis/io/model/readers/tests/test_arepo_parser.py:1:1: INP001 File `tardis/io/model/readers/tests/test_arepo_parser.py` is part of an implicit namespace package. Add an `__init__.py`.
tardis/io/model/readers/tests/test_arepo_parser.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/io/model/readers/tests/test_arepo_parser.py:16:10: UP015 [*] Unnecessary open mode parameters
tardis/io/model/readers/tests/test_arepo_parser.py:48:10: UP015 [*] Unnecessary open mode parameters
tardis/io/model/readers/tests/test_arepo_parser.py:59:10: UP015 [*] Unnecessary open mode parameters
tardis/io/model/readers/tests/test_arepo_parser.py:89:10: UP015 [*] Unnecessary open mode parameters
tardis/io/model/readers/tests/test_arepo_parser.py:99:10: UP015 [*] Unnecessary open mode parameters
tardis/io/model/readers/tests/test_arepo_parser.py:109:10: UP015 [*] Unnecessary open mode parameters
tardis/io/model/readers/tests/test_ascii_readers.py:1:1: INP001 File `tardis/io/model/readers/tests/test_ascii_readers.py` is part of an implicit namespace package. Add an `__init__.py`.
tardis/io/model/readers/tests/test_ascii_readers.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/io/model/readers/tests/test_ascii_readers.py:3:20: F401 [*] `tardis.io` imported but unused
tardis/io/model/readers/tests/test_ascii_readers.py:10:17: F401 [*] `numpy` imported but unused
tardis/io/model/readers/tests/test_ascii_readers.py:12:21: F401 [*] `pathlib.Path` imported but unused
tardis/io/model/readers/tests/test_cmfgen_reader.py:1:1: INP001 File `tardis/io/model/readers/tests/test_cmfgen_reader.py` is part of an implicit namespace package. Add an `__init__.py`.
tardis/io/model/readers/tests/test_cmfgen_reader.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/io/model/readers/tests/test_cmfgen_reader.py:5:1: PT013 Incorrect import of `pytest`; use `import pytest` instead
tardis/io/model/readers/tests/test_cmfgen_reader.py:6:30: F401 [*] `astropy.units` imported but unused
tardis/io/model/readers/tests/test_csvy_reader.py:1:1: INP001 File `tardis/io/model/readers/tests/test_csvy_reader.py` is part of an implicit namespace package. Add an `__init__.py`.
tardis/io/model/readers/tests/test_csvy_reader.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/io/model/readers/tests/test_csvy_reader.py:5:38: F401 [*] `jsonschema.exceptions` imported but unused
tardis/io/model/readers/tests/test_csvy_reader.py:8:30: F401 [*] `astropy.units` imported but unused
tardis/io/model/readers/tests/test_csvy_reader.py:48:10: B017 `pytest.raises(Exception)` should be considered evil
tardis/io/model/readers/tests/test_stella_reader.py:1:1: INP001 File `tardis/io/model/readers/tests/test_stella_reader.py` is part of an implicit namespace package. Add an `__init__.py`.
tardis/io/model/readers/tests/test_stella_reader.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/io/model/readers/tests/test_stella_reader.py:5:1: PT013 Incorrect import of `pytest`; use `import pytest` instead
tardis/io/tests/test_HDFWriter.py:1:1: N999 Invalid module name: 'test_HDFWriter'
tardis/io/tests/test_HDFWriter.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/io/tests/test_HDFWriter.py:6:27: F401 [*] `numpy.testing.assert_almost_equal` imported but unused
tardis/io/tests/test_atomic.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/io/tests/test_decay.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/io/tests/test_model_reader.py:1:8: F401 [*] `h5py` imported but unused
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:328:21: G004 Logging statement uses f-string
tardis/io/util.py:385:14: UP008 Use `super()` instead of `super(__class__, self)`
tardis/io/util.py:392:5: D202 [*] No blank lines allowed after function docstring (found 1)
tardis/io/util.py:415:13: G004 Logging statement uses f-string
tardis/model/__init__.py:2:44: W291 Trailing whitespace
tardis/model/__init__.py:4:53: W291 Trailing whitespace
tardis/model/__init__.py:5:46: W291 Trailing whitespace
tardis/model/__init__.py:9:31: F401 `tardis.model.base.SimulationState` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
tardis/model/base.py:340:12: PTH117 `os.path.isabs()` should be replaced by `Path.is_absolute()`
tardis/model/base.py:353:27: C403 Unnecessary `list` comprehension (rewrite as a `set` comprehension)
tardis/model/base.py:366:27: C403 Unnecessary `list` comprehension (rewrite as a `set` comprehension)
tardis/model/base.py:377:21: G004 Logging statement uses f-string
tardis/model/geometry/radial1d.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/model/geometry/radial1d.py:196:29: UP004 [*] Class `NumbaRadial1DGeometry` inherits from `object`
tardis/model/geometry/tests/test_radial1d.py:1:1: INP001 File `tardis/model/geometry/tests/test_radial1d.py` is part of an implicit namespace package. Add an `__init__.py`.
tardis/model/geometry/tests/test_radial1d.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/model/matter/decay.py:20:14: UP008 Use `super()` instead of `super(__class__, self)`
tardis/model/matter/decay.py:28:28: C408 Unnecessary `dict` call (rewrite as a literal)
tardis/model/matter/decay.py:36:30: C405 Unnecessary `list` literal (rewrite as a `set` literal)
tardis/model/matter/decay.py:71:23: C408 Unnecessary `dict` call (rewrite as a literal)
tardis/model/matter/decay.py:101:21: G004 Logging statement uses f-string
tardis/model/matter/decay.py:104:17: G004 Logging statement uses f-string
tardis/model/tests/test_base.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/model/tests/test_base.py:1:8: F401 [*] `os` imported but unused
tardis/model/tests/test_base.py:2:21: F401 [*] `pathlib.Path` imported but unused
tardis/model/tests/test_csvy_model.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/model/tests/test_csvy_model.py:1:21: F401 [*] `pathlib.Path` imported but unused
tardis/model/tests/test_csvy_model.py:6:30: F401 [*] `astropy.units` imported but unused
tardis/model/tests/test_csvy_model.py:8:38: F401 [*] `tardis.io.atom_data.base.AtomData` imported but unused
tardis/model/tests/test_density.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/model/tests/test_density.py:1:8: F401 [*] `os` imported but unused
tardis/radiation_field/base.py:1:1: INP001 File `tardis/radiation_field/base.py` is part of an implicit namespace package. Add an `__init__.py`.
tardis/radiation_field/base.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/transport/frame_transformations.py:18:5: RET505 Unnecessary `else` after `return` statement
tardis/transport/frame_transformations.py:48:5: RET505 Unnecessary `else` after `return` statement
tardis/transport/montecarlo/__init__.py:14:1: E402 Module level import not at top of file
tardis/transport/montecarlo/__init__.py:24:1: E402 Module level import not at top of file
tardis/transport/montecarlo/__init__.py:25:5: F401 `tardis.transport.montecarlo.packet_collections.PacketCollection` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
tardis/transport/montecarlo/__init__.py:27:1: E402 Module level import not at top of file
tardis/transport/montecarlo/__init__.py:27:50: F401 `tardis.transport.montecarlo.r_packet.RPacket` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
tardis/transport/montecarlo/numba_interface.py:114:9: ANN204 Missing return type annotation for special method `__getitem__`
tardis/transport/montecarlo/packet_source.py:246:9: RET505 Unnecessary `else` after `return` statement
tardis/transport/montecarlo/tests/test_montecarlo.py:27:1: E402 Module level import not at top of file
tardis/transport/montecarlo/tests/test_montecarlo.py:32:1: E402 Module level import not at top of file
tardis/transport/montecarlo/tests/test_montecarlo.py:48:5: PT021 Use `yield` instead of `request.addfinalizer`
tardis/transport/montecarlo/tests/test_montecarlo.py:204:5: F811 Redefinition of unused `test_get_random_mu_different_output` from line 195
tardis/transport/montecarlo/tests/test_montecarlo.py:484:5: F821 Undefined name `mc`
tardis/transport/montecarlo/tests/test_montecarlo.py:570:5: F821 Undefined name `mc`
tardis/transport/montecarlo/tests/test_montecarlo.py:571:5: F821 Undefined name `mc`
tardis/transport/montecarlo/tests/test_montecarlo.py:579:5: F821 Undefined name `mc`
tardis/transport/montecarlo/tests/test_montecarlo.py:596:5: F821 Undefined name `mc`
tardis/transport/montecarlo/tests/test_montecarlo.py:601:5: F821 Undefined name `mc`
tardis/transport/montecarlo/tests/test_montecarlo.py:624:9: F821 Undefined name `transport`
tardis/transport/montecarlo/tests/test_montecarlo.py:625:9: F821 Undefined name `transport`
tardis/transport/montecarlo/tests/test_montecarlo.py:626:9: F821 Undefined name `transport`
tardis/transport/montecarlo/tests/test_montecarlo.py:627:9: F821 Undefined name `transport`
tardis/transport/montecarlo/tests/test_montecarlo.py:629:5: F821 Undefined name `mc`
tardis/transport/montecarlo/tests/test_montecarlo.py:642:5: F821 Undefined name `mc`
tardis/transport/montecarlo/tests/test_montecarlo.py:666:5: F821 Undefined name `mc`
tardis/transport/montecarlo/tests/test_montecarlo.py:679:5: F821 Undefined name `mc`
tardis/transport/montecarlo/tests/test_packet.py:21:1: E402 Module level import not at top of file
tardis/transport/montecarlo/tests/test_vpacket.py:12:1: E402 Module level import not at top of file
tardis/transport/montecarlo/weighted_packet_source.py:79:13: B018 Found useless expression. Either assign it to a variable or remove it.
tardis/transport/tests/test_doppler_factor.py:1:1: INP001 File `tardis/transport/tests/test_doppler_factor.py` is part of an implicit namespace package. Add an `__init__.py`.
tardis/util/base.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/util/base.py:12:30: F401 [*] `radioactivedecay.Nuclide` imported but unused
tardis/util/base.py:119:5: D202 [*] No blank lines allowed after function docstring (found 1)
tardis/util/base.py:135:12: C414 Unnecessary `list` call within `set()`
tardis/util/base.py:196:5: D202 [*] No blank lines allowed after function docstring (found 1)
tardis/util/base.py:234:13: PIE790 [*] Unnecessary `pass` statement
tardis/util/base.py:344:5: RET505 Unnecessary `else` after `return` statement
tardis/util/base.py:349:5: D202 [*] No blank lines allowed after function docstring (found 1)
tardis/util/base.py:405:5: D202 [*] No blank lines allowed after function docstring (found 1)
tardis/util/base.py:483:5: D202 [*] No blank lines allowed after function docstring (found 1)
tardis/util/base.py:502:5: D202 [*] No blank lines allowed after function docstring (found 1)
tardis/util/base.py:522:5: E722 Do not use bare `except`
tardis/util/base.py:523:22: SIM210 Remove unnecessary `True if ... else False`
tardis/util/base.py:630:5: RET505 Unnecessary `elif` after `return` statement
tardis/util/base.py:776:5: D412 [*] No blank lines allowed between a section header and its content ("Parameters")
Found 227 errors.
[*] 113 fixable with the `--fix` option (33 hidden fixes can be enabled with the `--unsafe-fixes` option).

@@ -265,14 +266,12 @@ def finalize_array(self):
"""
Added to make RPacketLastInteractionTracker compatible with RPacketTracker
"""
pass
Copy link
Contributor

Choose a reason for hiding this comment

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

This may look odd, but apparently a docstring counts as an empty statement and thus pass is not required.

Copy link

codecov bot commented Sep 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.72%. Comparing base (71aad19) to head (a674be9).
Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2829      +/-   ##
==========================================
- Coverage   70.98%   70.72%   -0.27%     
==========================================
  Files         209      209              
  Lines       15654    15589      -65     
==========================================
- Hits        11112    11025      -87     
- Misses       4542     4564      +22     

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

@andrewfullard andrewfullard marked this pull request as ready for review September 25, 2024 17:04
andrewfullard
andrewfullard previously approved these changes Sep 25, 2024
@andrewfullard andrewfullard merged commit de4d872 into tardis-sn:master Sep 25, 2024
17 of 18 checks passed
@tardis-bot
Copy link
Contributor

*beep* *bop*
Hi human,
I ran benchmarks as you asked comparing master (71aad19) and the latest commit (a674be9).
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 [59c5d280] <master>   | After [a674be98]    | Ratio   | Benchmark (Parameter)                                                                                                               |
|----------|------------------------------|---------------------|---------|-------------------------------------------------------------------------------------------------------------------------------------|
|          | 5.64±0.6μs                   | 6.48±0.8μs          | ~1.15   | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket                                           |
|          | 19.6±4μs                     | 22.1±5μs            | ~1.13   | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_last_interaction_tracker_list |
|          | 531±200ns                    | 591±100ns           | ~1.11   | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_photoabsorption_opacity_calculation                              |
|          | 2.22±1μs                     | 1.95±1μs            | ~0.88   | transport_montecarlo_estimators_radfield_estimator_calcs.BenchmarkMontecarloMontecarloNumbaPacket.time_update_line_estimators       |
|          | 4.34±1μs                     | 3.35±0.5μs          | ~0.77   | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_within_shell                              |
|          | 2.62±0.4μs                   | 2.82±0.5μs          | 1.08    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_bad_vpacket                                       |
|          | 30.9±0.03μs                  | 32.8±0.9μs          | 1.06    | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_tracker_list                  |
|          | 728±0.1ns                    | 759±0.1ns           | 1.04    | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_thomson_scatter                                       |
|          | 46.4±30μs                    | 47.7±30μs           | 1.03    | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_scatter                                          |
|          | 63.0±0.03ms                  | 65.0±0.3ms          | 1.03    | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_rpacket_trackers_to_dataframe                  |
|          | 7.00±1μs                     | 7.16±2μs            | 1.02    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_volley                                    |
|          | 202±0.2ns                    | 204±0.1ns           | 1.01    | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_intensity_black_body                                       |
|          | 581±100ns                    | 581±100ns           | 1.00    | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_pair_creation_opacity_calculation                                |
|          | 2.08±0m                      | 2.08±0m             | 1.00    | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_FormalIntegrator_functions                                 |
|          | 1.21±0μs                     | 1.21±0μs            | 1.00    | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_boundary                |
|          | 1.73±0.01ms                  | 1.73±0.02ms         | 1.00    | transport_montecarlo_main_loop.BenchmarkTransportMontecarloMontecarloMainLoop.time_montecarlo_main_loop                             |
|          | 2.66±0ms                     | 2.64±0ms            | 0.99    | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('scatter')                                     |
|          | 37.1±0s                      | 36.9±0.01s          | 0.99    | run_tardis.BenchmarkRunTardis.time_run_tardis                                                                                       |
|          | 1.02±0m                      | 1.01±0m             | 0.99    | run_tardis.BenchmarkRunTardis.time_run_tardis_rpacket_tracking                                                                      |
|          | 40.8±30μs                    | 40.5±20μs           | 0.99    | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_emission                                         |
|          | 2.65±0.4ms                   | 2.59±0.4ms          | 0.98    | transport_montecarlo_single_packet_loop.BenchmarkTransportMontecarloSinglePacketLoop.time_single_packet_loop                        |
|          | 3.72±0.01ms                  | 3.62±0.01ms         | 0.97    | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('macroatom')                                   |
|          | 541±200ns                    | 521±100ns           | 0.96    | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_compton_opacity_calculation                                      |
|          | 1.52±0.3μs                   | 1.42±0.3μs          | 0.93    | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_line                    |

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

CePowers pushed a commit to CePowers/tardis that referenced this pull request Oct 1, 2024
* ruff autofix tardis/transport safe fixes

* ruff autofix tardis/transport unsafe fixes

* fix ruff unsafe rule PIE790

* black 2 files

---------

Co-authored-by: Andrew Fullard <[email protected]>
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