Skip to content

Commit

Permalink
chore: Disallow implicit re-exports of imported values in Python modules
Browse files Browse the repository at this point in the history
- Set Mypy option `no_implicit_reexport` to `True`.
- Fix errors reported by Mypy after the configuration change.

From https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-no-implicit-reexport:

> […] [do] not re-export unless the item is imported using from-as or is included in `__all__`.

Ref: https://app.shortcut.com/cordada/story/6589 [sc-6589]
  • Loading branch information
fpinto-cdd committed May 7, 2024
1 parent a52a17f commit be1d1c2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ plugins =

follow_imports = normal
ignore_missing_imports = False
no_implicit_reexport = True
strict_optional = True
disallow_untyped_defs = True
check_untyped_defs = True
Expand Down
5 changes: 5 additions & 0 deletions src/cl_sii/libs/crypto_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
"""

__all__ = [
'X509Cert',
'_X509CertOpenSsl',
]

import base64
from typing import Union

Expand Down
5 changes: 5 additions & 0 deletions src/cl_sii/libs/xml_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
"""

__all__ = [
'XmlElement',
'XmlElementTree',
]

import io
import logging
import os
Expand Down

0 comments on commit be1d1c2

Please sign in to comment.