
    -jik                       S SK Jr  S SKrS SKrS SKrS SKrS SKrS SKJr  S SK	J
r
  S SK	Jr  S SK	Jr  S SK	Jr  S SKJr  S S	KJr  \(       a  S S
KJr  \S\\\\4   rSrSr " S S\R6                  5      r " S S\5      r\" SS\S9 " S S\5      5       r\" SS\S9 " S S\5      5       r\" SS\S9 " S S\5      5       r  " S S\5      r!\" SS\S9 " S S\!5      5       r"\" SS\S9 " S S\!5      5       r#      S+S  jr$ " S! S"\5      r%\!\#\"\\\\ \%4r&S,S# jr'S-S$ jr(      S.S% jr)S/S& jr*S0S' jr+S1S( jr, S2     S3S) jjr-S4S* jr.g)5    )annotationsN)Real)Any)cast)TYPE_CHECKING)Union)deprecated_classoptuna_warn)Sequencez=Use :class:`~optuna.distributions.FloatDistribution` instead.z;Use :class:`~optuna.distributions.IntDistribution` instead.c                      \ rS rSrSrSS jr\R                  SS j5       r\R                  SS j5       r	\R                  SS j5       r
SS jrSS jrSS	 jrSS
 jrSrg)BaseDistribution   zBase class for distributions.

Note that distribution classes are not supposed to be called by library users.
They are used by :class:`~optuna.trial.Trial` and :class:`~optuna.samplers` internally.
c                    U$ )a   Convert internal representation of a parameter value into external representation.

Args:
    param_value_in_internal_repr:
        Optuna's internal representation of a parameter value.

Returns:
    Optuna's external representation of a parameter value.
 selfparam_value_in_internal_reprs     N/home/james-whalen/.local/lib/python3.13/site-packages/optuna/distributions.pyto_external_repr!BaseDistribution.to_external_repr&   s
     ,+    c                    [         e)a   Convert external representation of a parameter value into internal representation.

Args:
    param_value_in_external_repr:
        Optuna's external representation of a parameter value.

Returns:
    Optuna's internal representation of a parameter value.
NotImplementedError)r   param_value_in_external_reprs     r   to_internal_repr!BaseDistribution.to_internal_repr3   s
     "!r   c                    [         e)zTest whether the range of this distribution contains just a single value.

Returns:
    :obj:`True` if the range of this distribution contains just a single value,
    otherwise :obj:`False`.
r   r   s    r   singleBaseDistribution.singleA   s
     "!r   c                    [         e)a/  Test if a parameter value is contained in the range of this distribution.

Args:
    param_value_in_internal_repr:
        Optuna's internal representation of a parameter value.

Returns:
    :obj:`True` if the parameter value is contained in the range of this distribution,
    otherwise :obj:`False`.
r   r   s     r   	_containsBaseDistribution._containsL   s
     "!r   c                    U R                   $ N)__dict__r    s    r   _asdictBaseDistribution._asdict[   s    }}r   c                    [        U[        5      (       d  [        $ [        U 5      [        U5      La  gU R                  UR                  :H  $ NF)
isinstancer   NotImplementedtyper(   )r   others     r   __eq__BaseDistribution.__eq__^   s<    %!122!!:T%[(}}..r   c           	         [        U R                  4[        [        U R                  R                  5       5      5      -   5      $ r'   )hash	__class__tuplesortedr(   itemsr    s    r   __hash__BaseDistribution.__hash__e   s0    T^^%fT]]5H5H5J.K(LLMMr   c                    SR                  S [        U R                  5       R                  5       5       5       5      nU R                  R
                   SU S3$ )N, c              3  4   #    U  H  u  pU S U 3v   M     g7f)=Nr   ).0kvs      r   	<genexpr>,BaseDistribution.__repr__.<locals>.<genexpr>i   s     Q2P$!aS!:2Ps   ())joinr7   r)   r8   r5   __name__)r   kwargss     r   __repr__BaseDistribution.__repr__h   sH    Q&9M9M9O2PQQ..))*!F8155r   r   N)r   floatreturnr   )r   r   rL   rK   rL   boolr   rK   rL   rN   rL   dictr0   r   rL   rN   )rL   int)rL   str)rG   
__module____qualname____firstlineno____doc__r   abcabstractmethodr   r!   r$   r)   r1   r9   rI   __static_attributes__r   r   r   r   r      so    , 	" " 	" " 	" "/N6r   r   c                  X    \ rS rSrSr S	         S
S jjrSS jrSS jrSS jrSr	g)FloatDistributionm   a  A distribution on floats.

