Skip to content

Commit

Permalink
Hide confusing notes in docs: "Not to be initialized by users." (#906)
Browse files Browse the repository at this point in the history
  • Loading branch information
HDembinski authored Jun 22, 2023
1 parent 10276c5 commit d344f1d
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/iminuit/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class BasicView(abc.ABC):
__slots__ = ("_minuit", "_ndim")

def __init__(self, minuit: Any, ndim: int = 0):
"""Not to be initialized by users."""
# Users should not call this __init__, instances are created by the library
self._minuit = minuit
self._ndim = ndim

Expand Down Expand Up @@ -199,7 +199,7 @@ class LimitView(BasicView):
"""Array-like view of parameter limits."""

def __init__(self, minuit: Any):
"""Not to be initialized by users."""
# Users should not call this __init__, instances are created by the library
super(LimitView, self).__init__(minuit, 1)

def _get(self, i: int) -> Tuple[float, float]:
Expand Down Expand Up @@ -258,8 +258,8 @@ class Matrix(np.ndarray):

__slots__ = ("_var2pos",)

def __new__(cls, parameters: Union[Dict, Tuple]) -> Any:
"""Not to be initialized by users."""
def __new__(cls, parameters: Union[Dict, Tuple]) -> Any: # noqa D102
# Users should not call __new__, instances are created by the library
if isinstance(parameters, dict):
var2pos = parameters
elif isinstance(parameters, tuple):
Expand Down Expand Up @@ -396,11 +396,11 @@ class FMin:
Function minimum view.
This object provides detailed metadata about the function minimum. Inspect this to
check what exactly happened if the fit did not converge. Use the
:class:`iminuit.Minuit` object to get the best fit values, their
uncertainties, or the function value at the minimum. For convenience, you can also
get a basic OK from :class:`iminuit.Minuit` with the methods
:attr:`iminuit.Minuit.valid` and :attr:`iminuit.Minuit.accurate`.
check what exactly happened if the fit did not converge. Use the attribute
:attr:`iminuit.Minuit.fmin` to get the best fit values, their uncertainties, or the
function value at the minimum. For convenience, you can also get a basic OK from
:class:`iminuit.Minuit` with the methods :attr:`iminuit.Minuit.valid` and
:attr:`iminuit.Minuit.accurate`.
See Also
--------
Expand Down Expand Up @@ -434,7 +434,7 @@ def __init__(
edm_goal: float,
time: float,
):
"""Not to be initialized by users."""
# Users should not call this __init__, instances are created by the library
self._src = fmin
self._algorithm = algorithm
self._has_parameters_at_limit = False
Expand Down Expand Up @@ -699,7 +699,7 @@ def __init__(
self,
*args: Union[int, str, float, Optional[Tuple[float, float]], bool],
):
"""Not to be initialized by users."""
# Users should not call this __init__, instances are created by the library
assert len(args) == len(self.__slots__)
for k, arg in zip(self.__slots__, args):
setattr(self, k, arg)
Expand Down Expand Up @@ -881,7 +881,7 @@ class MError:
)

def __init__(self, *args: Union[int, str, float, bool]):
"""Not to be initialized by users."""
# Users should not call this __init__, instances are created by the library
assert len(args) == len(self.__slots__)
for k, arg in zip(self.__slots__, args):
setattr(self, k, arg)
Expand Down Expand Up @@ -1007,8 +1007,8 @@ def __exit__(self, *args):


@_deprecated.deprecated(
"Use of `func_code` attribute to declare parameters is deprecated. "
"Use `_parameters` instead, which is a dict of parameter names to limits."
"Use of ``func_code`` attribute to declare parameters is deprecated. "
"Use ``_parameters`` instead, which is a dict of parameter names to limits."
)
def make_func_code(params: Collection[str]) -> Namespace:
"""
Expand Down

0 comments on commit d344f1d

Please sign in to comment.