Thanks to visit codestin.com
Credit goes to github.com

Skip to content

DOC Ensure externals._packaging.version.parse passes numpydoc validation #24320

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Sep 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions sklearn/externals/_packaging/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion sklearn/tests/test_docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down