InquirerPy icon indicating copy to clipboard operation
InquirerPy copied to clipboard

inquirer.py is not properly exporting functions

Open Sofahamster opened this issue 2 years ago • 0 comments

Pylance in VS Code is reporting "incorrect usage of symbol imported from a "py.typed" module that is [not re-exported]".

Example code:

from InquirerPy import inquirer
_ = inquirer.text("Example:")

Reported error:

"text" is not exported from module "test.inquirer" Pylance(reportPrivateImportUsage)

This can be fixed by adding __all__ to inquirer.py:

from InquirerPy.prompts import CheckboxPrompt as checkbox
from InquirerPy.prompts import ConfirmPrompt as confirm
from InquirerPy.prompts import ExpandPrompt as expand
from InquirerPy.prompts import FilePathPrompt as filepath
from InquirerPy.prompts import FuzzyPrompt as fuzzy
from InquirerPy.prompts import InputPrompt as text
from InquirerPy.prompts import ListPrompt as select
from InquirerPy.prompts import NumberPrompt as number
from InquirerPy.prompts import RawlistPrompt as rawlist
from InquirerPy.prompts import SecretPrompt as secret

__all__ = ['select', 'text', 'secret', 'rawlist', 'confirm', 'checkbox', 'expand', 'filepath', 'fuzzy', 'number']

Without the "all", every function all is marked as a problem.

Sofahamster avatar Aug 05 '22 09:08 Sofahamster