Skip to content

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

Closed
@dhruvkb

Description

@dhruvkb

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions