-
Notifications
You must be signed in to change notification settings - Fork 58
Regulate import style in python #701
Copy link
Copy link
Labels
refactorChange code without changing testsChange code without changing tests
Description
According to the suggestion in PEP8 and PR #696, the import statements in python files should be regulated. The statements always import module instead of module content, and the import statements use from, which are pythonic.
For example, the following codes meets the regulation. It illustrates module path by from, and it imports module by import.
Lines 38 to 39 in a99b8bc
| from . import _pilot_core as _pcore | |
| from . import airfoil |
modmesh/modmesh/onedim/euler1d.py
Lines 11 to 14 in a99b8bc
| try: | |
| from _modmesh import onedim as _impl # noqa: F401 | |
| except ImportError: | |
| from .._modmesh import onedim as _impl # noqa: F401 |
On the contrary, there are some unregulated codes in this project, which should be refactored.
The following code doesn't point out the path using from.
import modmesh.plot.svg as svgThe following code imports module content instead of module (files).
from typing import Any, Callablefrom modmesh.testing import TestBase as ModMeshTBReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
refactorChange code without changing testsChange code without changing tests