diff --git a/sklearn/externals/_packaging/version.py b/sklearn/externals/_packaging/version.py index ea83bbb8b5389..0f1e5b833699c 100644 --- a/sklearn/externals/_packaging/version.py +++ b/sklearn/externals/_packaging/version.py @@ -63,10 +63,18 @@ def parse(version: str) -> Union["LegacyVersion", "Version"]: - """ - Parse the given version string and return either a :class:`Version` object - or a :class:`LegacyVersion` object depending on if the given version is - a valid PEP 440 version or a legacy version. + """Parse the given version from a string to an appropriate class. + + Parameters + ---------- + version : str + Version in a string format, eg. "0.9.1" or "1.2.dev0". + + Returns + ------- + version : :class:`Version` object or a :class:`LegacyVersion` object + Returned class depends on the given version: if is a valid + PEP 440 version or a legacy version. """ try: return Version(version) diff --git a/sklearn/tests/test_docstrings.py b/sklearn/tests/test_docstrings.py index 6118d4827c523..17e5e0c4b19fb 100644 --- a/sklearn/tests/test_docstrings.py +++ b/sklearn/tests/test_docstrings.py @@ -12,7 +12,6 @@ numpydoc_validation = pytest.importorskip("numpydoc.validate") FUNCTION_DOCSTRING_IGNORE_LIST = [ - "sklearn.externals._packaging.version.parse", # sklearn.deprecation._update_doc is updating the doc against the numpydoc. # This will be fixed in future PRs. "sklearn.inspection._plot.partial_dependence.plot_partial_dependence",