scikit-hep / pyhf

pure-Python HistFactory implementation with tensors and autodiff
https://pyhf.readthedocs.io/
Apache License 2.0
283 stars 83 forks source link

Remove `InvalidNameReuse` exception in favor of in `InvalidModel` #2395

Open matthewfeickert opened 10 months ago

matthewfeickert commented 10 months ago

In relation to Issue #2059, @lorenzennio was wanting to handle this via raising InvalidNameReuse though he and @kratsg pointed out that what is actually happening is maybe a better use of InvalidModel. InvalidNameReuse was added in PR https://github.com/scikit-hep/pyhf/pull/209 though in the current uses of InvalidNameReuse

https://github.com/scikit-hep/pyhf/blob/1191f6676002b26bbd751c1b8e116400baaed25e/src/pyhf/parameters/utils.py#L42-L45

@kratsg thinks this should just be covered by InvalidModel.

If this actually is an invalid model then InvalidNameReuse can be removed everywhere in the code and InvalidModel can be used instead.