Skip to content

Commit

Permalink
Add type annotations to pl_bolts/__init__.py (#435)
Browse files Browse the repository at this point in the history
* Run mypy on pl_bolts only

* Update mypy config

* Add type hints to pl_bolts/__init__.py

* mypy

Co-authored-by: Jirka Borovec <jirka.borovec@seznam.cz>
  • Loading branch information
akihironitta and Borda authored Dec 8, 2020
1 parent 1fa8bc3 commit 3ffbe47
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
PATH_ROOT = os.path.join(PATH_HERE, '..', '..')
sys.path.insert(0, os.path.abspath(PATH_ROOT))

builtins.__LIGHTNING_BOLT_SETUP__ = True
builtins.__LIGHTNING_BOLT_SETUP__: bool = True

SPHINX_MOCK_REQUIREMENTS = int(os.environ.get('SPHINX_MOCK_REQUIREMENTS', True))

Expand Down
4 changes: 2 additions & 2 deletions pl_bolts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
try:
# This variable is injected in the __builtins__ by the build process.
# It used to enable importing subpackages when the binaries are not built.
__LIGHTNING_BOLT_SETUP__
_ = None if __LIGHTNING_BOLT_SETUP__ else None
except NameError:
__LIGHTNING_BOLT_SETUP__ = False
__LIGHTNING_BOLT_SETUP__: bool = False

if __LIGHTNING_BOLT_SETUP__:
import sys # pragma: no-cover
Expand Down
3 changes: 0 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ files = pl_bolts, tests
disallow_untyped_defs = True
ignore_missing_imports = True

[mypy-pl_bolts.*]
ignore_errors = True

[mypy-pl_bolts.callbacks.*]
ignore_errors = True

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# http://blog.ionelmc.ro/2014/05/25/python-packaging/

PATH_ROOT = os.path.dirname(__file__)
builtins.__LIGHTNING_BOLT_SETUP__ = True
builtins.__LIGHTNING_BOLT_SETUP__: bool = True

import pl_bolts # noqa: E402

Expand Down

0 comments on commit 3ffbe47

Please sign in to comment.