Skip to content

Commit

Permalink
[CodeStyle][task 11] enable Ruff F403 rule in `python/paddle/base/__i…
Browse files Browse the repository at this point in the history
…nit__.py` (PaddlePaddle#57501)
  • Loading branch information
ooooo-create authored and jiahy0825 committed Oct 16, 2023
1 parent 1ee9a0c commit 82e6306
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 11 deletions.
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ ignore = [
"UP031",
"C408",
"UP030",
"F522",
"F403",
"C405",
"C417",
"PLR0402",
Expand Down
47 changes: 42 additions & 5 deletions python/paddle/base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,48 @@

# import all class inside framework into base module
from . import framework
from .framework import * # noqa: F403
from .framework import (
Program,
default_startup_program,
default_main_program,
program_guard,
name_scope,
ipu_shard_guard,
set_ipu_shard,
cuda_places,
cpu_places,
xpu_places,
cuda_pinned_places,
in_dygraph_mode,
in_pir_mode,
in_dynamic_or_pir_mode,
is_compiled_with_cinn,
is_compiled_with_cuda,
is_compiled_with_rocm,
is_compiled_with_xpu,
Variable,
require_version,
device_guard,
set_flags,
get_flags,
)

# import all class inside executor into base module
from . import executor
from .executor import * # noqa: F403
from .executor import (
Executor,
global_scope,
scope_guard,
)

from . import data_feed_desc
from .data_feed_desc import * # noqa: F403
from .data_feed_desc import DataFeedDesc

from . import dataset
from .dataset import * # noqa: F403
from .dataset import (
DatasetFactory,
InMemoryDataset,
)

from . import trainer_desc

Expand Down Expand Up @@ -72,7 +103,13 @@

from . import unique_name
from . import compiler
from .compiler import * # noqa: F403
from .compiler import (
CompiledProgram,
ExecutionStrategy,
BuildStrategy,
IpuCompiledProgram,
IpuStrategy,
)
from paddle.base.layers.math_op_patch import monkey_patch_variable
from .dygraph.base import enable_dygraph, disable_dygraph
from .dygraph.tensor_patch_methods import monkey_patch_tensor
Expand Down
2 changes: 1 addition & 1 deletion python/paddle/base/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def to_list(s):
# assign tensor alias
libpaddle.LoDTensor = libpaddle.Tensor

from .libpaddle import *
from .libpaddle import * # noqa: F403
from .libpaddle import ( # noqa: F401
__doc__,
__file__,
Expand Down
13 changes: 11 additions & 2 deletions python/paddle/base/dygraph/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,19 @@
# limitations under the License.

from . import base
from .base import * # noqa: F403
from .base import (
no_grad,
no_grad_,
grad,
guard,
enable_dygraph,
disable_dygraph,
enabled,
to_variable,
)

from . import tracer
from .tracer import * # noqa: F403
from .tracer import Tracer


__all__ = []
Expand Down
5 changes: 4 additions & 1 deletion python/paddle/base/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
from paddle.base.log_helper import get_logger

from . import reader
from .reader import *
from .reader import ( # noqa: F401
PyReader,
DataLoader,
)

__all__ = reader.__all__

Expand Down

0 comments on commit 82e6306

Please sign in to comment.