Exceptions cleanup: narrow catches, remove hidden RNG resets, and make provenance timestamps UTC-aware#1391
Merged
Merged
Conversation
Copilot
AI
changed the title
[WIP] Fix bare except clauses and randomness issues
Exceptions cleanup: narrow catches, remove hidden RNG resets, and make provenance timestamps UTC-aware
Jun 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR addresses exception hygiene and reproducibility gaps: broad
except:blocks were masking failures, two statistics functions were mutating global RNG state via hardcodednp.random.seed(42), and provenance timestamps used deprecated naive UTC creation.Exception handling hardening
except:with targeted exception types across affected runtime modules:py3plex/algorithms/robustness_testing.pypy3plex/algorithms/statistical_report.pypy3plex/uncertainty/community_ensemble.pypy3plex/algebra/paths.pypy3plex/meta/utils.pypy3plex/visualization/multilayer.pyKeyboardInterrupt/SystemExit.RNG behavior in multilayer statistics
interdependence(...)resilience(...)seedparameters and switched to local generators (np.random.default_rng(seed)), so callers control determinism without global RNG side effects.Timezone-aware provenance timestamp
py3plex/meta/utils.pywith timezone-aware UTC output normalized toZ.Focused coverage updates
tests/test_multilayer_statistics.pywith deterministic seed behavior checks forinterdependenceandresilience.tests/test_meta_utils.pyto assert timezone-awaretimestamp_utcformatting.