Skip to content

Commit 7b0e7d0

Browse files
authored
fix: Iterate over copy of sys.modules. (#127)
## Description Iterate over copy of sys.modules instead of directly. See #126 ## Type of Change - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Documentation update ## Issue Number Closes #126 ## Code Compatibility - [x] I have performed a self-review of my code ### Code Performance and Testing - [ ] I have added tests that prove my fix is effective or that my feature works - [] I ran the [complete Pytest test](https://anemoi.readthedocs.io/projects/training/en/latest/dev/testing.html) suite locally, and they pass I got lots of errors, but they seem to be related to credentials for an s3 storage. ========================================== 8 failed, 151 passed, 1 warning in 8.40s =========================================== ### Dependencies - [] I have ensured that the code is still pip-installable after the changes and runs - [] I have tested that new dependencies themselves are pip-installable. ### Documentation - [x] My code follows the style guidelines of this project - [ ] I have updated the documentation and docstrings to reflect the changes - [ ] I have added comments to my code, particularly in hard-to-understand areas ## Additional Notes
1 parent fdc7248 commit 7b0e7d0

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/anemoi/utils/provenance.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,12 @@ def _module_versions(full: bool) -> Tuple[Dict[str, Any], set]:
199199

200200
versions = {}
201201
namespaces = set()
202-
for k, v in sorted(sys.modules.items()):
202+
for k, v in sorted(sys.modules.copy().items()):
203203
if "." not in k:
204204
version(versions, k, v, roots, namespaces, paths, full)
205205

206206
# Catter for modules like "earthkit.meteo"
207-
for k, v in sorted(sys.modules.items()):
207+
for k, v in sorted(sys.modules.copy().items()):
208208
bits = k.split(".")
209209
if len(bits) == 2 and bits[0] in namespaces:
210210
version(versions, k, v, roots, namespaces, paths, full)

0 commit comments

Comments
 (0)