This object is instantiated by :func:`~optuna.trial.Trial.suggest_float`, and passed to
:mod:`~optuna.samplers` in general.

.. note::
    When ``step`` is not :obj:`None`, if the range :math:`[\mathsf{low}, \mathsf{high}]`
    is not divisible by :math:`\mathsf{step}`, :math:`\mathsf{high}` will be replaced
    with the maximum of :math:`k \times \mathsf{step} + \mathsf{low} < \mathsf{high}`,
    where :math:`k` is an integer.

Attributes:
    low:
        Lower endpoint of the range of the distribution. ``low`` is included in the range.
        ``low`` must be less than or equal to ``high``. If ``log`` is :obj:`True`,
        ``low`` must be larger than 0.
    high:
        Upper endpoint of the range of the distribution. ``high`` is included in the range.
        ``high`` must be greater than or equal to ``low``.
    log:
        If ``log`` is :obj:`True`, this distribution is in log-scaled domain.
        In this case, all parameters enqueued to the distribution must be positive values.
        This parameter must be :obj:`False` when the parameter ``step`` is not :obj:`None`.
    step:
        A discretization step. ``step`` must be larger than 0.
        This parameter must be :obj:`None` when the parameter ``log`` is :obj:`True`.

Nc                l   U(       a  Ub  [        S5      eX:  a  [        SU< SU< S35      eU(       a  US::  a  [        SU< SU< S35      eUb  US::  a  [        SU< S	35      eS U l        Ub  [        XU5      n[        U5      U l        [        U5      U l        [        U5      U l        X0l        g )
Nz9The parameter `step` is not supported when `log` is true.&`low <= high` must hold, but got (low=, high=).        z1`low > 0` must hold for `log=True`, but got (low=r   #`step > 0` must hold, but got step=.)
ValueErrorstep_adjust_discrete_uniform_highrK   lowhighlogr   ri   rj   rk   rg   s        r   __init__FloatDistribution.__init__   s     4#XYY:F#x$PRSTT3#:QSFRZUYT[[]^__	CdWAFGG	0DADdDI:$K	r   c                   U R                   c  U R                  U R                  :H  $ U R                  U R                  :X  a  g[        R                  " [        U R                  5      5      n[        R                  " [        U R                  5      5      n[        R                  " [        U R                   5      5      nX-
  U:  $ NT)rg   ri   rj   decimalDecimalrT   )r   rj   ri   rg   s       r   r!   FloatDistribution.single   s    9988tyy((xx499$??3tyy>2D//#dhh-0C??3tyy>2DJ$&&r   c                <   UnU R                   c)  U R                  Us=:*  =(       a    U R                  :*  $ s  $ X R                  -
  U R                   -  nU R                  Us=:*  =(       a    U R                  :*  Os  =(       a    [        U[	        U5      -
  5      S:  $ )Ng:0yE>)rg   ri   rj   absround)r   r   valuer@   s       r   r$   FloatDistribution._contains   sy    ,9988u11		1111!TYY.A88u11		1Pc!eAh,6G&6PPr   c                    [        U5      n[        R                  " U5      (       a  [        SU S35      eU R
                  (       a  US::  a  [        SU S35      eU$ ! [        [        4 a  n[        SU S35      UeS nAff = fN'z8' is not a valid type. float-castable value is expected.`z` is invalid value.rc   z)` is invalid value for the case log=True.rK   rf   	TypeErrormathisnanrk   r   r   internal_repres       r   r   "FloatDistribution.to_internal_repr       	!">?M ::m$$q!= >>QRSS88,011Z[   I& 	01 24 4 	   A B/A??Brj   rk   ri   rg   )FN)
ri   rK   rj   rK   rk   rN   rg   zNone | floatrL   NonerM   rO   )r   rK   rL   rK   )
rG   rU   rV   rW   rX   rm   r!   r$   r   r[   r   r   r   r]   r]   m   sK    < PT %,0@L	0	'Qr   r]   z3.0.0z6.0.0)textc                  :   ^  \ rS rSrSrSU 4S jjrSS jrSrU =r$ )UniformDistribution   a  A uniform distribution in the linear domain.

This object is instantiated by :func:`~optuna.trial.Trial.suggest_float`, and passed to
:mod:`~optuna.samplers` in general.

Attributes:
    low:
        Lower endpoint of the range of the distribution. ``low`` is included in the range.
        ``low`` must be less than or equal to ``high``.
    high:
        Upper endpoint of the range of the distribution. ``high`` is included in the range.
        ``high`` must be greater than or equal to ``low``.

c                $   > [         TU ]  XSS S9  g NFri   rj   rk   rg   superrm   r   ri   rj   r5   s      r   rm   UniformDistribution.__init__       STBr   c                    [         R                  " U R                  5      nUR                  S5        UR                  S5        U$ Nrk   rg   copydeepcopyr(   popr   ds     r   r)   UniformDistribution._asdict   /    MM$--(	e	fr   r   ri   rK   rj   rK   rL   r   rP   	rG   rU   rV   rW   rX   rm   r)   r[   __classcell__r5   s   @r   r   r      s    C r   r   c                  :   ^  \ rS rSrSrSU 4S jjrSS jrSrU =r$ )LogUniformDistribution   a#  A uniform distribution in the log domain.

This object is instantiated by :func:`~optuna.trial.Trial.suggest_float` with ``log=True``,
and passed to :mod:`~optuna.samplers` in general.

Attributes:
    low:
        Lower endpoint of the range of the distribution. ``low`` is included in the range.
        ``low`` must be larger than 0. ``low`` must be less than or equal to ``high``.
    high:
        Upper endpoint of the range of the distribution. ``high`` is included in the range.
        ``high`` must be greater than or equal to ``low``.

c                $   > [         TU ]  XSS S9  g NTr   r   r   s      r   rm   LogUniformDistribution.__init__       SDAr   c                    [         R                  " U R                  5      nUR                  S5        UR                  S5        U$ r   r   r   s     r   r)   LogUniformDistribution._asdict   r   r   r   r   rP   r   r   s   @r   r   r      s    B r   r   c                  v   ^  \ rS rSrSrSU 4S jjrS	S jr\S
S j5       r\R                  SS j5       rSr
U =r$ )DiscreteUniformDistribution   a  A discretized uniform distribution in the linear domain.

This object is instantiated by :func:`~optuna.trial.Trial.suggest_float` with ``step``
argument, and passed to :mod:`~optuna.samplers` in general.

.. note::
    If the range :math:`[\mathsf{low}, \mathsf{high}]` is not divisible by :math:`q`,
    :math:`\mathsf{high}` will be replaced with the maximum of :math:`k q + \mathsf{low}
    < \mathsf{high}`, where :math:`k` is an integer.

Args:
    low:
        Lower endpoint of the range of the distribution. ``low`` is included in the range.
        ``low`` must be less than or equal to ``high``.
    high:
        Upper endpoint of the range of the distribution. ``high`` is included in the range.
        ``high`` must be greater than or equal to ``low``.
    q:
        A discretization step. ``q`` must be larger than 0.

Attributes:
    low:
        Lower endpoint of the range of the distribution. ``low`` is included in the range.
    high:
        Upper endpoint of the range of the distribution. ``high`` is included in the range.

c                "   > [         TU ]  XUS9  g )Nri   rj   rg   r   )r   ri   rj   qr5   s       r   rm   $DiscreteUniformDistribution.__init__  s    S!4r   c                    [         R                  " U R                  5      nUR                  S5        UR                  S5      nX!S'   U$ )Nrk   rg   r   r   )r   r   rg   s      r   r)   #DiscreteUniformDistribution._asdict  s8    MM$--(	euuV}#r   c                .    [        SU R                  5      $ )zDiscretization step.

:class:`~optuna.distributions.DiscreteUniformDistribution` is a subtype of
:class:`~optuna.distributions.FloatDistribution`.
This property is a proxy for its ``step`` attribute.
rK   )r   rg   r    s    r   r   DiscreteUniformDistribution.q'  s     GTYY''r   c                    Xl         g r'   rg   )r   rA   s     r   r   r   1  s    	r   r   )ri   rK   rj   rK   r   rK   rL   r   rP   )rL   rK   )rA   rK   rL   r   )rG   rU   rV   rW   rX   rm   r)   propertyr   setterr[   r   r   s   @r   r   r      s>    85 ( ( XX r   r   c                  N    \ rS rSrSrS
SS jjrSS jrSS jrSS jrSS jr	Sr
g	)IntDistributioni6  a  A distribution on integers.

This object is instantiated by :func:`~optuna.trial.Trial.suggest_int`, and passed to
:mod:`~optuna.samplers` in general.

.. note::
    When ``step`` is not :obj:`None`, if the range :math:`[\mathsf{low}, \mathsf{high}]`
    is not divisible by :math:`\mathsf{step}`, :math:`\mathsf{high}` will be replaced
    with the maximum of :math:`k \times \mathsf{step} + \mathsf{low} < \mathsf{high}`,
    where :math:`k` is an integer.

Attributes:
    low:
        Lower endpoint of the range of the distribution. ``low`` is included in the range.
        ``low`` must be less than or equal to ``high``. If ``log`` is :obj:`True`,
        ``low`` must be larger than or equal to 1.
    high:
        Upper endpoint of the range of the distribution. ``high`` is included in the range.
        ``high`` must be greater than or equal to ``low``.
    log:
        If ``log`` is :obj:`True`, this distribution is in log-scaled domain.
        In this case, all parameters enqueued to the distribution must be positive values.
        This parameter must be :obj:`False` when the parameter ``step`` is not 1.
    step:
        A discretization step. ``step`` must be a positive integer. This parameter must be 1
        when the parameter ``log`` is :obj:`True`.

c                   U(       a  US:w  a  [        S5      eX:  a  [        SU< SU< S35      eU(       a  US:  a  [        SU< SU< S35      eUS::  a  [        SU< S	35      eX0l        [        U5      U l        [        U5      U l        [        U5      n[        U R                  X R                  5      U l        g )
N   zZSamplers and other components in Optuna only accept step is 1 when `log` argument is True.r`   ra   rb   z2`low >= 1` must hold for `log=True`, but got (low=r   rd   re   )rf   rk   rS   rg   ri   _adjust_int_uniform_highrj   rl   s        r   rm   IntDistribution.__init__T  s    419/ 
 :F#x$PRSTT37RcVS[VZU\\^_``19CdWAFGGI	s84y,TXXtYYG	r   c                    [        U5      $ r'   )rS   r   s     r   r    IntDistribution.to_external_reprj  s    /00r   c                    [        U5      n[        R                  " U5      (       a  [        SU S35      eU R
                  (       a  US::  a  [        SU S35      eU$ ! [        [        4 a  n[        SU S35      UeS nAff = frz   r}   r   s       r   r    IntDistribution.to_internal_reprm  r   r   c                    U R                   (       a  U R                  U R                  :H  $ U R                  U R                  :X  a  gU R                  U R                  -
  U R                  :  $ rp   )rk   ri   rj   rg   r    s    r   r!   IntDistribution.single~  sK    8888tyy((88tyy 		DHH$		11r   c                    UnU R                   Us=:*  =(       a    U R                  :*  Os  =(       a    X R                   -
  U R                  -  S:H  $ Nr   r   )r   r   rw   s      r   r$   IntDistribution._contains  s=    ,xx5--DII-U5883Ctyy2PTU2UUr   r   N)Fr   )
ri   rS   rj   rS   rk   rN   rg   rS   rL   r   )r   rK   rL   rS   )r   rS   rL   rK   rM   rO   )rG   rU   rV   rW   rX   rm   r   r   r!   r$   r[   r   r   r   r   r   6  s"    :H,1"2Vr   r   c                  >   ^  \ rS rSrSrSSU 4S jjjrSS jrSrU =r$ )	IntUniformDistributioni  aJ  A uniform distribution on integers.

This object is instantiated by :func:`~optuna.trial.Trial.suggest_int`, and passed to
:mod:`~optuna.samplers` in general.

.. note::
    If the range :math:`[\mathsf{low}, \mathsf{high}]` is not divisible by
    :math:`\mathsf{step}`, :math:`\mathsf{high}` will be replaced with the maximum of
    :math:`k \times \mathsf{step} + \mathsf{low} < \mathsf{high}`, where :math:`k` is
    an integer.

Attributes:
    low:
        Lower endpoint of the range of the distribution. ``low`` is included in the range.
        ``low`` must be less than or equal to ``high``.
    high:
        Upper endpoint of the range of the distribution. ``high`` is included in the range.
        ``high`` must be greater than or equal to ``low``.
    step:
        A discretization step. ``step`` must be a positive integer.

c                $   > [         TU ]  XSUS9  g r   r   r   ri   rj   rg   r5   s       r   rm   IntUniformDistribution.__init__  r   r   c                h    [         R                  " U R                  5      nUR                  S5        U$ Nrk   r   r   s     r   r)   IntUniformDistribution._asdict  $    MM$--(	er   r   r   ri   rS   rj   rS   rg   rS   rL   r   rP   r   r   s   @r   r   r     s    .C C r   r   c                  >   ^  \ rS rSrSrSSU 4S jjjrSS jrSrU =r$ )	IntLogUniformDistributioni  ap  A uniform distribution on integers in the log domain.

This object is instantiated by :func:`~optuna.trial.Trial.suggest_int`, and passed to
:mod:`~optuna.samplers` in general.

Attributes:
    low:
        Lower endpoint of the range of the distribution. ``low`` is included in the range
        and must be larger than or equal to 1. ``low`` must be less than or equal to ``high``.
    high:
        Upper endpoint of the range of the distribution. ``high`` is included in the range.
        ``high`` must be greater than or equal to ``low``.
    step:
        A discretization step. ``step`` must be a positive integer.

c                $   > [         TU ]  XSUS9  g r   r   r   s       r   rm   "IntLogUniformDistribution.__init__  r   r   c                h    [         R                  " U R                  5      nUR                  S5        U$ r   r   r   s     r   r)   !IntLogUniformDistribution._asdict  r   r   r   r   r   rP   r   r   s   @r   r   r     s    "B B r   r   c                   [        U [        5      =(       a    [        R                  " [	        U 5      5      n[        U[        5      =(       a    [        R                  " [	        U5      5      nX:H  =(       d    U=(       a    U$ )zA function to check two choices equal considering NaN.

This function can handle NaNs like np.float32("nan") other than float.
)r-   r   r   r   rK   )value1value2value1_is_nanvalue2_is_nans       r   _categorical_choice_equalr     sS     vt,JE&M1JMvt,JE&M1JMB-"AMBr   c                  l    \ rS rSrSrSS jrSS jrSS jrSS jrSS jr	SS jr
\R                  rS	rg
)CategoricalDistributioni  a   A categorical distribution.

This object is instantiated by :func:`~optuna.trial.Trial.suggest_categorical`, and
passed to :mod:`~optuna.samplers` in general.

Args:
    choices:
        Parameter value candidates. ``choices`` must have one element at least.

.. note::

    Not all types are guaranteed to be compatible with all storages. It is recommended to
    restrict the types of the choices to :obj:`None`, :class:`bool`, :class:`int`,
    :class:`float` and :class:`str`.

Attributes:
    choices:
        Parameter value candidates.

c                   [        U5      S:X  a  [        S5      eU HV  nUc  M  [        U[        [        [
        [        45      (       a  M/  SU S[        U5      R                   S3n[        U5        MX     [        U5      U l        g )Nr   z0The `choices` must contain one or more elements.zChoices for a categorical distribution should be a tuple of None, bool, int, float and str for persistent storage but contains z which is of type re   )lenrf   r-   rN   rS   rK   rT   r/   rG   r   r6   choices)r   r   choicemessages       r   rm    CategoricalDistribution.__init__  s    w<1OPPF!*VdCPS=T*U*UIh0f1F1F0GqJ 
 G$  W~r   c                2    U R                   [        U5         $ r'   )r   rS   r   s     r   r   (CategoricalDistribution.to_external_repr  s    ||C <=>>r   c                     U R                   R                  U5      $ ! [         a7    [        U R                   5       H  u  p#[	        X5      (       d  M  Us  s $     Of = f[        SU SU R                    S35      e)Nr{   z	' not in re   )r   indexrf   	enumerater   )r   r   r   r   s       r   r   (CategoricalDistribution.to_internal_repr  sw    
	!
 <<%%&BCC 	!!*4<<!8,-IRR L "9	! 19:)DLL>QRSTTs    2AAAAc                2    [        U R                  5      S:H  $ )Nr   )r   r   r    s    r   r!   CategoricalDistribution.single  s    4<< A%%r   c                h    [        U5      nSUs=:*  =(       a    [        U R                  5      :  $ s  $ r   )rS   r   r   )r   r   r   s      r   r$   !CategoricalDistribution._contains  s/    01E--C-----r   c                   [        U[        5      (       d  [        $ [        XR                  5      (       d  gU R                  R                  5       UR                  R                  5       :w  a  gU R                  R                  5        Hr  u  p#US:X  aV  [        U5      [        [        X5      5      :w  a    g[        U[        X5      5       H  u  pE[        XE5      (       a  M      g   Ma  U[        X5      :w  d  Mr    g   g)NFr   T)r-   r   r.   r5   r(   keysr8   r   getattrzipr   )r   r0   keyrw   r   other_choices         r   r1   CategoricalDistribution.__eq__  s    %!122!!%00==5>>#6#6#88----/JCiu:WU%8!99 ,/wu7J,K(F4VJJ$ -L GE//  0 r   )r   N)r   zSequence[CategoricalChoiceType]rL   r   )r   rK   rL   CategoricalChoiceType)r   r   rL   rK   rM   rO   rR   )rG   rU   rV   rW   rX   rm   r   r   r!   r$   r1   r   r9   r[   r   r   r   r   r     s3    *&?U&.&  ((Hr   r   c                   [         R                  " U 5      nSU;   al  US   [        R                  :X  a  [	        US   S   5      US   S'   [
         H#  nUS   UR                  :X  d  M  U" S0 US   D6s  $    [        SUS    35      eUS   S:X  a  [        US   5      $ US   S;   aO  US   nUS	   nUR                  S
5      nUR                  SS5      nUS   S:X  a
  [        X4XeS9$ Uc  Sn[        X4XeS9$ [        SUS    35      e)zDeserialize a distribution in JSON format.

Args:
    json_str: A JSON-serialized distribution.

Returns:
    A deserialized distribution.

name
attributesr   zUnknown distribution class: r/   categorical)rK   rS   ri   rj   rg   rk   FrK   )rk   rg   r   r   zUnknown distribution type: r   )
jsonloadsr   rG   r6   DISTRIBUTION_CLASSESrf   getr]   r   )json_str	json_dictclsri   rj   rg   rk   s          r   json_to_distributionr  5  s@    

8$IV 7 @ @@16y7Ny7Y1ZIl#I.'C CLL05Y|455 ( 7	&8I7JKLL V-*9Y+?@@v"22E"CV$D==(D--u-C G+(GG <D&3sNN6y7H6IJKKr   c                x    [         R                  " U R                  R                  U R	                  5       S.5      $ )zSerialize a distribution to JSON format.

Args:
    dist: A distribution to be serialized.

Returns:
    A JSON string of a given distribution.

)r   r   )r   dumpsr5   rG   r)   )dists    r   distribution_to_jsonr
  a  s(     ::t~~66dllnUVVr   c                   U R                   UR                   :w  a  [        S5      e[        U [        [        45      (       aB  [        U[        [        45      (       d   eU R
                  UR
                  :w  a  [        S5      e[        U [        5      (       d  g[        U[        5      (       d  gX:w  a  [        [        R                  S-   5      eg)a  A function to check compatibility of two distributions.

It checks whether ``dist_old`` and ``dist_new`` are the same kind of distributions.
If ``dist_old`` is :class:`~optuna.distributions.CategoricalDistribution`,
it further checks ``choices`` are the same between ``dist_old`` and ``dist_new``.
Note that this method is not supposed to be called by library users.

Args:
    dist_old:
        A distribution previously recorded in storage.
    dist_new:
        A distribution newly added to storage.

zBCannot set different distribution kind to the same parameter name.zBCannot set different log configuration to the same parameter name.Nz& does not support dynamic value space.)r5   rf   r-   r]   r   rk   r   rG   )dist_olddist_news     r    check_distribution_compatibilityr  o  s    $ X///]^^(.@AA(%6$HIIII<<8<<'abbh 788h 788#,,/WW
 	
 r   c                b   [         R                  " [        U5      5      n[         R                  " [        U 5      5      n[         R                  " [        U5      5      nX4-
  nXe-  [         R                  " S5      :w  a1  Un[        Xe-  U-  U-   5      n[	        SU  SU SU< SU  SU S35        U$ )N0"The distribution is specified by [r<   ] and step=F, but the range is not divisible by `step`. It will be replaced with [].)rq   rr   rT   rK   r   )ri   rj   rg   d_highd_lowd_stepd_rold_highs           r   rh   rh     s    __SY'FOOCH%E__SY'F
.C
|ws++cmv-560Rzw OBBEbbR	

 Kr   c                n    X-
  nX2-  S:w  a(  UnX2-  U-  U -   n[        SU  SU SU< SU  SU S35        U$ )Nr   r  r<   r  r  r  r
   )ri   rj   rg   rr  s        r   r   r     sd    
Ax1}y4#%0Rzw OBBEbbR	
 Kr   c                    U R                  5       (       d   e[        U [        [        45      (       a  U R                  $ [        U [
        5      (       a  U R                  S   $  er   )r!   r-   r]   r   ri   r   r   distributions    r   _get_single_valuer    sd        	
  	L"9	:	:##A&&5r   c                   [        U [        5      (       a!  [        U R                  U R                  SS S9nO[        U [
        5      (       a!  [        U R                  U R                  SS S9nO[        U [        5      (       a+  [        U R                  U R                  SU R                  S9nO[        U [        5      (       a+  [        U R                  U R                  SU R                  S9nOB[        U [        5      (       a+  [        U R                  U R                  SU R                  S9nOU nX :w  a  U(       d  U  SU S3n[        U[        5        U$ )NFr   Tz+ is deprecated and internally converted to z3. See https://github.com/optuna/optuna/issues/2941.)r-   r   r]   ri   rj   r   r   r   r   r   rg   r   r   FutureWarning)r  suppress_warningnew_distributionr   s       r   -_convert_old_distribution_to_new_distributionr$    sR    , 344,  ""	
 
L"8	9	9,  ""	
 
L"=	>	>,  ""	
 
L"8	9	9*  """"	
 
L";	<	<*  """"	
 ('0@n  !!TV 	 	G]+r   c                R    [        U [        [        45      (       a  U R                  $ gr,   )r-   r]   r   rk   r  s    r   _is_distribution_logr&     s$    ,!2O DEEr   )r   r   r   r   rL   rN   )r  rT   rL   r   )r	  r   rL   rT   )r  r   r  r   rL   r   )ri   rK   rj   rK   rg   rK   rL   rK   )ri   rS   rj   rS   rg   rS   rL   rS   )r  r   rL   z#int | float | CategoricalChoiceType)F)r  r   r"  rN   rL   r   )r  r   rL   rN   )/
__future__r   rY   r   rq   r   r   numbersr   typingr   r   r   r   optuna._deprecatedr	   optuna._warningsr   collections.abcr   rN   rS   rK   rT   r   "_float_distribution_deprecated_msg _int_distribution_deprecated_msgABCr   r]   r   r   r   r   r   r   r   r   r  r  r
  r  rh   r   r  r$  r&  r   r   r   <module>r0     s   " 
           / ( ( dD#uc9:  D # $a  K6sww K6\X( Xv '7)KL+  M4 '7)KL.  M4 '7)KL4"3 4 M4nRV& RVj '7)IJ_  KB '7)IJ  K6
C!
C+@
C	
CP). P)h 	 )LXW#
#
*:#
	#
L$	( #8"88 8vr   