Open DougBurke opened 4 months ago
Attention: Patch coverage is 98.98990%
with 1 line
in your changes missing coverage. Please review.
Project coverage is 87.46%. Comparing base (
a02a7bf
) to head (04e9b3c
).
Files with missing lines | Patch % | Lines |
---|---|---|
sherpa/optmethods/opt.py | 95.83% | 1 Missing :warning: |
Rebased as I try to make sherpa.utils.types
a thing.
Rebased to pick up recent changes and re-ordered the commits.
Summary
Improve the typing coverage of the sherpa.optmethods code and internal code clean up.
Details
This is a follow-on to #2045 and takes in some of the changes in #2015. However, there is less of an attempt to mark symbols as deprecated as these are definitely internal routines for this module. Much of the code removal is to remove debugging information that only someone who could edit the code could get to see. This, along with some typing annotation, and some understanding of the code from #2007 / #2022, has lead to some minor code cleanups. I am also conscious of improving the documentation given https://github.com/sherpa/sherpa/discussions/2042
It has now been updated to build on #2079 and I haven't yet updated this text
The typing rules that are added are meant to try and represent the intent of the interfaces, rather than exactly matching the reality. For example, there's subtle differences between a Sequence and ndarray that can cause mypy to complain over things that are "obviously" correct - e.g. can you call len on the object - as well as subtle differences between float and SupportsFloat that do not really change the code. I claim that until we have all the major parts working together it's hard to nail down these types, but that it has actually shown be some problems (or potential problems): for example the `fix logical error with population_size argument" commit.
I have added some notes of possible future work (none of them would be significant changes), but it's hard to make these changes as those code paths are currently not tested.
The idea is that this PR should not cause difference in behavior with code using Sherpa unless they are doing something really funky.