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][ruff] clean some F401 step: 8 #60108

Merged
merged 1 commit into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -134,24 +134,13 @@ known-first-party = ["paddle"]
"python/paddle/distributed/fleet/elastic/__init__.py" = ["F401", "I001"]

# temp ignore isort
"python/paddle/__init__.py" = ["I001"]
"python/paddle/amp/__init__.py" = ["I001"]
"python/paddle/audio/__init__.py" = ["I001"]
"python/paddle/audio/features/__init__.py" = ["I001"]
"python/paddle/audio/functional/__init__.py" = ["I001"]
"python/paddle/base/__init__.py" = ["I001"]
"python/paddle/distributed/__init__.py" = ["I001"]
"python/paddle/distributed/communication/stream/__init__.py" = ["I001"]
"python/paddle/device/cuda/__init__.py" = ["I001"]
"python/paddle/distributed/launch/context/__init__.py" = ["I001"]
"python/paddle/distributed/launch/controllers/__init__.py" = ["I001"]
"python/paddle/distributed/passes/__init__.py" = ["I001"]
"python/paddle/distributed/rpc/__init__.py" = ["I001"]
"python/paddle/distribution/__init__.py" = ["I001"]
"python/paddle/framework/__init__.py" = ["I001"]
"python/paddle/incubate/distributed/fleet/__init__.py" = ["I001"]
"python/paddle/incubate/distributed/fleet/parameter_server/pslib/__init__.py" = ["I001"]
"python/paddle/io/dataloader/__init__.py" = ["I001"]
"python/paddle/jit/__init__.py" = ["I001"]
"python/paddle/pir/__init__.py" = ["I001"]
"python/paddle/tensor/__init__.py" = ["I001"]
23 changes: 11 additions & 12 deletions python/paddle/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@
flops,
summary,
)
from .nn.functional.distance import ( # noqa: F401
pdist,
)
from .nn.initializer.lazy_init import LazyGuard
from .tensor.attribute import (
imag,
Expand Down Expand Up @@ -266,10 +269,12 @@
cast,
cast_,
chunk,
column_stack,
concat,
crop,
diagonal_scatter,
dsplit,
dstack,
expand,
expand_as,
flatten,
Expand All @@ -278,6 +283,7 @@
gather,
gather_nd,
hsplit,
hstack,
index_add,
index_add_,
index_fill,
Expand All @@ -286,31 +292,27 @@
index_put_,
masked_fill,
masked_fill_,
masked_scatter_,
masked_scatter,
masked_scatter_,
moveaxis,
put_along_axis,
select_scatter,
repeat_interleave,
reshape,
reshape_,
roll,
rot90,
row_stack,
scatter,
scatter_,
scatter_nd,
scatter_nd_add,
select_scatter,
shard_index,
slice,
split,
squeeze,
squeeze_,
stack,
hstack,
vstack,
dstack,
column_stack,
row_stack,
strided_slice,
take_along_axis,
tensor_split,
Expand All @@ -328,6 +330,7 @@
view,
view_as,
vsplit,
vstack,
)
from .tensor.math import ( # noqa: F401
abs,
Expand Down Expand Up @@ -489,8 +492,8 @@
vander,
)
from .tensor.random import (
binomial,
bernoulli,
binomial,
check_shape,
multinomial,
normal,
Expand Down Expand Up @@ -531,10 +534,6 @@
std,
var,
)

from .nn.functional.distance import ( # noqa: F401
pdist,
)
from .tensor.to_string import set_printoptions

# CINN has to set a flag to include a lib
Expand Down
6 changes: 1 addition & 5 deletions python/paddle/audio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from . import features
from . import functional
from . import datasets
from . import backends

from . import backends, datasets, features, functional
from .backends.backend import info, load, save

__all__ = [
Expand Down
2 changes: 1 addition & 1 deletion python/paddle/audio/features/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from .layers import (
MFCC,
LogMelSpectrogram,
MelSpectrogram,
MFCC,
Spectrogram,
)

Expand Down
1 change: 0 additions & 1 deletion python/paddle/audio/functional/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
mel_to_hz,
power_to_db,
)

from .window import get_window

