
    'YHh                     .    d Z ddlZddlmZ dZd ZddZy)zj
Provides a function to open the system browser to either search or go directly
to a function's reference
    N)	urlencodezhttps://www.statsmodels.org/c                 P   t         }|r|dz  }n|dz  }| |S t        | t              r|dz  }|t        d| i      z  }|dz  }|S 	 | } | j                  }| j
                  }|j                  d      st        d      |dz  }||d	z   |z   d
z   z  }|S # t        $ r t        d      w xY w)zw
    Parse inputs and return a correctly formatted URL or raises ValueError
    if the input is not understandable
    zstable/zdevel/zsearch.html?qz &check_keywords=yes&area=defaultzstatsmodels.z!Function must be from statsmodelsz
generated/.z.htmlzInput not understood)	BASE_URL
isinstancestrr   __name__
__module__
startswith
ValueErrorAttributeError)funcstableurl	func_namefunc_modules        N/var/www/html/planif/env/lib/python3.12/site-packages/statsmodels/tools/web.py_generate_urlr      s    
 Cyx|
	D#	~y#t%%11 J		5DI//K)).9 !DEE<C;$y07::C J  	5344	5s   A	B B%c                 b    ddl m} d|vr|n|}t        | |      }t        j                  |       y)ay  
    Opens a browser and displays online documentation

    Parameters
    ----------
    func : {str, callable}
        Either a string to search the documentation or a function
    stable : bool
        Flag indicating whether to use the stable documentation (True) or
        the development documentation (False).  If not provided, opens
        the stable documentation if the current version of statsmodels is a
        release

    Examples
    --------
    >>> import statsmodels.api as sm

    Documentation site

    >>> sm.webdoc()

    Search for glm in docs

    >>> sm.webdoc('glm')

    Go to current generated help for OLS

    >>> sm.webdoc(sm.OLS, stable=False)

    Notes
    -----
    By default, open stable documentation if the current version of
    statsmodels is a release.  Otherwise opens the development documentation.

    Uses the default system browser.
    r   )__version__devN)statsmodels._versionr   r   
webbrowseropen)r   r   r   url_or_errors       r   webdocr   *   s1    J 1!4[&F v.LOOL!    )NN)__doc__r   urllib.parser   r   r   r    r   r   <module>r"      s!     ")>*r   