Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CodeStyle][CINN] ruff F401 and F403 in python/cinn #55182

Merged
merged 15 commits into from
Jul 7, 2023
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ ignore = [
"test/dygraph_to_static/test_lambda.py" = ["PLC3002"]
# Temporarily ignore CINN files, it will fix later
"python/cinn/**" = [
"F401",
"F403",
]
"test/cinn/**" = [
Expand Down
2 changes: 1 addition & 1 deletion python/cinn/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from .core_api.backends import ExecutionEngine, ExecutionOptions
from .core_api.backends import ExecutionEngine, ExecutionOptions # noqa: F401
24 changes: 11 additions & 13 deletions python/cinn/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from .core_api.common import *
from .core_api.common import (
Bool,
CINNValue,
Float,
Int,
String,
Target,
Type,
UInt,
Void,
make_const,
)
from .core_api.common import * # noqa: F401
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这行本来也不会报 F401 吧?只会报 F403 吧?

不过没关系,之后要展开这个 * 的,这个 PR 就不要改了

from .core_api.common import Bool # noqa: F401
from .core_api.common import CINNValue # noqa: F401
from .core_api.common import Float # noqa: F401
from .core_api.common import Int # noqa: F401
from .core_api.common import String # noqa: F401
from .core_api.common import Target # noqa: F401
from .core_api.common import Type # noqa: F401
from .core_api.common import UInt # noqa: F401
from .core_api.common import Void # noqa: F401
from .core_api.common import make_const # noqa: F401
Copy link
Member

@SigureMo SigureMo Jul 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里我记得可以直接这样写:

from a import (  # noqa: F401
    b,
    c,
    d,
)

4 changes: 2 additions & 2 deletions python/cinn/lang.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from .core_api.lang import *
from .core_api.lang import Buffer, compute, lower
from .core_api.lang import * # noqa: F401
from .core_api.lang import Buffer, compute, lower # noqa: F401
2 changes: 1 addition & 1 deletion python/cinn/optim.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from .core_api.optim import ir_copy, simplify
from .core_api.optim import ir_copy, simplify # noqa: F401
2 changes: 1 addition & 1 deletion python/cinn/poly.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from .core_api.poly import create_stages
from .core_api.poly import create_stages # noqa: F401