__all__ = [
Expand Down
3 changes: 1 addition & 2 deletions python/paddle/base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
except Exception as e:
raise e

from .layers.math_op_patch import monkey_patch_variable

# import all class inside framework into base module
# import all class inside executor into base module
from . import ( # noqa: F401
Expand Down Expand Up @@ -116,6 +114,7 @@
xpu_places,
)
from .initializer import set_global_initializer # noqa: F401
from .layers.math_op_patch import monkey_patch_variable
from .lod_tensor import ( # noqa: F401
create_lod_tensor,
create_random_int_lodtensor,
Expand Down
2 changes: 1 addition & 1 deletion python/paddle/device/cuda/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from paddle.base.wrapped_decorator import signature_safe_contextmanager
from paddle.utils import deprecated

from .streams import Stream, Event
from .streams import Event, Stream

__all__ = [
'Stream',
Expand Down
20 changes: 8 additions & 12 deletions python/paddle/framework/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@
IPUPlace,
XPUPlace,
)
from .io import async_save, clear_async_save_task_queue # noqa: F401
from ..base.dygraph import base, to_variable # noqa: F401
from ..base.dygraph.base import disable_dygraph as enable_static # noqa: F401
from ..base.dygraph.base import enable_dygraph as disable_static # noqa: F401
from ..base.dygraph.base import grad # noqa: F401
from ..base.dygraph.base import no_grad_ as no_grad # noqa: F401
from ..base.dygraph.base import ( # noqa: F401
disable_dygraph as enable_static,
enable_dygraph as disable_static,
grad,
no_grad_ as no_grad,
)
from ..base.framework import ( # noqa: F401
Block,
IrGraph,
Expand All @@ -43,21 +44,15 @@
_get_paddle_place,
_global_flags,
_set_expected_place,
)
from ..base.framework import ( # noqa: F401
_stride_in_no_check_dy2st_diff as _no_check_dy2st_diff,
)
from ..base.framework import ( # noqa: F401
convert_np_dtype_to_dtype_,
deprecate_stat_dict,
disable_signal_handler,
dygraph_not_support,
dygraph_only,
generate_control_dev_var_name,
get_flags,
)
from ..base.framework import in_dygraph_mode as in_dynamic_mode # noqa: F401
from ..base.framework import ( # noqa: F401
in_dygraph_mode as in_dynamic_mode,
in_dynamic_or_pir_mode,
in_pir_mode,
set_flags,
Expand All @@ -66,6 +61,7 @@
use_pir_api,
)
from ..base.layer_helper import LayerHelper # noqa: F401
from .io import async_save, clear_async_save_task_queue # noqa: F401

# isort: off
# Do the *DUPLICATED* monkey-patch for the tensor object.
Expand Down
39 changes: 21 additions & 18 deletions python/paddle/io/dataloader/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,25 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from .dataset import Dataset # noqa: F401
from .dataset import IterableDataset # noqa: F401
from .dataset import TensorDataset # noqa: F401
from .dataset import ComposeDataset # noqa: F401
from .dataset import ChainDataset # noqa: F401
from .dataset import random_split # noqa: F401
from .dataset import Subset # noqa: F401
from .dataset import ConcatDataset # noqa: F401

from .batch_sampler import BatchSampler # noqa: F401
from .batch_sampler import DistributedBatchSampler # noqa: F401

from .batch_sampler import ( # noqa: F401
BatchSampler,
DistributedBatchSampler,
)
from .dataset import ( # noqa: F401
ChainDataset,
ComposeDataset,
ConcatDataset,
Dataset,
IterableDataset,
Subset,
TensorDataset,
random_split,
)
from .sampler import ( # noqa: F401
RandomSampler,
Sampler,
SequenceSampler,
SubsetRandomSampler,
WeightedRandomSampler,
)
from .worker import get_worker_info # noqa: F401

from .sampler import Sampler # noqa: F401
from .sampler import SequenceSampler # noqa: F401
from .sampler import RandomSampler # noqa: F401
from .sampler import WeightedRandomSampler # noqa: F401
from .sampler import SubsetRandomSampler # noqa: F401
9 changes: 2 additions & 7 deletions python/paddle/jit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from .api import save
from .api import load
from .api import to_static
from .api import not_to_static
from .api import ignore_module
from .dy2static.program_translator import enable_to_static

from .api import ignore_module, load, not_to_static, save, to_static
from .dy2static.logging_utils import set_code_level, set_verbosity
from .dy2static.program_translator import enable_to_static
from .translated_layer import TranslatedLayer

__all__ = [
Expand Down
6 changes: 3 additions & 3 deletions python/paddle/pir/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@
Program,
Type,
Value,
parse_program,
check_unregistered_ops,
create_shaped_type,
fake_op_result,
get_current_insertion_point,
is_fake_op_result,
parse_program,
register_paddle_dialect,
reset_insertion_point_to_end,
reset_insertion_point_to_start,
get_current_insertion_point,
set_insertion_point,
set_insertion_point_to_block_end,
translate_to_pir,
translate_to_pir_with_param_map,
create_shaped_type,
)

from . import core # noqa: F401
Expand Down
1 change: 0 additions & 1 deletion python/paddle/tensor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
zeros,
zeros_like,
)

from .einsum import einsum # noqa: F401
from .linalg import ( # noqa: F401
bincount,
Expand Down