
    M/Ph                     0    d Z ddlZddlmZ dZd ZddZdS )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                 j   t           }|r|dz  }n|dz  }| |S t          | t                    r|dz  }|t          d| i          z  }|dz  }nf	 | } | j        }| j        }|                    d          st          d          |d	z  }||d
z   |z   dz   z  }n# t          $ r t          d          w xY w|S )zw
    Parse inputs and return a correctly formatted URL or raises ValueError
    if the input is not understandable
    zstable/zdevel/Nz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        U/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/statsmodels/tools/web.py_generate_urlr      s   
 C yx|
	D#		 5~y#t%%%11		5DI/K)).99 F !DEEE<C;$y07::CC 	5 	5 	53444	5Js   AB B0c                 j    ddl m} d|vr|n|}t          | |          }t          j        |           dS )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   *   sN    J 100000!44[[&F v..LOL!!!4    )NN)__doc__r   urllib.parser   r   r   r    r   r   <module>r"      sa         " " " " " ")  >* * * * * *r   