Skip to content

Commit

Permalink
Update __init__.py (#76)
Browse files Browse the repository at this point in the history
Adding an __all__ variable to control the set of variables exported by lingua. This helps with type checking by Pyright. The alternative would be changing to a form such as:
` from .builder import LanguageDetectorBuilder as LanguageDetectorBuilder `

https://github.com/microsoft/pyright/blob/main/docs/typed-libraries.md#library-interface
```
Imported symbols are considered private by default. If they use the “import A as A” (a redundant module alias), “from X import A as A” (a redundant symbol alias), or “from . import A” forms, symbol “A” is not private unless the name begins with an underscore. If a file __init__.py uses the form “from .A import X”, symbol “A” is not private unless the name begins with an underscore (but “X” is still private). If a wildcard import (of the form “from X import *”) is used, all symbols referenced by the wildcard are not private.
```
  • Loading branch information
bscan authored Sep 16, 2022
1 parent 6d4165d commit adebfbf
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lingua/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,8 @@
```
"""

__all__ = ('LanguageDetectorBuilder', 'LanguageDetector', 'IsoCode639_1', 'IsoCode639_3', 'Language', 'LanguageModelFilesWriter', 'TestDataFilesWriter')

from .builder import LanguageDetectorBuilder
from .detector import LanguageDetector
from .isocode import IsoCode639_1, IsoCode639_3
Expand Down

0 comments on commit adebfbf

Please sign in to comment.