Skip to content

TypeError: Item in __all__ must be str, not function #105

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

Closed
1 task
dhruvkb opened this issue Nov 29, 2020 · 1 comment · Fixed by #113
Closed
1 task

TypeError: Item in __all__ must be str, not function #105

dhruvkb opened this issue Nov 29, 2020 · 1 comment · Fixed by #113
Assignees
Labels
💻 aspect: code Concerns the software code in the repository 🤖 aspect: dx Concerns developers' experience with the codebase 🛠 goal: fix Bug fix good first issue New-contributor friendly help wanted Open to participation from the community 🟨 priority: medium Not blocking but should be fixed soon 🏁 status: ready for work Ready for work

Comments

@dhruvkb
Copy link
Member

dhruvkb commented Nov 29, 2020

Description

Many Python files in the repo use the __all__ array to limit exported objects. Every item in the list should be a string containing the names of the exported variables.

Currently the variable contains the variables themselves instead of their names, like this.

def set_labels(*args):
    pass

__all__ = [set_labels]

Instead the correct way which would be this.

- __all__ = [set_labels]
+ __all__ = ["set_labels"]

Reproduction

  1. Try wildcard importing from any such file.
from set_labels import *
  1. See error.
TypeError: Item in set_labels.__all__ must be str, not function

Expectation

Wildcard imports, while discouraged, should still work.

Resolution

  • I would be interested in resolving this bug.
@dhruvkb dhruvkb added 🟧 priority: high Stalls work on the project or its dependents 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work 🛠 goal: fix Bug fix 💻 aspect: code Concerns the software code in the repository good first issue New-contributor friendly help wanted Open to participation from the community 🏁 status: ready for work Ready for work 🟨 priority: medium Not blocking but should be fixed soon 🤖 aspect: dx Concerns developers' experience with the codebase and removed 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work 🟧 priority: high Stalls work on the project or its dependents labels Nov 29, 2020
@shubhanshu02
Copy link
Contributor

Hi @dhruvkb! Can I help to solve this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 aspect: code Concerns the software code in the repository 🤖 aspect: dx Concerns developers' experience with the codebase 🛠 goal: fix Bug fix good first issue New-contributor friendly help wanted Open to participation from the community 🟨 priority: medium Not blocking but should be fixed soon 🏁 status: ready for work Ready for work
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants