From a93602d92edbf11885645866216d194324578acf Mon Sep 17 00:00:00 2001 From: "Gunung P. Wibisono" <55311527+gunungpw@users.noreply.github.com> Date: Sun, 3 Apr 2022 20:42:36 +0700 Subject: [PATCH] Add example `useless-import-alias` message documentation (#6151) Co-authored-by: Pierre Sassoulas --- doc/data/messages/u/useless-import-alias/bad.py | 1 + doc/data/messages/u/useless-import-alias/details.rst | 8 ++++++++ doc/data/messages/u/useless-import-alias/good.py | 1 + doc/data/messages/u/useless-import-alias/related.rst | 3 +++ 4 files changed, 13 insertions(+) create mode 100644 doc/data/messages/u/useless-import-alias/bad.py create mode 100644 doc/data/messages/u/useless-import-alias/details.rst create mode 100644 doc/data/messages/u/useless-import-alias/good.py create mode 100644 doc/data/messages/u/useless-import-alias/related.rst diff --git a/doc/data/messages/u/useless-import-alias/bad.py b/doc/data/messages/u/useless-import-alias/bad.py new file mode 100644 index 0000000000..66c25dcc2d --- /dev/null +++ b/doc/data/messages/u/useless-import-alias/bad.py @@ -0,0 +1 @@ +import pandas as pandas # [useless-import-alias] diff --git a/doc/data/messages/u/useless-import-alias/details.rst b/doc/data/messages/u/useless-import-alias/details.rst new file mode 100644 index 0000000000..5b804e1e9c --- /dev/null +++ b/doc/data/messages/u/useless-import-alias/details.rst @@ -0,0 +1,8 @@ +Known issue +----------- + +If you prefer to use "from-as" to explicitly reexport in API (`from fruit import orange as orange`) +instead of using `__all__` this message will be a false positive. + +If that's the case use `pylint: disable=useless-import-alias` before your imports in your API files. +`False positive 'useless-import-alias' error for mypy-compatible explicit re-exports #6006 `_ diff --git a/doc/data/messages/u/useless-import-alias/good.py b/doc/data/messages/u/useless-import-alias/good.py new file mode 100644 index 0000000000..ffd919bcfb --- /dev/null +++ b/doc/data/messages/u/useless-import-alias/good.py @@ -0,0 +1 @@ +import pandas as pd diff --git a/doc/data/messages/u/useless-import-alias/related.rst b/doc/data/messages/u/useless-import-alias/related.rst new file mode 100644 index 0000000000..f195887420 --- /dev/null +++ b/doc/data/messages/u/useless-import-alias/related.rst @@ -0,0 +1,3 @@ +* `PEP 8, Import Guideline `_ +* `Pylint block-disable `_ +* `mypy --no-implicit-reexport `_